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): fix gas costs eip150 #1910

Merged
merged 29 commits into from
Feb 13, 2025
Merged

fix(levm): fix gas costs eip150 #1910

merged 29 commits into from
Feb 13, 2025

Conversation

lima-limon-inc
Copy link
Contributor

@lima-limon-inc lima-limon-inc commented Feb 11, 2025

Motivation

Incorporate the costs for extcodecopy and sload from eip 150.

Description
Add fork checks in the gas_cost functions in:

  • Extcodecopy
  • Sload
  • Selfdestruct

Closes #1909

@lima-limon-inc lima-limon-inc added ef-tests Hive tests, execution-spec-tests levm Lambda EVM implementation labels Feb 11, 2025
@lima-limon-inc lima-limon-inc self-assigned this Feb 11, 2025
@lima-limon-inc lima-limon-inc requested a review from a team as a code owner February 11, 2025 18:06
Copy link

github-actions bot commented Feb 11, 2025

| File                                                           | Lines | Diff |
+----------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/vm/levm/src/gas_cost.rs | 1100  | +36  |
+----------------------------------------------------------------+-------+------+

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

Copy link

github-actions bot commented Feb 11, 2025

Benchmark Results Comparison

PR Results

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
revm_Factorial 238.3 ± 1.0 237.6 241.1 1.00
levm_Factorial 915.1 ± 9.5 901.2 931.3 3.84 ± 0.04

Benchmark Results: Factorial - Recursive

Command Mean [s] Min [s] Max [s] Relative
revm_FactorialRecursive 1.483 ± 0.108 1.354 1.615 1.00
levm_FactorialRecursive 15.741 ± 0.041 15.703 15.824 10.61 ± 0.78

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
revm_Fibonacci 210.5 ± 0.5 209.9 211.7 1.00
levm_Fibonacci 903.8 ± 12.4 890.7 926.8 4.29 ± 0.06

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ManyHashes 8.7 ± 0.1 8.5 9.0 1.00
levm_ManyHashes 18.2 ± 0.1 18.0 18.3 2.09 ± 0.03

Benchmark Results: BubbleSort

Command Mean [s] Min [s] Max [s] Relative
revm_BubbleSort 3.260 ± 0.022 3.232 3.303 1.00
levm_BubbleSort 6.123 ± 0.041 6.071 6.192 1.88 ± 0.02

Benchmark Results: ERC20 - Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ERC20Transfer 249.9 ± 2.0 247.9 254.7 1.00
levm_ERC20Transfer 542.1 ± 2.7 539.2 547.3 2.17 ± 0.02

Benchmark Results: ERC20 - Mint

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ERC20Mint 142.1 ± 1.3 141.0 145.3 1.00
levm_ERC20Mint 355.0 ± 2.3 352.3 359.1 2.50 ± 0.03

Benchmark Results: ERC20 - Approval

Command Mean [s] Min [s] Max [s] Relative
revm_ERC20Approval 1.050 ± 0.008 1.041 1.064 1.00
levm_ERC20Approval 2.033 ± 0.009 2.017 2.043 1.94 ± 0.02

Main Results

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
revm_Factorial 237.8 ± 2.1 232.3 239.4 1.00
levm_Factorial 914.3 ± 9.7 899.2 931.6 3.84 ± 0.05

Benchmark Results: Factorial - Recursive

Command Mean [s] Min [s] Max [s] Relative
revm_FactorialRecursive 1.477 ± 0.093 1.357 1.573 1.00
levm_FactorialRecursive 15.675 ± 0.026 15.631 15.718 10.61 ± 0.67

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
revm_Fibonacci 212.7 ± 1.4 211.5 215.3 1.00
levm_Fibonacci 898.3 ± 7.9 890.5 913.1 4.22 ± 0.05

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ManyHashes 8.8 ± 0.2 8.7 9.3 1.00
levm_ManyHashes 18.3 ± 0.2 18.1 18.6 2.08 ± 0.05

Benchmark Results: BubbleSort

