Skip to content

chore(l1): standarize revm/levm behaviour when importing blocks. #2452

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mpaulucci
Copy link
Collaborator

@mpaulucci mpaulucci commented Apr 11, 2025

Description

  • standarize revm/levm behaviour when importing blocks
  • Remove fork choice when importing blocks.
  • Move block importing out of blockchain module

@mpaulucci mpaulucci requested a review from a team as a code owner April 11, 2025 18:07
Copy link

github-actions bot commented Apr 11, 2025

Lines of code report

Total lines added: 22
Total lines removed: 51
Total lines changed: 73

Detailed view
+----------------------------------------+-------+------+
| File                                   | Lines | Diff |
+----------------------------------------+-------+------+
| ethrex/cmd/ethrex/cli.rs               | 313   | +22  |
+----------------------------------------+-------+------+
| ethrex/crates/blockchain/blockchain.rs | 456   | -51  |
+----------------------------------------+-------+------+


if let Some(last_block) = blocks.last() {
let hash = last_block.hash();
if let Err(error) = apply_fork_choice(&store, hash, hash, hash).await {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

applying forkchoice should set all the blocks as canonical, you don't need to do it explicitly

@@ -306,5 +307,32 @@ pub async fn import_blocks(path: &str, data_dir: &str, network: &str, evm: EvmEn
info!("Importing blocks from chain file: {path}");
utils::read_chain_file(path)
};
blockchain.import_blocks(&blocks).await;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why remove the method instead of refactoring it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't see the point of having such a function. It is ambiguous with add_block(s). What is the point of having a function that adds blocks + calls forkchoice instead of calling the two function separately?

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.

2 participants