Skip to content

Conversation

@tomip01
Copy link
Contributor

@tomip01 tomip01 commented Oct 30, 2025

Motivation

Currently we were doing a one to one conversion from ETH to an ERC20. Now we define an contract interface that the operator can implement and get the ratio of the token to ETH.

Description

  • Added new FeeTokenPricer contract (FeeTokenPricer.sol) and its interface (IFeeTokenPricer.sol), allowing an operator to set and get the ratio of fee tokens to ETH for fee payments.
  • Integrated the deployment of FeeTokenPricer into the L2 build and genesis process, including initialization of test fee token ratios and wiring up the contract's bytecode.
  • Introduced a new get_fee_token_ratio function in the SDK to query the ratio from the FeeTokenPricer contract.
  • Updated test to use the new fee token ratio when asserting fee-related balances.
  • Updated the LEVM backend and environment to support fetching and storing the fee token ratio per transaction.
  • Modified fee accounting logic in the L2 VM hooks to multiply all fee-related calculations by the fee token ratio.

@tomip01 tomip01 changed the base branch from main to fee_token_3 October 30, 2025 20:37
@github-actions
Copy link

github-actions bot commented Oct 30, 2025

Lines of code report

Total lines added: 108
Total lines removed: 0
Total lines changed: 108

Detailed view
+--------------------------------------------------------+-------+------+
| File                                                   | Lines | Diff |
+--------------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/build_l2.rs                          | 426   | +14  |
+--------------------------------------------------------+-------+------+
| ethrex/crates/l2/sdk/src/sdk.rs                        | 961   | +23  |
+--------------------------------------------------------+-------+------+
| ethrex/crates/vm/backends/levm/mod.rs                  | 655   | +41  |
+--------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/environment.rs               | 95    | +1   |
+--------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/hooks/l2_hook.rs             | 537   | +27  |
+--------------------------------------------------------+-------+------+
| ethrex/tooling/ef_tests/state/runner/levm_runner.rs    | 442   | +1   |
+--------------------------------------------------------+-------+------+
| ethrex/tooling/ef_tests/state_v2/src/modules/runner.rs | 208   | +1   |
+--------------------------------------------------------+-------+------+

@github-actions
Copy link

github-actions bot commented Oct 31, 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 4.736 ± 0.009 4.722 4.754 1.03 ± 0.01
main_levm_BubbleSort 4.594 ± 0.033 4.566 4.682 1.00
pr_revm_BubbleSort 4.776 ± 0.101 4.728 5.061 1.04 ± 0.02
pr_levm_BubbleSort 4.608 ± 0.016 4.570 4.638 1.00 ± 0.01

Benchmark Results: ERC20Approval

Command Mean [s] Min [s] Max [s] Relative
main_revm_ERC20Approval 1.553 ± 0.014 1.537 1.576 1.01 ± 0.01
main_levm_ERC20Approval 1.679 ± 0.014 1.654 1.697 1.09 ± 0.01
pr_revm_ERC20Approval 1.539 ± 0.010 1.529 1.559 1.00
pr_levm_ERC20Approval 1.669 ± 0.009 1.658 1.689 1.08 ± 0.01

Benchmark Results: ERC20Mint

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Mint 186.4 ± 0.5 185.4 186.9 1.00 ± 0.01
main_levm_ERC20Mint 206.4 ± 5.2 202.9 220.2 1.11 ± 0.03
pr_revm_ERC20Mint 186.1 ± 1.4 185.3 189.8 1.00
pr_levm_ERC20Mint 205.2 ± 1.6 203.4 208.4 1.10 ± 0.01

Benchmark Results: ERC20Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Transfer 352.7 ± 1.1 351.4 355.3 1.01 ± 0.01
main_levm_ERC20Transfer 393.1 ± 4.9 389.1 406.2 1.12 ± 0.01
pr_revm_ERC20Transfer 350.1 ± 1.6 349.0 354.6 1.00
pr_levm_ERC20Transfer 393.7 ± 1.9 389.9 396.2 1.12 ± 0.01

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Factorial 233.9 ± 1.0 231.3 234.9 1.00
main_levm_Factorial 283.8 ± 8.5 280.6 307.9 1.21 ± 0.04
pr_revm_Factorial 235.9 ± 3.5 233.3 245.3 1.01 ± 0.02
pr_levm_Factorial 281.1 ± 1.8 279.4 285.4 1.20 ± 0.01

