-
Notifications
You must be signed in to change notification settings - Fork 515
Fix/fallback sequential for sync methods #3211
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/fallback sequential for sync methods #3211
Conversation
mattsse
left a comment
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.
smol suggestions
| fn requires_sequential_execution(method: &str) -> bool { | ||
| matches!( | ||
| method, | ||
| // EIP-7966: eth_sendRawTransactionSync - waits for receipt | ||
| // Parallel issue: returns receipt from first node, "already known" from others | ||
| "eth_sendRawTransactionSync" | | ||
| // eth_sendTransactionSync - same as above but for unsigned transactions | ||
| // Parallel issue: returns receipt from first node, "already known" from others | ||
| "eth_sendTransactionSync" | ||
| ) | ||
| } |
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.
can we make this a hashset in the fallbacklayer itself, with these values as the default, then a user can install addiitonal ones on demand
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.
can we make this a hashset in the fallbacklayer itself, with these values as the default, then a user can install addiitonal ones on demand
ok, let me think about it
| /// | ||
| /// This approach ensures methods like `eth_sendRawTransactionSync` return the correct | ||
| /// receipt instead of "already known" errors from parallel execution. | ||
| async fn make_request_sequential( |
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.
this makes sense
mattsse
left a comment
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.
ty!
Motivation
Fixes #3186
The
FallbackLayerimplementation was using parallel fan-out for all RPC methods, which caused issues with methods that have non-deterministic results when executed concurrently across multiple nodes.Specifically,
eth_sendRawTransactionSync(EIP-7966) waits for a transaction receipt. When executed in parallel, for example:The
FallbackLayerwould incorrectly return the fast "already known" error instead of waiting for the actual receipt from the slower node.Solution
Introduced selective execution strategies based on result determinism:
Added
requires_sequential_execution()function - Identifies RPC methods that return non-deterministic results when executed in parallel:eth_sendRawTransactionSync(EIP-7966)eth_sendTransactionSyncAdded
make_request_sequential()method - Implements sequential fallback that tries transports one-by-one until success, respecting the ranking system.Modified
make_request()- Routes non-deterministic methods to sequential execution while keeping parallel execution for all other methods (includingeth_sendRawTransaction, which returns a deterministic transaction hash).Key Design Decision: Not all stateful methods require sequential execution. Methods like
eth_sendRawTransactionare stateful but return deterministic results (transaction hashes), making parallel execution safe and beneficial for performance.Representation -
PR Checklist
test_non_deterministic_method_uses_sequential_fallback- Verifieseth_sendRawTransactionSyncuses sequential execution and returns correct receipttest_deterministic_method_uses_parallel_execution- Verifieseth_sendRawTransactioncontinues using parallel execution for performance