-
Notifications
You must be signed in to change notification settings - Fork 381
[eth_call] Fix interaction between prestate tracers and state overrides #1812
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
Conversation
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.
Pull Request Overview
This PR refactors the state override mechanism for eth_call to apply overrides directly to original account states during State object construction, rather than applying them after construction. This ensures that tracers (PreState and StateDiff) capture the correct pre-execution state including overrides.
Key Changes:
- Moved state override application logic from
eth_call.cppinto theStateconstructor - Added a new templated
Stateconstructor that accepts state overrides as a parameter - Modified state overrides to work directly with
OriginalAccountStateinstead of using state mutation methods
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| category/rpc/eth_call.cpp | Simplified to use new State constructor with state overrides parameter |
| category/execution/ethereum/state3/state.hpp | Added templated constructor that applies state overrides to original account states |
| category/rpc/eth_call_test.cpp | Added test validating PreState and StateDiff tracers with state overrides |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
5b55631 to
76cc85b
Compare
47b374b to
8bd9c40
Compare
8bd9c40 to
becb63d
Compare
becb63d to
d3a36d1
Compare
318b8b7 to
8a2f039
Compare
8a2f039 to
a6c98a9
Compare
e6de0be to
461cd7b
Compare
461cd7b to
766ec35
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.
Pull Request Overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
766ec35 to
e90e137
Compare
The problem is that state overrides are applied to `State::current` accounts, whereas the prestate trace is computed from `State::original`. Thus prestate tracers do not respect state overrides. In this patch, we merge the state overrides into the block state before execution, and create a new `State` instance with this updated block state, meaning that the former `State::current` accounts will be `State::original` in the new state instance. This new state instance is then passed to execution.
e90e137 to
cc8a0c7
Compare
No description provided.