-
Notifications
You must be signed in to change notification settings - Fork 57
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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(): | ||
|
@@ -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 uint(g.latestProcessedBlock) < uint(currentBlock) - uint(g.validRoots.len): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isn't it better widening rather than narrowing? i mean instead of casting everything to unit and operating with that, using the wondering also if in the first run we can hit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. currentBlock will never be 0, since that is fetched from the chain (and we can operate under the assumption that it will always be greater than 0). good point about widening vs narrowing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. casted to |
||
return false | ||
|
||
return not (await g.isSyncing()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if is safer to add parenthesis:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't harm, i would add it as well :)