Command Mean [s] Min [s] Max [s] Relative
revm_BubbleSort 3.268 ± 0.015 3.248 3.292 1.00
levm_BubbleSort 6.153 ± 0.131 6.068 6.508 1.88 ± 0.04

Benchmark Results: ERC20 - Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ERC20Transfer 252.4 ± 3.7 249.8 261.7 1.00
levm_ERC20Transfer 544.3 ± 8.4 538.3 567.3 2.16 ± 0.05

Benchmark Results: ERC20 - Mint

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ERC20Mint 143.2 ± 0.8 142.6 145.4 1.00
levm_ERC20Mint 355.2 ± 5.7 350.1 370.5 2.48 ± 0.04

Benchmark Results: ERC20 - Approval

Command Mean [s] Min [s] Max [s] Relative
revm_ERC20Approval 1.057 ± 0.013 1.044 1.085 1.00
levm_ERC20Approval 2.029 ± 0.011 2.011 2.048 1.92 ± 0.03

Copy link

github-actions bot commented Feb 11, 2025

Summary: 13831/16775 (82.45%)
Prague: 2373/2373 (100.00%)
Cancun: 3579/3579 (100.00%)
Shanghai: 221/221 (100.00%)
Paris: 62/62 (100.00%)
London: 39/39 (100.00%)
Berlin: 2/35 (5.71%)
Istanbul: 34/35 (97.14%)
Constantinople: 1645/2406 (68.37%)
Petersburg: 2121/2400 (88.38%)
Byzantium: 2034/2330 (87.30%)
Homestead: 694/1324 (52.42%)
Frontier: 176/742 (23.72%)
SpuriousDragon: 451/579 (77.89%)
Tangerine: 400/650 (61.54%)

@lima-limon-inc lima-limon-inc marked this pull request as draft February 11, 2025 21:05
Copy link

github-actions bot commented Feb 11, 2025

EF Tests Comparison

Test Name MAIN PR DIFF
Summary: 14807/16775 (88.27%) 14946/16775 (89.10%) ⬆️ 139
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: 34/35 (97.14%) 34/35 (97.14%) ➖️
Constantinople: 1780/2406 (73.98%) 1780/2406 (73.98%) ➖️
Petersburg: 2345/2400 (97.71%) 2345/2400 (97.71%) ➖️
Byzantium: 2244/2330 (96.31%) 2244/2330 (96.31%) ➖️
Homestead: 868/1324 (65.56%) 954/1324 (72.05%) ⬆️ 86
Frontier: 335/742 (45.15%) 388/742 (52.29%) ⬆️ 53
SpuriousDragon: 484/579 (83.59%) 484/579 (83.59%) ➖️
Tangerine: 408/650 (62.77%) 408/650 (62.77%) ➖️

@lima-limon-inc lima-limon-inc marked this pull request as ready for review February 11, 2025 21:47
@lambdaclass lambdaclass deleted a comment from github-actions bot Feb 12, 2025
@lambdaclass lambdaclass deleted a comment from github-actions bot Feb 12, 2025
@fkrause98 fkrause98 added this pull request to the merge queue Feb 13, 2025
@lima-limon-inc lima-limon-inc removed this pull request from the merge queue due to a manual request Feb 13, 2025
@lima-limon-inc lima-limon-inc marked this pull request as draft February 13, 2025 19:08
@lima-limon-inc lima-limon-inc marked this pull request as ready for review February 13, 2025 19:22
@lima-limon-inc lima-limon-inc marked this pull request as draft February 13, 2025 19:46
@lima-limon-inc lima-limon-inc marked this pull request as ready for review February 13, 2025 20:16
@fborello-lambda fborello-lambda added this pull request to the merge queue Feb 13, 2025
Merged via the queue into main with commit 67b394a Feb 13, 2025
27 checks passed
@fborello-lambda fborello-lambda deleted the levm/fix/eip_150 branch February 13, 2025 21:41
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.

Fix Eip150's extcodecopy, sload and selfdestruct
4 participants