-
Notifications
You must be signed in to change notification settings - Fork 54
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
fix(rln-relay): sync from deployed block number #1955
Conversation
You can find the image built from this PR at
|
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.
lgtm! Thanks for this, a great improvement that will i) reduce rln tree sync time by a lot and ii) avoid choking eth nodes by requesting less blocks at once (something quite important when using your own non infura node)
left some comments, nothing critical but relevant imho.
🚀 thanks! |
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.
couple of comments, one might be important?
else: | ||
let deployedBlockNumber = g.rlnContractDeployedBlockNumber.get() | ||
let deployedBlockNumber = g.rlnContractDeployedBlockNumber |
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.
nitpick, but not needed?
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.
Addressed in 110a8a8
@@ -76,11 +76,11 @@ template initializedGuard(g: OnchainGroupManager): untyped = | |||
|
|||
|
|||
proc setMetadata*(g: OnchainGroupManager): RlnRelayResult[void] = | |||
if g.latestProcessedBlock.isNone(): | |||
if g.latestProcessedBlock == 0: |
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.
mmm do we still need to error here? guess 0 could be an ok value? eg at startup?
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.
there shouldn't be a reason to save the metadata if the latest block number is 0, hence there were 2 options here, either a noop or an error, went for the latter
addressed in b78072c
110a8a8
to
b78072c
Compare
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.
LGTM! thanks!
@@ -39,6 +39,7 @@ contract(RlnStorage): | |||
proc MEMBERSHIP_DEPOSIT(): Uint256 {.pure.} | |||
proc members(idCommitment: Uint256): Uint256 {.view.} | |||
proc idCommitmentIndex(): Uint256 {.view.} | |||
proc deployedBlockNumber(): Uint256 {.view.} |
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.
Looks nice indeed! However, I wonder if we could add comments above each of these procs to elaborate more about their purposes.
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.
will address in a follow up pr :)
info "reconnecting with the Ethereum client, and restarting group sync", fromBlock = fromBlock | ||
try: | ||
let newEthRpc = waitFor newWeb3(g.ethClientUrl) |
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 makes sense to perform some retrial mechanism?
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.
hi! #1958 tracks handling delays, this piece of code does handle the reconnections!
Description
Syncs from the deployed block number to prevent excess network calls
Changes
Issue
closes #1942