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

fix(levm, l1): fix hive tests rpc #2176

Merged
merged 9 commits into from
Mar 14, 2025
Merged

fix(levm, l1): fix hive tests rpc #2176

merged 9 commits into from
Mar 14, 2025

Conversation

JereSalo
Copy link
Contributor

@JereSalo JereSalo commented Mar 7, 2025

Motivation

  • When executing ethereum/rpc simulation with LEVM we have errors in a lot of tests. The error is when executing the blocks for the setup for these tests and how we created the withdrawals requests introduced in EIP-7002

Description

  • First, when we execute the transactions, we weren't handling if the account was delegated and we weren't using the correct bytecode.
    For this, we add the check for delegated accounts and get the bytecode. This is made when creating a new VM and using the function eip7702_get_code().
  • Second, when creating the withdrawals requests, we were overwritting and loosing some of the new values in the account updates. We now merge both updates.
  • When running the system contract for the withdrawals requests introduced in EIP 7002, we were creating a new CacheDB instead of using the one with updated values.

Status

  • All RPC Hive tests were passing, but with the changed made here, 12 are failing due to a new missing implementation.

Links to #2158

@JereSalo JereSalo added ef-tests Hive tests, execution-spec-tests levm Lambda EVM implementation labels Mar 7, 2025
@JereSalo JereSalo self-assigned this Mar 7, 2025
Copy link

github-actions bot commented Mar 7, 2025

Lines of code report

Total lines added: 6
Total lines removed: 1
Total lines changed: 7

Detailed view
+---------------------------------------+-------+------+
| File                                  | Lines | Diff |
+---------------------------------------+-------+------+
| ethrex/crates/vm/backends/levm/mod.rs | 442   | +6   |
+---------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/vm.rs       | 429   | -1   |
+---------------------------------------+-------+------+

Copy link

github-actions bot commented Mar 7, 2025

EF Tests Comparison

Same results between main branch and the current PR.

Copy link

github-actions bot commented Mar 7, 2025

Benchmark Results Comparison

PR Results

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
revm_Factorial 234.5 ± 1.9 233.0 239.7 1.00
levm_Factorial 904.8 ± 4.3 899.8 913.1 3.86 ± 0.04

Benchmark Results: Factorial - Recursive

Command Mean [s] Min [s] Max [s] Relative
revm_FactorialRecursive 1.396 ± 0.071 1.333 1.574 1.00
levm_FactorialRecursive 15.647 ± 0.125 15.493 15.770 11.21 ± 0.58

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
revm_Fibonacci 208.2 ± 5.3 204.1 222.9 1.00
levm_Fibonacci 911.0 ± 14.4 896.0 937.9 4.38 ± 0.13

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ManyHashes 8.5 ± 0.0 8.5 8.6 1.00
levm_ManyHashes 18.4 ± 0.1 18.3 18.6 2.15 ± 0.02

Benchmark Results: BubbleSort

Command Mean [s] Min [s] Max [s] Relative
revm_BubbleSort 3.218 ± 0.011 3.206 3.241 1.00
levm_BubbleSort 6.050 ± 0.009 6.038 6.064 1.88 ± 0.01

Benchmark Results: ERC20 - Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ERC20Transfer 244.5 ± 2.7 242.7 251.7 1.00
levm_ERC20Transfer 539.6 ± 4.6 534.3 546.4 2.21 ± 0.03

Benchmark Results: ERC20 - Mint

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ERC20Mint 140.7 ± 1.5 139.2 143.5 1.00
levm_ERC20Mint 354.1 ± 7.2 349.9 373.2 2.52 ± 0.06

Benchmark Results: ERC20 - Approval

Command Mean [s] Min [s] Max [s] Relative
revm_ERC20Approval 1.026 ± 0.012 1.014 1.053 1.00
levm_ERC20Approval 2.021 ± 0.011 2.009 2.045 1.97 ± 0.02

Main Results

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
revm_Factorial 235.0 ± 1.3 233.3 237.1 1.00
levm_Factorial 906.9 ± 22.2 887.2 948.4 3.86 ± 0.10

Benchmark Results: Factorial - Recursive

Command Mean [s] Min [s] Max [s] Relative
revm_FactorialRecursive 1.423 ± 0.089 1.322 1.570 1.00
levm_FactorialRecursive 15.608 ± 0.095 15.485 15.736 10.97 ± 0.69

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
revm_Fibonacci 206.8 ± 3.0 202.5 214.4 1.00
levm_Fibonacci 905.5 ± 29.9 878.3 958.9 4.38 ± 0.16

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ManyHashes 8.7 ± 0.1 8.6 8.8 1.00
levm_ManyHashes 18.7 ± 1.2 18.0 22.2 2.15 ± 0.14

Benchmark Results: BubbleSort

Command Mean [s] Min [s] Max [s] Relative
revm_BubbleSort 3.183 ± 0.021 3.159 3.223 1.00
levm_BubbleSort 6.078 ± 0.027 6.046 6.132 1.91 ± 0.01

Benchmark Results: ERC20 - Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ERC20Transfer 244.5 ± 4.7 241.2 256.7 1.00
levm_ERC20Transfer 545.0 ± 12.8 538.3 580.8 2.23 ± 0.07

Benchmark Results: ERC20 - Mint

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ERC20Mint 139.7 ± 2.2 137.9 144.3 1.00
levm_ERC20Mint 351.5 ± 1.7 349.5 354.9 2.52 ± 0.04

Benchmark Results: ERC20 - Approval

Command Mean [s] Min [s] Max [s] Relative
revm_ERC20Approval 1.029 ± 0.013 1.012 1.050 1.00
levm_ERC20Approval 2.018 ± 0.017 1.999 2.054 1.96 ± 0.03

Copy link

github-actions bot commented Mar 11, 2025

Benchmark Block Execution Results Comparison Against Main

Command Mean [s] Min [s] Max [s] Relative
base 141.269 ± 0.626 140.339 142.538 1.00
head 146.525 ± 0.907 145.617 148.375 1.04 ± 0.01

TxResult::Success => {
new_state.extend(report.new_state.clone());
}
TxResult::Success => {}
Copy link
Contributor

@tomip01 tomip01 Mar 11, 2025

Choose a reason for hiding this comment

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

We were adding the new states in two places. I removed this one and kept the second one

@tomip01 tomip01 marked this pull request as ready for review March 11, 2025 19:17
@tomip01 tomip01 requested a review from a team as a code owner March 11, 2025 19:17
Copy link
Contributor

@LeanSerra LeanSerra left a comment

Choose a reason for hiding this comment

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

Great work ^_^

tomip01

This comment was marked as resolved.

@tomip01 tomip01 dismissed their stale review March 14, 2025 15:57

testing

@ilitteri ilitteri added this pull request to the merge queue Mar 14, 2025
Merged via the queue into main with commit f897535 Mar 14, 2025
46 checks passed
@ilitteri ilitteri deleted the levm/fix_rpc_hive_tests branch March 14, 2025 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ef-tests Hive tests, execution-spec-tests levm Lambda EVM implementation
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants