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

fix(rln-relay): graceful retries on rpc calls #2250

Merged
merged 4 commits into from
Dec 11, 2023

Conversation

rymnc
Copy link
Contributor

@rymnc rymnc commented Nov 27, 2023

Description

This PR introduces graceful retries for rpc calls made by the onchain group manager to improve robustness of rln-relay.

Changes

  • New module retry_wrapper that exposes a template retryWrapper that accepts a retry strategy, error string and res var

TODO:

  • establish good retry strategies for each rpc call. Set to default for now, which is, 1000 millis delay, and 3 tries

Issue

closes #2217
closes #2204

@rymnc rymnc added the E:RLN on mainnet see https://github.com/waku-org/pm/issues/98 for details label Nov 27, 2023
@rymnc rymnc self-assigned this Nov 27, 2023
Copy link

github-actions bot commented Nov 27, 2023

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:2250

Built from 90074c2

@rymnc rymnc marked this pull request as ready for review November 27, 2023 11:22
@rymnc
Copy link
Contributor Author

rymnc commented Nov 27, 2023

for the js-waku integration test seems that some peer management test is failing, should be OK on our side

Copy link
Collaborator

@Ivansete-status Ivansete-status left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for it!
Just added a couple of minor comments.
The js-waku test set has been failing for more than a month so we expect it.

Comment on lines +147 to +148
retryWrapper(gasPrice, RetryStrategy.new(), "Failed to get gas price"):
int(await ethRpc.provider.eth_gasPrice()) * 2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick. Shall we have a little comment explaining why * 2?

except CatchableError:
error "failed to get the current block number", error = getCurrentExceptionMsg()
return false
retryWrapper(currentBlock, RetryStrategy.new(), "Failed to get the current block number"):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick. I see the RetryStrategy.new() is always being used. I wonder if we could clean it a little and have it created as a default parameter value.
That applies elsewhere.

Suggested change
retryWrapper(currentBlock, RetryStrategy.new(), "Failed to get the current block number"):
retryWrapper(currentBlock, "Failed to get the current block number"):

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried having it set as default in the template, but templates don't allow that with multiple params afaik

@rymnc
Copy link
Contributor Author

rymnc commented Dec 4, 2023

cc: @alrevuelta for a review please :)

Copy link
Contributor

@alrevuelta alrevuelta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm thanks.

@rymnc rymnc linked an issue Dec 6, 2023 that may be closed by this pull request
@rymnc rymnc merged commit 15c1f97 into master Dec 11, 2023
12 checks passed
@rymnc rymnc deleted the graceful-retry-onchain-group-manager branch December 11, 2023 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E:RLN on mainnet see https://github.com/waku-org/pm/issues/98 for details
Projects
Archived in project
3 participants