Skip to content

Commit

Permalink
chore(rln-relay): health check should account for window of roots (#2664
Browse files Browse the repository at this point in the history
)

* test(rln-relay): health check should account for window of roots

* fix: some type-fu

* fix: widen the type vs narrowing

* fix: add extra parens
  • Loading branch information
rymnc authored May 8, 2024
1 parent b46226f commit 6a1af92
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions waku/waku_rln_relay/group_manager/on_chain/group_manager.nim
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ proc getNewBlockCallback(g: OnchainGroupManager): proc =
g.retryWrapper(handleBlockRes, "Failed to handle new block"):
await g.getAndHandleEvents(fromBlock, latestBlock)

# cannot use isOkOr here because results in a compile-time error that
# cannot use isOkOr here because results in a compile-time error that
# shows the error is void for some reason
let setMetadataRes = g.setMetadata()
if setMetadataRes.isErr():
Expand Down Expand Up @@ -855,7 +855,8 @@ method isReady*(g: OnchainGroupManager): Future[bool] {.async.} =
g.retryWrapper(currentBlock, "Failed to get the current block number"):
cast[BlockNumber](await g.ethRpc.get().provider.eth_blockNumber())

if g.latestProcessedBlock < currentBlock:
# the node is still able to process messages if it is behind the latest block by a factor of the valid roots
if u256(g.latestProcessedBlock) < (u256(currentBlock) - u256(g.validRoots.len)):
return false

return not (await g.isSyncing())

0 comments on commit 6a1af92

Please sign in to comment.