Benchmark Results: FactorialRecursive

Command Mean [s] Min [s] Max [s] Relative
main_revm_FactorialRecursive 1.713 ± 0.048 1.645 1.781 1.01 ± 0.04
main_levm_FactorialRecursive 8.591 ± 0.032 8.552 8.648 5.08 ± 0.16
pr_revm_FactorialRecursive 1.692 ± 0.052 1.576 1.758 1.00
pr_levm_FactorialRecursive 8.562 ± 0.052 8.474 8.635 5.06 ± 0.16

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Fibonacci 211.4 ± 2.0 207.2 214.1 1.00
main_levm_Fibonacci 263.8 ± 1.8 259.9 266.4 1.25 ± 0.01
pr_revm_Fibonacci 211.6 ± 0.5 210.9 212.6 1.00 ± 0.01
pr_levm_Fibonacci 264.2 ± 3.9 257.4 269.4 1.25 ± 0.02

Benchmark Results: FibonacciRecursive

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_FibonacciRecursive 909.9 ± 11.7 898.0 934.1 1.17 ± 0.02
main_levm_FibonacciRecursive 778.0 ± 5.9 771.5 789.7 1.00
pr_revm_FibonacciRecursive 909.6 ± 6.6 898.4 920.1 1.17 ± 0.01
pr_levm_FibonacciRecursive 782.9 ± 6.0 773.8 792.3 1.01 ± 0.01

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ManyHashes 12.6 ± 0.1 12.6 12.8 1.00
main_levm_ManyHashes 14.0 ± 0.1 13.9 14.1 1.10 ± 0.01
pr_revm_ManyHashes 12.7 ± 0.1 12.6 12.9 1.01 ± 0.01
pr_levm_ManyHashes 14.0 ± 0.2 13.9 14.5 1.11 ± 0.02

Benchmark Results: MstoreBench

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_MstoreBench 270.6 ± 4.0 268.0 281.7 1.06 ± 0.02
main_levm_MstoreBench 255.5 ± 3.8 252.5 266.0 1.00 ± 0.02
pr_revm_MstoreBench 269.5 ± 2.1 267.8 274.5 1.06 ± 0.01
pr_levm_MstoreBench 254.4 ± 1.4 252.9 256.7 1.00

Benchmark Results: Push

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Push 296.7 ± 1.7 293.1 298.7 1.00 ± 0.01
main_levm_Push 307.8 ± 0.8 306.2 309.3 1.04 ± 0.00
pr_revm_Push 295.6 ± 1.1 293.7 297.0 1.00
pr_levm_Push 307.5 ± 1.4 304.9 310.3 1.04 ± 0.01

Benchmark Results: SstoreBench_no_opt

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_SstoreBench_no_opt 219.4 ± 0.7 218.8 220.9 2.58 ± 0.05
main_levm_SstoreBench_no_opt 85.0 ± 1.8 82.5 87.7 1.00
pr_revm_SstoreBench_no_opt 219.9 ± 1.5 218.5 223.0 2.59 ± 0.06
pr_levm_SstoreBench_no_opt 85.5 ± 1.6 83.3 87.8 1.01 ± 0.03

@tomip01 tomip01 changed the title Gas pricing multiplier feat(l2): add oracle for fee tokens transactions Oct 31, 2025
@github-actions github-actions bot added the L2 Rollup client label Oct 31, 2025
@tomip01 tomip01 marked this pull request as ready for review October 31, 2025 18:38
@tomip01 tomip01 requested review from a team, ManuelBilbao and jrchatruc as code owners October 31, 2025 18:38
@tomip01 tomip01 marked this pull request as draft October 31, 2025 18:38
@tomip01 tomip01 marked this pull request as ready for review October 31, 2025 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L2 Rollup client

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants