-
Notifications
You must be signed in to change notification settings - Fork 131
refactor(l1): make improvements to public functions used by ethrex_replay #5416
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
Lines of code reportTotal lines added: Detailed view |
Benchmark for d980dadClick to view benchmark
|
Benchmark for 73f4104Click to view benchmark
|
Benchmark for 97aa0aaClick to view benchmark
|
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 two public functions used by ethrex_replay to improve performance and reduce parameter coupling. The from_nodes function no longer decodes nodes internally (avoiding redundant decoding when called multiple times), and execution_witness_from_rpc_chain_config now extracts the initial state root directly from the witness headers rather than requiring it as a parameter.
- Performance improvement:
from_nodesnow accepts pre-decoded nodes to avoid redundant decoding - Simplified API:
execution_witness_from_rpc_chain_configextracts initial state root from headers instead of requiring it as a parameter - Better encapsulation: Initial state root logic is now self-contained within the witness conversion function
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/networking/rpc/debug/execution_witness.rs | Removes initial_state_root parameter and adds logic to extract it from witness headers; adds BlockHeader import |
| crates/common/trie/db.rs | Changes from_nodes signature to accept BTreeMap<H256, Node> instead of BTreeMap<H256, NodeRLP>, removing internal decoding logic and unused imports |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
tomip01
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.
Looks good
**Motivation** <!-- Why does this pull request exist? What are its goals? --> **Description** <!-- A clear and concise general description of the changes this PR introduces --> - Use simplified `execution_witness_from_rpc_chain_config` function. - The advantage of this is that we get to remove a lot of code 😃 - Decode all nodes just once. This is a huge improvement in storage preparation performance for no-zkvm executions. Before when ran in `debug` mode the storage preparation was taking almost a **whole minute** because nodes were being decoded over and over again every time we ran `from_nodes`, now this function in the correspondent ethrex PR receives the nodes already decoded. - This started being a problem because of [this](https://github.com/lambdaclass/ethrex/pull/5224/files#diff-5586f62a6533f683576523ff0bfcb3d336411d569f12062649dbb34cd30c33adR67). Before we didn't need to decode the nodes in order to generate the `InMemoryTrieDB`. Ethrex related PR: lambdaclass/ethrex#5416
Motivation
Description
execution_witness_from_rpc_chain_confignow gets the initial state root from the rpc_witness itself. This should ALWAYS be in the block headers, otherwise it returns an error.Related Replay PR: lambdaclass/ethrex-replay#50