Skip to content

fix(levm): fix last blockchain tests for LEVM#2842

Merged
JereSalo merged 6 commits into
mainfrom
levm/fix_tests_levm
May 19, 2025
Merged

fix(levm): fix last blockchain tests for LEVM#2842
JereSalo merged 6 commits into
mainfrom
levm/fix_tests_levm

Conversation

@JereSalo

@JereSalo JereSalo commented May 19, 2025

Copy link
Copy Markdown
Contributor

Motivation

  • Fix remaining blockchain tests for Prague with LEVM.

Description

  • Precompiles shouldn't be executed in case they are delegation target of the same transaction in which they are being called.
  • It also fixes a problem in the transfer of value in CALL. (It just moves the place where the value transfer is performed)

After this there are no more blockchain tests we need to fix.

Co-authored-by: @DiegoCivi

@github-actions

github-actions Bot commented May 19, 2025

Copy link
Copy Markdown

Lines of code report

Total lines added: 35
Total lines removed: 77
Total lines changed: 112

Detailed view
+-----------------------------------------------------+-------+------+
| File                                                | Lines | Diff |
+-----------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/ethrex.rs                         | 88    | -8   |
+-----------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/initializers.rs                   | 370   | -18  |
+-----------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/l2/command.rs                     | 199   | -8   |
+-----------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/utils.rs                          | 128   | -20  |
+-----------------------------------------------------+-------+------+
| ethrex/crates/l2/prover/bench/src/rpc/db.rs         | 488   | +14  |
+-----------------------------------------------------+-------+------+
| ethrex/crates/l2/prover/bench/src/rpc/mod.rs        | 319   | +1   |
+-----------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/discv4/server.rs       | 675   | -8   |
+-----------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/network.rs             | 176   | -1   |
+-----------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/types.rs               | 406   | -14  |
+-----------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/opcode_handlers/system.rs | 757   | +1   |
+-----------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/utils.rs                  | 506   | +5   |
+-----------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/vm.rs                     | 164   | +14  |
+-----------------------------------------------------+-------+------+

@github-actions

github-actions Bot commented May 19, 2025

Copy link
Copy Markdown

Benchmark Results Comparison

PR Results

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
revm_Factorial 239.0 ± 0.5 238.1 239.9 1.00
levm_Factorial 815.8 ± 7.2 811.4 835.2 3.41 ± 0.03

Benchmark Results: Factorial - Recursive

Command Mean [s] Min [s] Max [s] Relative
revm_FactorialRecursive 1.536 ± 0.095 1.404 1.681 1.00
levm_FactorialRecursive 13.108 ± 0.131 12.972 13.269 8.53 ± 0.54

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
revm_Fibonacci 218.5 ± 1.2 216.1 220.0 1.00
levm_Fibonacci 830.1 ± 21.5 811.3 883.6 3.80 ± 0.10

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ManyHashes 8.8 ± 0.1 8.8 9.0 1.00
levm_ManyHashes 17.1 ± 0.2 16.9 17.7 1.94 ± 0.03

Benchmark Results: BubbleSort

Command Mean [s] Min [s] Max [s] Relative
revm_BubbleSort 3.279 ± 0.020 3.264 3.334 1.00
levm_BubbleSort 5.547 ± 0.040 5.502 5.624 1.69 ± 0.02

Benchmark Results: ERC20 - Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ERC20Transfer 252.2 ± 3.0 249.7 259.5 1.00
levm_ERC20Transfer 500.2 ± 5.5 494.3 508.8 1.98 ± 0.03

Benchmark Results: ERC20 - Mint

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ERC20Mint 143.7 ± 2.2 141.9 149.7 1.00
levm_ERC20Mint 322.2 ± 5.8 318.1 337.6 2.24 ± 0.05

Benchmark Results: ERC20 - Approval

Command Mean [s] Min [s] Max [s] Relative
revm_ERC20Approval 1.063 ± 0.013 1.049 1.085 1.00
levm_ERC20Approval 1.906 ± 0.036 1.879 1.993 1.79 ± 0.04

