Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(rln-relay): health check should account for window of roots #2664

Merged
merged 4 commits into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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())
Loading