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

feat(l1): implement EIP-2935 #1876

Merged
merged 12 commits into from
Feb 11, 2025
Merged

feat(l1): implement EIP-2935 #1876

merged 12 commits into from
Feb 11, 2025

Conversation

JulianVentura
Copy link
Contributor

@JulianVentura JulianVentura commented Feb 5, 2025

Motivation

This EIP has to be implemented in order to support Prague update.

Description

This PR implements EIP-2935. Prague EF tests for this EIP have been enabled.

Closes #1786

@JulianVentura JulianVentura self-assigned this Feb 5, 2025
Copy link

github-actions bot commented Feb 5, 2025

| File                                                            | Lines | Diff |
+-----------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/blockchain/payload.rs    | 662   | +20  |
+-----------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/vm/backends/constants.rs | 3     | +3   |
+-----------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/vm/backends/levm.rs      | 303   | +48  |
+-----------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/vm/backends/mod.rs       | 21    | +1   |
+-----------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/vm/backends/revm.rs      | 481   | +50  |
+-----------------------------------------------------------------+-------+------+

Total lines added: +122
Total lines removed: 0
Total lines changed: 122

@JulianVentura JulianVentura marked this pull request as ready for review February 6, 2025 19:13
@JulianVentura JulianVentura requested a review from a team as a code owner February 6, 2025 19:13
Copy link
Contributor

@fborello-lambda fborello-lambda left a comment

Choose a reason for hiding this comment

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

LGTM 👍, let's wait for another review before merging.

// This function applies system level operations:
// - Call beacon root contract, and obtain the new state root
// - Call block hash process contract, and store parent block hash
pub fn apply_system_operations(context: &mut PayloadBuildContext) -> Result<(), EvmError> {
#[cfg(feature = "levm")]
Copy link
Collaborator

Choose a reason for hiding this comment

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

levm ff doesn't exist anymore, pls sync with main before merging

@@ -270,6 +269,7 @@ pub fn apply_withdrawals(context: &mut PayloadBuildContext) -> Result<(), EvmErr
.unwrap_or(EVMConfig::canonical_values(fork));
let config = EVMConfig::new(fork, blob_schedule);

let mut new_state: HashMap<_, _> = HashMap::new();
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: why specify the type at all if you are using underscores?


context.block_cache.extend(new_state);
new_state.extend(report.new_state.clone());
Copy link
Collaborator

Choose a reason for hiding this comment

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

seems we're doing a lot of cloning. Are all these cheap?

crates/vm/vm.rs Outdated
@@ -153,6 +157,62 @@ cfg_if::cfg_if! {

}

/// Calls the EIP-2935 process block hashes history system call contract
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are two possibilities.

  1. Ideally, we can abstract the logic between levm/revm and implement process_block_hash_history, agnostic of the implementation of the vm (levm or revm).
  2. If 1 is impossible, we should at least have a levm and revm folder or module were we specify these implementations.

@JulianVentura JulianVentura added this pull request to the merge queue Feb 11, 2025
Merged via the queue into main with commit 68a7ba4 Feb 11, 2025
22 checks passed
@JulianVentura JulianVentura deleted the feat/eip-2935 branch February 11, 2025 21:38
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.

EIP-2935: Save historical block hashes in state
3 participants