Main Results

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
revm_Factorial 240.2 ± 1.4 238.7 242.7 1.00
levm_Factorial 815.1 ± 3.8 810.7 821.5 3.39 ± 0.03

Benchmark Results: Factorial - Recursive

Command Mean [s] Min [s] Max [s] Relative
revm_FactorialRecursive 1.574 ± 0.059 1.480 1.667 1.00
levm_FactorialRecursive 13.042 ± 0.057 12.984 13.126 8.29 ± 0.31

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
revm_Fibonacci 210.0 ± 2.3 206.5 214.1 1.00
levm_Fibonacci 821.8 ± 9.4 809.7 834.6 3.91 ± 0.06

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ManyHashes 8.7 ± 0.0 8.6 8.8 1.00
levm_ManyHashes 17.3 ± 0.1 17.2 17.5 1.98 ± 0.02

Benchmark Results: BubbleSort

Command Mean [s] Min [s] Max [s] Relative
revm_BubbleSort 3.211 ± 0.006 3.204 3.223 1.00
levm_BubbleSort 5.499 ± 0.051 5.438 5.611 1.71 ± 0.02

Benchmark Results: ERC20 - Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ERC20Transfer 249.3 ± 1.5 247.9 253.1 1.00
levm_ERC20Transfer 501.3 ± 5.8 494.7 514.4 2.01 ± 0.03

Benchmark Results: ERC20 - Mint

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ERC20Mint 142.3 ± 2.0 140.7 146.5 1.00
levm_ERC20Mint 319.6 ± 2.0 317.2 323.3 2.25 ± 0.03

Benchmark Results: ERC20 - Approval

Command Mean [s] Min [s] Max [s] Relative
revm_ERC20Approval 1.027 ± 0.005 1.023 1.038 1.00
levm_ERC20Approval 1.880 ± 0.015 1.861 1.915 1.83 ± 0.02

@JereSalo JereSalo added the levm Lambda EVM implementation label May 19, 2025
@JereSalo JereSalo self-assigned this May 19, 2025
@JereSalo JereSalo marked this pull request as ready for review May 19, 2025 18:33
@JereSalo JereSalo requested a review from a team as a code owner May 19, 2025 18:33
"tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_set_code_to_precompile[fork_Prague-precompile_0x0000000000000000000000000000000000000003-call_opcode_CALL-evm_code_type_LEGACY-blockchain_test_from_state_test]",
];

// NOTE: These 3 tests fail on LEVM with a stack overflow if we do not increase the stack size by using RUST_MIN_STACK=11000000

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed some time ago since a LEVM refactor, this is not a problem anymore

@fmoletta fmoletta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚀

@github-project-automation github-project-automation Bot moved this to In Review in ethrex_l1 May 19, 2025

@fedacking fedacking left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@JereSalo JereSalo added this pull request to the merge queue May 19, 2025

@LeanSerra LeanSerra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🐐

Merged via the queue into main with commit 9ba8270 May 19, 2025
39 checks passed
@JereSalo JereSalo deleted the levm/fix_tests_levm branch May 19, 2025 20:05
@github-project-automation github-project-automation Bot moved this from In Review to Done in ethrex_l1 May 19, 2025
pedrobergamini pushed a commit to pedrobergamini/ethrex that referenced this pull request Aug 24, 2025
**Motivation**

- Fix remaining blockchain tests for Prague with LEVM.

**Description**

- Precompiles shouldn't be executed in case they are delegation target
of the same transaction in which they are being called.
- It also fixes a problem in the transfer of value in CALL. (It just
moves the place where the value transfer is performed)

After this there are no more `blockchain` tests we need to fix.


<!-- Link to issues: Resolves lambdaclass#111, Resolves lambdaclass#222 -->

Co-authored-by: @DiegoCivi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

levm Lambda EVM implementation

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants