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

improve(retryProvider): Avoid retry on eth_call reverts #757

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pxrl
Copy link
Contributor

@pxrl pxrl commented Oct 25, 2024

eth_call requests where the provider returns a response indicating revert have a near-zero chance of succeeding against another RPC provider. Instead of wasting time rotating through the list of RPC providers, just throw immediately and let the upper layers handle it.

This will potentially save quite a bit of time in the relayer in cases where it unsuccessfully performs a static call to determine whether a fill would complete.

eth_call requests where the provider returns a response indicating
revert have a near-zero chance of succeeding against another RPC
provider. Instead of wasting time rotating through the list of RPC
providers, just throw immediately and let the upper layers handle it.

This will potentially save quite a bit of time in the relayer in cases
where it unsuccessfully performs a static call to determine whether a
fill would complete.
@pxrl pxrl requested review from mrice32 and bmzig October 25, 2024 20:06
// Most node implementations return 3 for an eth_call revert, but some return -32000.
// See also https://www.jsonrpc.org/specification
if (code < -32768 || code > -32100) {
if (method === "eth_call" && message.toLowerCase().includes("revert")) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This could maybe also be conditional on quorumThreshold === 1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Still todo after discussion w/ @mrice32: update _trySend() such that it can identify a revert on an eth_call and short-circuit the retry loop that is inevitably occurring. This would shave off at least 3+ seconds per call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant