Skip to content

refactor(l1, l2, levm): remove l2 feature flag from crates ethrex-vm and ethrex-levm #3367

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

Merged
merged 35 commits into from
Jun 30, 2025

Conversation

ilitteri
Copy link
Contributor

@ilitteri ilitteri commented Jun 27, 2025

Motivation

My primary goal was to remove the l2 feature flag from cmd/ethrex but to do this, we first need to remove it from:

  • ethrex-vm.
  • ethrex-levm.
  • ethrex-blockchain.

Description

This PR removes the feature flag l2 from crates ethrex-vm and ethrex-levm.

TL;DR:

  • In ethrex-vm the l2 precompiles logic was moved to a separate module, l2_precompiles.
  • A new VMType enum was introduced in ethrex-levm as a field of VM (main LEVM's struct). It is used by LEVM to behave differently where needed (this is specifically, when executing precompiles, and when executing hooks).
  • A new BlockchainType enum was introduced in ethrex-blockchain as a field of the struct Blockchain to differentiate when nodes are started as L1 or L2 nodes (this is later used in the code to instantiate the VM properly, matching the BlockchainType variants with VMType ones).

The l2 feature flag exists in ethrex-vm only because of ethrex-levm, so to remove it I needed to remove it from ethrex-levm first. The following commits do that:

After that, it was almost safe to remove it from ethrex-vm:

This brought some compilation errors that were solved in:

Next Steps

  • Remove feature flag l2 from ethrex-blockchain crate.
  • Remove feature flag l2 from cmd/ethrex.

@ilitteri ilitteri self-assigned this Jun 27, 2025
@Copilot Copilot AI review requested due to automatic review settings June 27, 2025 17:25
@ilitteri ilitteri added the levm Lambda EVM implementation label Jun 27, 2025
@ilitteri ilitteri requested a review from a team as a code owner June 27, 2025 17:25
@ilitteri ilitteri added L2 Rollup client L1 Ethereum client labels Jun 27, 2025
@ilitteri
Copy link
Contributor Author

PR is great, you pulled it off in a pretty clean way.

I just have one comment: For

  • dequeue_consolidation_requests
  • read_withdrawal_requests
  • beacon_root_contract_call
  • process_block_hash_history
    why send the vm_type as parameter in these? We have to make sure that they don’t run in l2, and if we do that well then we already know that the VM_TYPE is L1. One approach could be not having vm_type as parameter and hardcode L1 because they are intended to be used only in that context. Other approaches are good too but I think we shouldn’t even be able to execute them with the L2 if they are not made for it. It code reaches there it may indicate there’s a bug, right?
    Let me know what you think, current approach is not bad though, just that there may be safer or more self-explanatory alternatives to it.

Thanks for pointing this out, I wasn't sure which functions were supposed to be L1-exclusive. Addressed this issue by halting when non L2 LEVM functions are called in L2

@ilitteri ilitteri requested a review from JereSalo June 27, 2025 21:32
Copy link

No significant difference was registered for any benchmark run.

Detailed Results

Benchmark Results: BubbleSort

Command Mean [s] Min [s] Max [s] Relative
main_revm_BubbleSort 3.226 ± 0.021 3.210 3.265 1.01 ± 0.01
main_levm_BubbleSort 4.437 ± 0.028 4.411 4.493 1.38 ± 0.01
pr_revm_BubbleSort 3.206 ± 0.015 3.193 3.232 1.00
pr_levm_BubbleSort 4.487 ± 0.012 4.470 4.514 1.40 ± 0.01

Benchmark Results: ERC20Approval

Command Mean [s] Min [s] Max [s] Relative
main_revm_ERC20Approval 1.047 ± 0.010 1.033 1.060 1.00
main_levm_ERC20Approval 1.540 ± 0.010 1.528 1.559 1.47 ± 0.02
pr_revm_ERC20Approval 1.057 ± 0.041 1.037 1.174 1.01 ± 0.04
pr_levm_ERC20Approval 1.568 ± 0.006 1.559 1.576 1.50 ± 0.02

Benchmark Results: ERC20Mint

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Mint 137.8 ± 0.3 137.4 138.5 1.00
main_levm_ERC20Mint 259.6 ± 1.4 257.6 262.7 1.88 ± 0.01
pr_revm_ERC20Mint 138.3 ± 0.5 137.5 138.8 1.00 ± 0.00
pr_levm_ERC20Mint 267.7 ± 1.4 266.1 270.8 1.94 ± 0.01

Benchmark Results: ERC20Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Transfer 244.3 ± 1.4 242.8 246.9 1.00
main_levm_ERC20Transfer 404.8 ± 1.4 402.8 407.6 1.66 ± 0.01
pr_revm_ERC20Transfer 244.6 ± 0.6 243.6 245.5 1.00 ± 0.01
pr_levm_ERC20Transfer 410.4 ± 2.2 407.6 413.8 1.68 ± 0.01

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Factorial 231.5 ± 2.2 229.8 237.4 1.00
main_levm_Factorial 448.1 ± 5.2 444.0 460.8 1.94 ± 0.03
pr_revm_Factorial 242.1 ± 3.2 239.9 250.7 1.05 ± 0.02
pr_levm_Factorial 447.5 ± 2.6 445.0 454.2 1.93 ± 0.02

Benchmark Results: FactorialRecursive

Command Mean [s] Min [s] Max [s] Relative
main_revm_FactorialRecursive 1.573 ± 0.024 1.523 1.597 1.00
main_levm_FactorialRecursive 2.763 ± 0.012 2.747 2.788 1.76 ± 0.03
pr_revm_FactorialRecursive 1.638 ± 0.051 1.598 1.776 1.04 ± 0.04
pr_levm_FactorialRecursive 2.750 ± 0.023 2.722 2.800 1.75 ± 0.03

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Fibonacci 208.4 ± 0.8 207.7 210.3 1.00
main_levm_Fibonacci 442.7 ± 3.4 437.7 447.3 2.12 ± 0.02
pr_revm_Fibonacci 209.4 ± 1.8 208.0 214.1 1.00 ± 0.01
pr_levm_Fibonacci 448.0 ± 10.8 442.2 478.6 2.15 ± 0.05

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ManyHashes 8.8 ± 0.1 8.7 8.9 1.00
main_levm_ManyHashes 13.4 ± 0.2 13.3 14.1 1.52 ± 0.03
pr_revm_ManyHashes 8.8 ± 0.1 8.7 8.9 1.00 ± 0.01
pr_levm_ManyHashes 14.5 ± 1.1 13.5 16.1 1.64 ± 0.13

Benchmark Results: Push

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Push 295.6 ± 2.1 292.9 298.3 1.00
main_levm_Push 1052.0 ± 3.0 1048.3 1058.7 3.56 ± 0.03
pr_revm_Push 307.0 ± 5.3 303.1 319.1 1.04 ± 0.02
pr_levm_Push 1072.8 ± 3.7 1066.4 1078.5 3.63 ± 0.03

Copy link

No significant difference was registered for any benchmark run.

Detailed Results

Benchmark Results: BubbleSort

Command Mean [s] Min [s] Max [s] Relative
main_revm_BubbleSort 3.217 ± 0.011 3.205 3.236 1.01 ± 0.01
main_levm_BubbleSort 4.434 ± 0.022 4.411 4.470 1.39 ± 0.02
pr_revm_BubbleSort 3.200 ± 0.037 3.176 3.288 1.00
pr_levm_BubbleSort 4.504 ± 0.048 4.452 4.617 1.41 ± 0.02

Benchmark Results: ERC20Approval

Command Mean [s] Min [s] Max [s] Relative
main_revm_ERC20Approval 1.061 ± 0.009 1.050 1.075 1.02 ± 0.02
main_levm_ERC20Approval 1.562 ± 0.013 1.547 1.580 1.50 ± 0.02
pr_revm_ERC20Approval 1.039 ± 0.013 1.025 1.068 1.00
pr_levm_ERC20Approval 1.579 ± 0.017 1.567 1.620 1.52 ± 0.02

Benchmark Results: ERC20Mint

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Mint 137.1 ± 0.7 135.7 138.1 1.00 ± 0.01
main_levm_ERC20Mint 262.8 ± 4.1 258.9 271.5 1.92 ± 0.03
pr_revm_ERC20Mint 136.8 ± 0.6 136.1 137.7 1.00
pr_levm_ERC20Mint 270.0 ± 2.8 267.6 277.3 1.97 ± 0.02

Benchmark Results: ERC20Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Transfer 244.8 ± 0.9 244.0 247.0 1.01 ± 0.01
main_levm_ERC20Transfer 407.8 ± 2.7 405.2 413.6 1.68 ± 0.02
pr_revm_ERC20Transfer 243.0 ± 2.3 240.5 247.0 1.00
pr_levm_ERC20Transfer 412.4 ± 4.2 406.9 423.3 1.70 ± 0.02

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Factorial 239.1 ± 22.2 228.0 301.0 1.00
main_levm_Factorial 527.8 ± 259.1 442.5 1265.1 2.21 ± 1.10
pr_revm_Factorial 242.7 ± 4.8 240.3 256.3 1.02 ± 0.10
pr_levm_Factorial 449.3 ± 4.5 445.2 461.2 1.88 ± 0.18

Benchmark Results: FactorialRecursive

Command Mean [s] Min [s] Max [s] Relative
main_revm_FactorialRecursive 1.568 ± 0.029 1.511 1.611 1.00
main_levm_FactorialRecursive 2.847 ± 0.083 2.791 3.074 1.82 ± 0.06
pr_revm_FactorialRecursive 1.601 ± 0.031 1.533 1.634 1.02 ± 0.03
pr_levm_FactorialRecursive 2.813 ± 0.028 2.773 2.853 1.79 ± 0.04

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Fibonacci 208.6 ± 2.7 206.9 216.2 1.00
main_levm_Fibonacci 438.6 ± 8.1 432.9 460.5 2.10 ± 0.05
pr_revm_Fibonacci 209.0 ± 1.2 207.5 211.3 1.00 ± 0.01
pr_levm_Fibonacci 445.3 ± 3.2 441.9 452.3 2.14 ± 0.03

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ManyHashes 8.7 ± 0.1 8.7 8.9 1.00
main_levm_ManyHashes 14.1 ± 0.1 13.9 14.2 1.61 ± 0.02
pr_revm_ManyHashes 8.8 ± 0.1 8.7 9.0 1.01 ± 0.01
pr_levm_ManyHashes 14.5 ± 0.1 14.4 14.6 1.65 ± 0.01

Benchmark Results: Push

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Push 290.6 ± 1.4 288.9 292.7 1.00
main_levm_Push 1041.4 ± 3.8 1037.6 1050.9 3.58 ± 0.02
pr_revm_Push 303.2 ± 1.3 301.8 305.1 1.04 ± 0.01
pr_levm_Push 1074.6 ± 14.4 1062.6 1108.7 3.70 ± 0.05

@ilitteri ilitteri added the simplification Any refactor that makes code simpler and more straight forward label Jun 27, 2025
Copy link
Collaborator

@MegaRedHand MegaRedHand left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -26,6 +26,13 @@ use std::{

pub type Storage = HashMap<U256, H256>;

#[derive(Debug, Clone, Default)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should avoid marking one of these as default.

Copy link

No significant difference was registered for any benchmark run.

Detailed Results

Benchmark Results: BubbleSort

Command Mean [s] Min [s] Max [s] Relative
main_revm_BubbleSort 3.136 ± 0.013 3.118 3.158 1.00
main_levm_BubbleSort 4.564 ± 0.058 4.486 4.651 1.46 ± 0.02
pr_revm_BubbleSort 3.170 ± 0.030 3.144 3.234 1.01 ± 0.01
pr_levm_BubbleSort 4.524 ± 0.277 4.374 5.178 1.44 ± 0.09

Benchmark Results: ERC20Approval

Command Mean [s] Min [s] Max [s] Relative
main_revm_ERC20Approval 1.049 ± 0.008 1.042 1.064 1.00 ± 0.01
main_levm_ERC20Approval 1.556 ± 0.019 1.537 1.597 1.49 ± 0.03
pr_revm_ERC20Approval 1.045 ± 0.013 1.034 1.074 1.00
pr_levm_ERC20Approval 1.530 ± 0.012 1.518 1.559 1.46 ± 0.02

Benchmark Results: ERC20Mint

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Mint 137.8 ± 0.5 137.1 139.0 1.00
main_levm_ERC20Mint 262.6 ± 1.4 260.9 265.2 1.91 ± 0.01
pr_revm_ERC20Mint 137.9 ± 1.2 136.8 140.1 1.00 ± 0.01
pr_levm_ERC20Mint 258.1 ± 2.7 255.2 264.8 1.87 ± 0.02

Benchmark Results: ERC20Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Transfer 245.0 ± 1.5 243.3 247.3 1.00 ± 0.01
main_levm_ERC20Transfer 407.9 ± 2.6 405.2 412.9 1.67 ± 0.02
pr_revm_ERC20Transfer 244.2 ± 1.6 242.4 247.6 1.00
pr_levm_ERC20Transfer 401.3 ± 2.0 398.7 405.1 1.64 ± 0.01

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Factorial 231.6 ± 0.6 230.9 232.5 1.00 ± 0.00
main_levm_Factorial 437.6 ± 3.6 434.8 447.1 1.89 ± 0.02
pr_revm_Factorial 231.1 ± 0.5 230.2 231.8 1.00
pr_levm_Factorial 448.7 ± 3.2 445.5 454.9 1.94 ± 0.01

Benchmark Results: FactorialRecursive

Command Mean [s] Min [s] Max [s] Relative
main_revm_FactorialRecursive 1.619 ± 0.027 1.556 1.653 1.00
main_levm_FactorialRecursive 2.815 ± 0.040 2.779 2.894 1.74 ± 0.04
pr_revm_FactorialRecursive 1.619 ± 0.023 1.592 1.647 1.00 ± 0.02
pr_levm_FactorialRecursive 2.780 ± 0.032 2.747 2.850 1.72 ± 0.04

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Fibonacci 205.8 ± 0.4 205.0 206.5 1.00
main_levm_Fibonacci 431.0 ± 2.5 427.5 435.4 2.09 ± 0.01
pr_revm_Fibonacci 206.4 ± 0.5 205.9 207.7 1.00 ± 0.00
pr_levm_Fibonacci 439.7 ± 3.9 435.4 449.4 2.14 ± 0.02

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ManyHashes 8.7 ± 0.1 8.7 8.8 1.00
main_levm_ManyHashes 14.0 ± 0.0 14.0 14.1 1.61 ± 0.01
pr_revm_ManyHashes 8.8 ± 0.1 8.7 9.1 1.01 ± 0.01
pr_levm_ManyHashes 13.5 ± 0.1 13.3 13.7 1.54 ± 0.02

Benchmark Results: Push

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Push 294.2 ± 0.7 293.3 295.3 1.00
main_levm_Push 1050.9 ± 5.8 1035.6 1056.1 3.57 ± 0.02
pr_revm_Push 294.8 ± 1.4 293.5 298.0 1.00 ± 0.01
pr_levm_Push 1075.1 ± 7.4 1056.0 1082.8 3.65 ± 0.03

@ilitteri ilitteri enabled auto-merge June 30, 2025 20:16
@ilitteri ilitteri disabled auto-merge June 30, 2025 20:16
Co-authored-by: Jeremías Salomón <48994069+JereSalo@users.noreply.github.com>
Copy link

No significant difference was registered for any benchmark run.

Detailed Results

Benchmark Results: BubbleSort

Command Mean [s] Min [s] Max [s] Relative
main_revm_BubbleSort 3.139 ± 0.013 3.124 3.158 1.00
main_levm_BubbleSort 4.534 ± 0.058 4.471 4.630 1.44 ± 0.02
pr_revm_BubbleSort 3.165 ± 0.020 3.143 3.208 1.01 ± 0.01
pr_levm_BubbleSort 4.440 ± 0.036 4.399 4.509 1.41 ± 0.01

Benchmark Results: ERC20Approval

Command Mean [s] Min [s] Max [s] Relative
main_revm_ERC20Approval 1.045 ± 0.015 1.033 1.083 1.00
main_levm_ERC20Approval 1.570 ± 0.006 1.562 1.584 1.50 ± 0.02
pr_revm_ERC20Approval 1.048 ± 0.013 1.033 1.068 1.00 ± 0.02
pr_levm_ERC20Approval 1.530 ± 0.010 1.517 1.552 1.46 ± 0.02

Benchmark Results: ERC20Mint

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Mint 140.2 ± 5.4 137.6 155.5 1.02 ± 0.04
main_levm_ERC20Mint 263.0 ± 3.0 260.1 269.3 1.92 ± 0.02
pr_revm_ERC20Mint 137.2 ± 0.5 136.7 138.2 1.00
pr_levm_ERC20Mint 254.9 ± 1.7 253.3 258.8 1.86 ± 0.01

Benchmark Results: ERC20Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Transfer 243.0 ± 1.0 241.9 244.7 1.00
main_levm_ERC20Transfer 411.5 ± 2.9 408.6 417.3 1.69 ± 0.01
pr_revm_ERC20Transfer 246.5 ± 6.1 242.7 262.9 1.01 ± 0.03
pr_levm_ERC20Transfer 397.7 ± 2.2 395.1 401.8 1.64 ± 0.01

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Factorial 235.2 ± 7.3 229.9 249.3 1.01 ± 0.03
main_levm_Factorial 446.6 ± 7.5 439.0 458.4 1.92 ± 0.03
pr_revm_Factorial 232.4 ± 1.3 230.2 235.1 1.00
pr_levm_Factorial 449.6 ± 1.5 447.1 451.8 1.93 ± 0.01

Benchmark Results: FactorialRecursive

Command Mean [s] Min [s] Max [s] Relative
main_revm_FactorialRecursive 1.629 ± 0.016 1.615 1.670 1.00
main_levm_FactorialRecursive 2.662 ± 0.037 2.630 2.753 1.63 ± 0.03
pr_revm_FactorialRecursive 1.640 ± 0.029 1.603 1.687 1.01 ± 0.02
pr_levm_FactorialRecursive 2.739 ± 0.012 2.718 2.753 1.68 ± 0.02

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Fibonacci 206.8 ± 1.8 205.5 211.7 1.00 ± 0.01
main_levm_Fibonacci 445.3 ± 10.1 436.7 470.2 2.16 ± 0.05
pr_revm_Fibonacci 206.3 ± 1.7 205.1 211.1 1.00
pr_levm_Fibonacci 447.2 ± 8.0 440.4 464.7 2.17 ± 0.04

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ManyHashes 8.8 ± 0.0 8.7 8.8 1.00
main_levm_ManyHashes 13.7 ± 0.2 13.5 14.1 1.56 ± 0.02
pr_revm_ManyHashes 8.9 ± 0.1 8.9 9.0 1.02 ± 0.01
pr_levm_ManyHashes 13.2 ± 0.1 13.0 13.3 1.50 ± 0.01

Benchmark Results: Push

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Push 294.9 ± 1.0 293.5 296.6 1.00 ± 0.01
main_levm_Push 1159.9 ± 18.4 1139.5 1203.9 3.94 ± 0.07
pr_revm_Push 294.5 ± 1.6 291.1 297.4 1.00
pr_levm_Push 1034.0 ± 10.6 1025.7 1062.0 3.51 ± 0.04

Copy link

No significant difference was registered for any benchmark run.

Detailed Results

Benchmark Results: BubbleSort

Command Mean [s] Min [s] Max [s] Relative
main_revm_BubbleSort 3.137 ± 0.026 3.110 3.206 1.00
main_levm_BubbleSort 4.510 ± 0.167 4.436 4.983 1.44 ± 0.05
pr_revm_BubbleSort 3.178 ± 0.057 3.148 3.339 1.01 ± 0.02
pr_levm_BubbleSort 4.392 ± 0.021 4.354 4.431 1.40 ± 0.01

Benchmark Results: ERC20Approval

Command Mean [s] Min [s] Max [s] Relative
main_revm_ERC20Approval 1.050 ± 0.045 1.032 1.176 1.00
main_levm_ERC20Approval 1.526 ± 0.015 1.508 1.550 1.45 ± 0.06
pr_revm_ERC20Approval 1.063 ± 0.008 1.052 1.082 1.01 ± 0.04
pr_levm_ERC20Approval 1.515 ± 0.010 1.504 1.532 1.44 ± 0.06

Benchmark Results: ERC20Mint

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Mint 138.3 ± 0.4 137.8 138.9 1.00 ± 0.00
main_levm_ERC20Mint 255.9 ± 2.8 254.1 263.4 1.86 ± 0.02
pr_revm_ERC20Mint 137.9 ± 0.5 137.3 138.9 1.00
pr_levm_ERC20Mint 258.9 ± 3.0 254.5 264.0 1.88 ± 0.02

Benchmark Results: ERC20Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Transfer 242.8 ± 1.7 241.1 245.9 1.00
main_levm_ERC20Transfer 397.3 ± 2.2 395.6 403.0 1.64 ± 0.01
pr_revm_ERC20Transfer 246.0 ± 0.8 245.0 246.8 1.01 ± 0.01
pr_levm_ERC20Transfer 401.6 ± 15.0 394.0 443.9 1.65 ± 0.06

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Factorial 233.7 ± 2.6 231.7 240.3 1.01 ± 0.01
main_levm_Factorial 440.4 ± 4.3 436.1 446.6 1.90 ± 0.02
pr_revm_Factorial 231.6 ± 1.1 229.8 233.1 1.00
pr_levm_Factorial 445.4 ± 1.0 444.4 447.2 1.92 ± 0.01

Benchmark Results: FactorialRecursive

Command Mean [s] Min [s] Max [s] Relative
main_revm_FactorialRecursive 1.623 ± 0.034 1.559 1.662 1.01 ± 0.04
main_levm_FactorialRecursive 2.637 ± 0.038 2.609 2.737 1.64 ± 0.05
pr_revm_FactorialRecursive 1.603 ± 0.048 1.507 1.655 1.00
pr_levm_FactorialRecursive 2.667 ± 0.025 2.638 2.724 1.66 ± 0.05

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Fibonacci 207.6 ± 0.7 206.5 208.6 1.01 ± 0.00
main_levm_Fibonacci 441.0 ± 25.5 428.1 507.3 2.15 ± 0.12
pr_revm_Fibonacci 205.2 ± 0.4 204.5 205.7 1.00
pr_levm_Fibonacci 438.7 ± 7.7 430.8 459.2 2.14 ± 0.04

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ManyHashes 8.7 ± 0.1 8.6 8.9 1.00
main_levm_ManyHashes 13.5 ± 0.2 13.3 14.0 1.55 ± 0.03
pr_revm_ManyHashes 8.8 ± 0.0 8.8 8.9 1.01 ± 0.01
pr_levm_ManyHashes 12.9 ± 0.1 12.8 13.1 1.49 ± 0.02

Benchmark Results: Push

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Push 296.8 ± 1.1 295.4 299.1 1.01 ± 0.00
main_levm_Push 1040.9 ± 4.5 1034.7 1048.9 3.54 ± 0.02
pr_revm_Push 294.1 ± 0.9 293.2 296.0 1.00
pr_levm_Push 1072.2 ± 3.0 1065.3 1075.7 3.65 ± 0.02

@ilitteri ilitteri added this pull request to the merge queue Jun 30, 2025
Merged via the queue into main with commit 8940f50 Jun 30, 2025
43 of 44 checks passed
@ilitteri ilitteri deleted the remove_l2_feature_flag_from_levm branch June 30, 2025 21:25
SDartayet pushed a commit that referenced this pull request Jul 1, 2025
…vm` and `ethrex-levm` (#3367)

**Motivation**

My primary goal was to remove the `l2` feature flag from `cmd/ethrex`
but to do this, we first need to remove it from:
- `ethrex-vm`.
- `ethrex-levm`.
- `ethrex-blockchain`.

**Description**

This PR removes the feature flag `l2` from crates `ethrex-vm` and
`ethrex-levm`.

> *TL;DR:*
> - In `ethrex-vm` the l2 precompiles logic was moved to a separate
module, `l2_precompiles`.
> - A new `VMType` enum was introduced in `ethrex-levm` as a field of
`VM` (main LEVM's struct). It is used by LEVM to behave differently
where needed (this is specifically, when executing precompiles, and when
executing hooks).
> - A new `BlockchainType` enum was introduced in `ethrex-blockchain` as
a field of the struct `Blockchain` to differentiate when nodes are
started as L1 or L2 nodes (this is later used in the code to instantiate
the VM properly, matching the `BlockchainType` variants with `VMType`
ones).

The `l2` feature flag exists in `ethrex-vm` only because of
`ethrex-levm`, so to remove it I needed to remove it from `ethrex-levm`
first. The following commits do that:
- [Move l2 precompiles logic to new
module](28843a6)
- [Remove feature flag from hooks public
API](39a509f)
- [Use the correct
functions](3023b88)
- [Replace
get_hooks](88bc9a2)
- [Remove l2 feature flag from
levm](8b09883)

After that, it was almost safe to remove it from `ethrex-vm`:
- [Remove l2 feature flag from vm
crate](fd971be)

This brought some compilation errors that were solved in:
- [Implement BlockchainType and fix
compilation](32557eb)

**Next Steps**

- Remove feature flag `l2` from `ethrex-blockchain` crate.
- Remove feature flag `l2` from `cmd/ethrex`.

---------

Co-authored-by: Jeremías Salomón <48994069+JereSalo@users.noreply.github.com>
ElFantasma pushed a commit that referenced this pull request Jul 1, 2025
…vm` and `ethrex-levm` (#3367)

**Motivation**

My primary goal was to remove the `l2` feature flag from `cmd/ethrex`
but to do this, we first need to remove it from:
- `ethrex-vm`.
- `ethrex-levm`.
- `ethrex-blockchain`.

**Description**

This PR removes the feature flag `l2` from crates `ethrex-vm` and
`ethrex-levm`.

> *TL;DR:*
> - In `ethrex-vm` the l2 precompiles logic was moved to a separate
module, `l2_precompiles`.
> - A new `VMType` enum was introduced in `ethrex-levm` as a field of
`VM` (main LEVM's struct). It is used by LEVM to behave differently
where needed (this is specifically, when executing precompiles, and when
executing hooks).
> - A new `BlockchainType` enum was introduced in `ethrex-blockchain` as
a field of the struct `Blockchain` to differentiate when nodes are
started as L1 or L2 nodes (this is later used in the code to instantiate
the VM properly, matching the `BlockchainType` variants with `VMType`
ones).

The `l2` feature flag exists in `ethrex-vm` only because of
`ethrex-levm`, so to remove it I needed to remove it from `ethrex-levm`
first. The following commits do that:
- [Move l2 precompiles logic to new
module](28843a6)
- [Remove feature flag from hooks public
API](39a509f)
- [Use the correct
functions](3023b88)
- [Replace
get_hooks](88bc9a2)
- [Remove l2 feature flag from
levm](8b09883)

After that, it was almost safe to remove it from `ethrex-vm`:
- [Remove l2 feature flag from vm
crate](fd971be)

This brought some compilation errors that were solved in:
- [Implement BlockchainType and fix
compilation](32557eb)

**Next Steps**

- Remove feature flag `l2` from `ethrex-blockchain` crate.
- Remove feature flag `l2` from `cmd/ethrex`.

---------

Co-authored-by: Jeremías Salomón <48994069+JereSalo@users.noreply.github.com>
github-merge-queue bot pushed a commit that referenced this pull request Jul 2, 2025
…ture flag from `ethrex-blockchain` (#3371)

> [!WARNING]
> Merge after #3367

**Motivation**

To completely remove the `l2` feature flag from `cmd/ethrex` in favor of
having a single binary for running ethrex (L1 and L2), there are some
local dependencies from which to remove this feature first. These are:

1. `ethrex-vm`.
2. `ethrex-levm`.
3. `ethrex-blockchain`. 

1 and 2 are removed in #3367,
and 3 is meant to be removed in this PR.

**Description**

Decouples the L2 metrics logic from the L1's, allowing to remove the use
of the `l2` feature flag from the crate `ethrex-blockchain`.

- Creates a `crates/blockchain/metrics/l2` module with `metrics.rs` and
`api.rs` submodules.
- Makes use of this new module in `cmd/ethrex`.
- Removes `l2` feature flag from `ethrex-blockchain` crate.
- Removes the import of `ethrex-blockchain/l2` where needed.
github-merge-queue bot pushed a commit that referenced this pull request Jul 4, 2025
…e binary for both L1 and L2 (#3381)

> [!WARNING]
> Merge after #3371

**Motivation**

We want `ethrex` to be a single binary for both running L1 and L2. For
this, we need to remove the `l2` feature flag from `cmd/ethrex`, a work
that includes removing the same feature flag from the following crates:

1. `ethrex-vm`.
2. `ethrex-levm`.
3. `ethrex-blockchain`. 

1 and 2 are removed in #3367,
and 3 is removed in #3371.

**Description**

Removes `l2` feature flag from `cmd/ethrex`
d-roak pushed a commit to 1sixtech/ethrex that referenced this pull request Jul 17, 2025
…vm` and `ethrex-levm` (lambdaclass#3367)

**Motivation**

My primary goal was to remove the `l2` feature flag from `cmd/ethrex`
but to do this, we first need to remove it from:
- `ethrex-vm`.
- `ethrex-levm`.
- `ethrex-blockchain`.

**Description**

This PR removes the feature flag `l2` from crates `ethrex-vm` and
`ethrex-levm`.

> *TL;DR:*
> - In `ethrex-vm` the l2 precompiles logic was moved to a separate
module, `l2_precompiles`.
> - A new `VMType` enum was introduced in `ethrex-levm` as a field of
`VM` (main LEVM's struct). It is used by LEVM to behave differently
where needed (this is specifically, when executing precompiles, and when
executing hooks).
> - A new `BlockchainType` enum was introduced in `ethrex-blockchain` as
a field of the struct `Blockchain` to differentiate when nodes are
started as L1 or L2 nodes (this is later used in the code to instantiate
the VM properly, matching the `BlockchainType` variants with `VMType`
ones).

The `l2` feature flag exists in `ethrex-vm` only because of
`ethrex-levm`, so to remove it I needed to remove it from `ethrex-levm`
first. The following commits do that:
- [Move l2 precompiles logic to new
module](lambdaclass@28843a6)
- [Remove feature flag from hooks public
API](lambdaclass@39a509f)
- [Use the correct
functions](lambdaclass@3023b88)
- [Replace
get_hooks](lambdaclass@88bc9a2)
- [Remove l2 feature flag from
levm](lambdaclass@8b09883)

After that, it was almost safe to remove it from `ethrex-vm`:
- [Remove l2 feature flag from vm
crate](lambdaclass@fd971be)

This brought some compilation errors that were solved in:
- [Implement BlockchainType and fix
compilation](lambdaclass@32557eb)

**Next Steps**

- Remove feature flag `l2` from `ethrex-blockchain` crate.
- Remove feature flag `l2` from `cmd/ethrex`.

---------

Co-authored-by: Jeremías Salomón <48994069+JereSalo@users.noreply.github.com>
d-roak pushed a commit to 1sixtech/ethrex that referenced this pull request Jul 17, 2025
…ture flag from `ethrex-blockchain` (lambdaclass#3371)

> [!WARNING]
> Merge after lambdaclass#3367

**Motivation**

To completely remove the `l2` feature flag from `cmd/ethrex` in favor of
having a single binary for running ethrex (L1 and L2), there are some
local dependencies from which to remove this feature first. These are:

1. `ethrex-vm`.
2. `ethrex-levm`.
3. `ethrex-blockchain`. 

1 and 2 are removed in lambdaclass#3367,
and 3 is meant to be removed in this PR.

**Description**

Decouples the L2 metrics logic from the L1's, allowing to remove the use
of the `l2` feature flag from the crate `ethrex-blockchain`.

- Creates a `crates/blockchain/metrics/l2` module with `metrics.rs` and
`api.rs` submodules.
- Makes use of this new module in `cmd/ethrex`.
- Removes `l2` feature flag from `ethrex-blockchain` crate.
- Removes the import of `ethrex-blockchain/l2` where needed.
d-roak pushed a commit to 1sixtech/ethrex that referenced this pull request Jul 17, 2025
…e binary for both L1 and L2 (lambdaclass#3381)

> [!WARNING]
> Merge after lambdaclass#3371

**Motivation**

We want `ethrex` to be a single binary for both running L1 and L2. For
this, we need to remove the `l2` feature flag from `cmd/ethrex`, a work
that includes removing the same feature flag from the following crates:

1. `ethrex-vm`.
2. `ethrex-levm`.
3. `ethrex-blockchain`. 

1 and 2 are removed in lambdaclass#3367,
and 3 is removed in lambdaclass#3371.

**Description**

Removes `l2` feature flag from `cmd/ethrex`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L1 Ethereum client L2 Rollup client levm Lambda EVM implementation simplification Any refactor that makes code simpler and more straight forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants