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): add suport for stDelegatecallTestHomestead test suite #1899

Merged
merged 31 commits into from
Feb 14, 2025

Conversation

tomip01
Copy link
Contributor

@tomip01 tomip01 commented Feb 10, 2025

Motivation

In this PR we increase the test passed in the stDelegatecallTestHomestead test suite.

Description

  • We add the pre tangerine gas costs for sload, selfdestruct and extcodecopy.
  • We now don't apply the "all but one 64th" introduced in the eip-150.
  • We invalidate the transaction if we use a delegatecall opcode introduced in eip-7 for previous forks to Homestead.
  • We add on previous fork to Spurious Dragon to set the nonce to 0 instead of 1. This is due to eip-161.

Closes #1886

Copy link

github-actions bot commented Feb 10, 2025

| File                                                                         | Lines | Diff |
+------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/vm/levm/src/gas_cost.rs               | 1122  | +5   |
+------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/vm/levm/src/opcode_handlers/system.rs | 710   | +7   |
+------------------------------------------------------------------------------+-------+------+

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

Copy link

github-actions bot commented Feb 13, 2025

Benchmark Results Comparison

PR Results

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
revm_Factorial 238.7 ± 0.8 238.0 240.9 1.00
levm_Factorial 913.4 ± 10.1 901.5 929.4 3.83 ± 0.04

Benchmark Results: Factorial - Recursive

Command Mean [s] Min [s] Max [s] Relative
revm_FactorialRecursive 1.526 ± 0.104 1.373 1.675 1.00
levm_FactorialRecursive 15.694 ± 0.021 15.665 15.724 10.28 ± 0.70

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
revm_Fibonacci 211.4 ± 2.0 209.9 216.5 1.00
levm_Fibonacci 910.9 ± 12.0 898.3 931.5 4.31 ± 0.07

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.1 ± 0.1 17.9 18.3 2.09 ± 0.02

Benchmark Results: BubbleSort

Command Mean [s] Min [s] Max [s] Relative
revm_BubbleSort 3.264 ± 0.028 3.228 3.337 1.00
levm_BubbleSort 6.128 ± 0.050 6.075 6.243 1.88 ± 0.02

Benchmark Results: ERC20 - Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ERC20Transfer 251.1 ± 2.9 248.3 258.3 1.00
levm_ERC20Transfer 547.4 ± 12.4 537.2 579.1 2.18 ± 0.06

Benchmark Results: ERC20 - Mint

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ERC20Mint 141.8 ± 0.6 141.1 142.9 1.00
levm_ERC20Mint 352.3 ± 2.4 349.8 356.6 2.48 ± 0.02

Benchmark Results: ERC20 - Approval

Command Mean [s] Min [s] Max [s] Relative
revm_ERC20Approval 1.071 ± 0.073 1.035 1.277 1.00
levm_ERC20Approval 2.042 ± 0.017 2.021 2.066 1.91 ± 0.13

Main Results

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
revm_Factorial 239.0 ± 0.5 238.5 239.9 1.00
levm_Factorial 903.7 ± 7.5 898.2 922.6 3.78 ± 0.03

Benchmark Results: Factorial - Recursive

Command Mean [s] Min [s] Max [s] Relative
revm_FactorialRecursive 1.465 ± 0.095 1.353 1.610 1.00
levm_FactorialRecursive 15.743 ± 0.021 15.709 15.767 10.75 ± 0.70

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
revm_Fibonacci 212.3 ± 1.0 211.4 214.7 1.00
levm_Fibonacci 902.9 ± 13.6 889.6 923.8 4.25 ± 0.07

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ManyHashes 8.8 ± 0.1 8.7 8.9 1.00
levm_ManyHashes 18.3 ± 0.1 18.1 18.5 2.08 ± 0.03

Benchmark Results: BubbleSort

Command Mean [s] Min [s] Max [s] Relative
revm_BubbleSort 3.271 ± 0.026 3.246 3.330 1.00
levm_BubbleSort 6.134 ± 0.032 6.110 6.206 1.88 ± 0.02

Benchmark Results: ERC20 - Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ERC20Transfer 248.7 ± 0.9 247.6 250.1 1.00
levm_ERC20Transfer 545.2 ± 4.8 538.9 552.2 2.19 ± 0.02

Benchmark Results: ERC20 - Mint

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ERC20Mint 141.4 ± 0.5 140.8 142.3 1.00
levm_ERC20Mint 355.5 ± 1.8 352.9 359.0 2.51 ± 0.02

Benchmark Results: ERC20 - Approval

Command Mean [s] Min [s] Max [s] Relative
revm_ERC20Approval 1.041 ± 0.009 1.034 1.065 1.00
levm_ERC20Approval 2.046 ± 0.019 2.015 2.085 1.97 ± 0.03

Copy link

github-actions bot commented Feb 13, 2025

EF Tests Comparison

Test Name MAIN PR DIFF
Summary: 15613/16775 (93.07%) 15843/16775 (94.44%) ⬆️ 230
Prague: 2373/2373 (100.00%) 2373/2373 (100.00%) ➖️
Cancun: 3579/3579 (100.00%) 3579/3579 (100.00%) ➖️
Shanghai: 221/221 (100.00%) 221/221 (100.00%) ➖️
Paris: 62/62 (100.00%) 62/62 (100.00%) ➖️
London: 39/39 (100.00%) 39/39 (100.00%) ➖️
Berlin: 35/35 (100.00%) 35/35 (100.00%) ➖️
Istanbul: 35/35 (100.00%) 35/35 (100.00%) ➖️
Petersburg: 2345/2400 (97.71%) 2345/2400 (97.71%) ➖️
Constantinople: 2258/2406 (93.85%) 2258/2406 (93.85%) ➖️
Byzantium: 2284/2330 (98.03%) 2284/2330 (98.03%) ➖️
SpuriousDragon: 521/579 (89.98%) 521/579 (89.98%) ➖️
Tangerine: 445/650 (68.46%) 463/650 (71.23%) ⬆️ 18
Homestead: 991/1324 (74.85%) 1085/1324 (81.95%) ⬆️ 94
Frontier: 425/742 (57.28%) 543/742 (73.18%) ⬆️ 118

@tomip01 tomip01 self-assigned this Feb 13, 2025
@tomip01 tomip01 added ef-tests Hive tests, execution-spec-tests levm Lambda EVM implementation labels Feb 13, 2025
@tomip01 tomip01 marked this pull request as ready for review February 13, 2025 20:54
@tomip01 tomip01 requested a review from a team as a code owner February 13, 2025 20:54
@tomip01 tomip01 changed the title Levm/delegate call homestead fix(levm): add suport for stDelegatecallTestHomestead test suite Feb 13, 2025
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.

Looks good. One question, are we using the variable SELFDESTRUCT_COST_PRE_TANGERINE?

@tomip01 tomip01 enabled auto-merge February 14, 2025 12:55
@tomip01 tomip01 added this pull request to the merge queue Feb 14, 2025
Merged via the queue into main with commit 017333a Feb 14, 2025
27 checks passed
@tomip01 tomip01 deleted the levm/delegate-call-homestead branch February 14, 2025 13:18
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
None yet
Development

Successfully merging this pull request may close these issues.

LEVM: Add support for the stDelegatecallTestHomestead test suite
2 participants