Skip to content

Conversation

cdiielsi
Copy link
Contributor

@cdiielsi cdiielsi commented Aug 27, 2025

Motivation

Implement EIP-7823 for Osaka fork.

Description

This pr implements the bound introduced in EIP-7823 for Osaka. Since it's a backwards incompatible change it also includes the fork as a parameter for precompile's execution.
This pr was tested with this other pr.

Closes #4153

@github-actions github-actions bot added the L1 Ethereum client label Aug 27, 2025
Copy link

github-actions bot commented Aug 27, 2025

Lines of code report

Total lines added: 51
Total lines removed: 0
Total lines changed: 51

Detailed view
+-----------------------------------------------------+-------+------+
| File                                                | Lines | Diff |
+-----------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/l2_precompiles.rs         | 102   | +1   |
+-----------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/opcode_handlers/system.rs | 799   | +1   |
+-----------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/precompiles.rs            | 1127  | +47  |
+-----------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/vm.rs                     | 263   | +2   |
+-----------------------------------------------------+-------+------+

@cdiielsi cdiielsi changed the title chore(l1): throw error on input size larger than upper bound for modexp chore(l1): [EIP-7823] Set upper bounds for MODEXP Aug 27, 2025
Copy link

github-actions bot commented Aug 27, 2025

Benchmark Results Comparison

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.161 ± 0.009 3.145 3.176 1.00
main_levm_BubbleSort 3.486 ± 0.019 3.465 3.531 1.10 ± 0.01
pr_revm_BubbleSort 3.185 ± 0.019 3.144 3.207 1.01 ± 0.01
pr_levm_BubbleSort 3.554 ± 0.060 3.518 3.720 1.12 ± 0.02

Benchmark Results: ERC20Approval

Command Mean [s] Min [s] Max [s] Relative
main_revm_ERC20Approval 1.037 ± 0.005 1.032 1.049 1.00
main_levm_ERC20Approval 1.217 ± 0.009 1.198 1.230 1.17 ± 0.01
pr_revm_ERC20Approval 1.053 ± 0.010 1.043 1.072 1.02 ± 0.01
pr_levm_ERC20Approval 1.226 ± 0.018 1.210 1.271 1.18 ± 0.02

Benchmark Results: ERC20Mint

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Mint 137.1 ± 1.9 136.0 142.5 1.00
main_levm_ERC20Mint 169.0 ± 5.1 166.4 183.4 1.23 ± 0.04
pr_revm_ERC20Mint 138.1 ± 0.6 137.2 139.2 1.01 ± 0.01
pr_levm_ERC20Mint 165.2 ± 0.8 164.0 166.1 1.20 ± 0.02

Benchmark Results: ERC20Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Transfer 241.6 ± 2.3 237.6 246.1 1.00
main_levm_ERC20Transfer 298.6 ± 2.0 296.0 301.2 1.24 ± 0.01
pr_revm_ERC20Transfer 242.4 ± 1.9 240.6 247.0 1.00 ± 0.01
pr_levm_ERC20Transfer 302.2 ± 15.0 295.5 344.5 1.25 ± 0.06

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Factorial 231.6 ± 0.6 230.6 232.3 1.00
main_levm_Factorial 307.9 ± 1.4 306.1 309.8 1.33 ± 0.01
pr_revm_Factorial 233.7 ± 0.5 232.9 235.0 1.01 ± 0.00
pr_levm_Factorial 306.8 ± 1.0 305.9 309.1 1.32 ± 0.01

Benchmark Results: FactorialRecursive

Command Mean [s] Min [s] Max [s] Relative
main_revm_FactorialRecursive 1.637 ± 0.022 1.612 1.677 1.00 ± 0.02
main_levm_FactorialRecursive 9.099 ± 0.146 8.889 9.289 5.58 ± 0.13
pr_revm_FactorialRecursive 1.630 ± 0.029 1.577 1.670 1.00
pr_levm_FactorialRecursive 9.184 ± 0.175 8.940 9.468 5.63 ± 0.15

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Fibonacci 203.2 ± 1.5 202.0 207.2 1.00
main_levm_Fibonacci 297.4 ± 4.5 287.6 301.8 1.46 ± 0.02
pr_revm_Fibonacci 204.2 ± 0.8 203.1 206.0 1.01 ± 0.01
pr_levm_Fibonacci 298.1 ± 4.9 288.6 307.7 1.47 ± 0.03

Benchmark Results: FibonacciRecursive

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_FibonacciRecursive 860.0 ± 12.7 842.1 885.2 1.00 ± 0.02
main_levm_FibonacciRecursive 1069.9 ± 7.3 1057.6 1082.3 1.25 ± 0.02
pr_revm_FibonacciRecursive 857.7 ± 10.7 842.1 872.2 1.00
pr_levm_FibonacciRecursive 1045.6 ± 6.5 1037.0 1055.2 1.22 ± 0.02

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ManyHashes 9.2 ± 0.1 9.0 9.4 1.03 ± 0.02
main_levm_ManyHashes 11.1 ± 0.1 10.9 11.3 1.24 ± 0.02
pr_revm_ManyHashes 9.0 ± 0.1 8.9 9.1 1.00
pr_levm_ManyHashes 11.2 ± 0.9 10.8 13.8 1.25 ± 0.10

Benchmark Results: MstoreBench

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_MstoreBench 265.9 ± 2.1 263.9 270.8 1.00
main_levm_MstoreBench 772.8 ± 0.9 770.9 773.9 2.91 ± 0.02
pr_revm_MstoreBench 266.3 ± 3.1 264.4 274.6 1.00 ± 0.01
pr_levm_MstoreBench 777.8 ± 2.1 774.3 780.8 2.93 ± 0.02

Benchmark Results: Push

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Push 290.0 ± 1.7 288.6 294.0 1.00 ± 0.01
main_levm_Push 877.6 ± 3.6 874.2 885.1 3.03 ± 0.02
pr_revm_Push 289.9 ± 1.2 288.1 291.6 1.00
pr_levm_Push 881.5 ± 9.4 873.7 903.8 3.04 ± 0.03

Benchmark Results: SstoreBench_no_opt

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_SstoreBench_no_opt 158.5 ± 0.8 157.0 159.4 1.98 ± 0.03
main_levm_SstoreBench_no_opt 80.0 ± 1.1 78.7 82.1 1.00
pr_revm_SstoreBench_no_opt 157.9 ± 0.8 156.9 158.9 1.98 ± 0.03
pr_levm_SstoreBench_no_opt 80.3 ± 1.1 78.6 82.4 1.00 ± 0.02

@edg-l edg-l self-requested a review August 28, 2025 09:52
@edg-l
Copy link
Contributor

edg-l commented Aug 28, 2025

Before merging this i would like to review it when it's in a ready state, since I recently optimized the modexp and there is another pr like #4168

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L1 Ethereum client
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

[EIP-7823] Set upper bounds for MODEXP
2 participants