Skip to content

Commit

Permalink
fix compilation with -d:has_deposit_root_checks (#5855)
Browse files Browse the repository at this point in the history
Since #4465, compilation with `-d:has_deposit_root_checks` fails. #4707
further built on top of it but the additions also don't compile. Fix it.
  • Loading branch information
etan-status authored Feb 6, 2024
1 parent 4140302 commit f0f14f1
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions beacon_chain/el/el_manager.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,7 @@ when hasDepositRootChecks:

proc fetchDepositContractData(connection: ELConnection,
rpcClient: RpcClient,
depositContact: Sender[DepositContract],
depositContract: Sender[DepositContract],
blk: Eth1Block): Future[DepositContractDataStatus] {.async.} =
let
startTime = Moment.now
Expand All @@ -1416,8 +1416,10 @@ when hasDepositRootChecks:
failureAllowed = true)

try:
let fetchedRoot = asEth2Digest(
awaitWithTimeout(depositRoot, deadline))
let fetchedRoot = asEth2Digest(block:
awaitWithTimeout(depositRoot, deadline):
raise newException(DataProviderTimeout,
"Request time out while obtaining deposits root"))
if blk.depositRoot.isZero:
blk.depositRoot = fetchedRoot
result = Fetched
Expand All @@ -1432,8 +1434,10 @@ when hasDepositRootChecks:
result = DepositRootUnavailable

try:
let fetchedCount = bytes_to_uint64(
awaitWithTimeout(rawCount, deadline).toArray)
let fetchedCount = bytes_to_uint64((block:
awaitWithTimeout(rawCount, deadline):
raise newException(DataProviderTimeout,
"Request time out while obtaining deposits count")).toArray)
if blk.depositCount == 0:
blk.depositCount = fetchedCount
elif blk.depositCount != fetchedCount:
Expand Down Expand Up @@ -1610,7 +1614,8 @@ proc syncBlockRange(m: ELManager,
template lastBlock: auto = blocksWithDeposits[lastIdx]

let status = when hasDepositRootChecks:
rpcClient.fetchDepositContractData(depositContract, lastBlock)
await fetchDepositContractData(
connection, rpcClient, depositContract, lastBlock)
else:
DepositRootUnavailable

Expand Down

0 comments on commit f0f14f1

Please sign in to comment.