Skip to content

refactor(l2): refactor privileged transactions #3365

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

Merged
merged 24 commits into from
Jul 2, 2025

Conversation

iovoid
Copy link
Contributor

@iovoid iovoid commented Jun 27, 2025

Motivation

We want to unify the terminology used to refer to sending privileged transactions to the L2, since they are not just deposits.

Also, the DepositInitiated (now PrivilegedTxSent) event must be cleaned up: l2MintTxHash is irrelevant since it can be recomputed, and it doesn't make sense to index amount but not from.

Some clean up (for example, removing recipient) was already done in #3320.

Description

  • Removes the l2 transaction from the deposit event
  • Adds indexed to from and removes it from address
  • Renames deposit to 'privileged transactions' where more appropriate

Closes #3233

@iovoid iovoid changed the title refactor(l2): refactor(l2): refactor privileged transactions Jun 27, 2025
Copy link

github-actions bot commented Jun 27, 2025

Lines of code report

Total lines added: 89
Total lines removed: 5
Total lines changed: 94

Detailed view
+---------------------------------------------------------+-------+------+
| File                                                    | Lines | Diff |
+---------------------------------------------------------+-------+------+
| ethrex/crates/l2/based/block_fetcher.rs                 | 498   | +3   |
+---------------------------------------------------------+-------+------+
| ethrex/crates/l2/common/src/privileged_transactions.rs  | 58    | +58  |
+---------------------------------------------------------+-------+------+
| ethrex/crates/l2/prover/zkvm/interface/src/execution.rs | 345   | +8   |
+---------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/l1_committer.rs              | 558   | +3   |
+---------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/l1_watcher.rs                | 350   | -5   |
+---------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/metrics.rs                   | 149   | +3   |
+---------------------------------------------------------+-------+------+
| ethrex/crates/l2/storage/src/store.rs                   | 353   | +6   |
+---------------------------------------------------------+-------+------+
| ethrex/crates/l2/storage/src/store_db/redb.rs           | 391   | +4   |
+---------------------------------------------------------+-------+------+
| ethrex/crates/l2/storage/src/store_db/sql.rs            | 584   | +4   |
+---------------------------------------------------------+-------+------+

Copy link

github-actions bot commented Jun 27, 2025

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.179 ± 0.045 3.154 3.305 1.00
main_levm_BubbleSort 4.464 ± 0.014 4.445 4.483 1.40 ± 0.02
pr_revm_BubbleSort 3.200 ± 0.006 3.192 3.214 1.01 ± 0.01
pr_levm_BubbleSort 4.531 ± 0.020 4.514 4.580 1.43 ± 0.02

Benchmark Results: ERC20Approval

Command Mean [s] Min [s] Max [s] Relative
main_revm_ERC20Approval 1.040 ± 0.009 1.028 1.053 1.00 ± 0.01
main_levm_ERC20Approval 1.541 ± 0.011 1.526 1.559 1.49 ± 0.01
pr_revm_ERC20Approval 1.037 ± 0.008 1.026 1.052 1.00
pr_levm_ERC20Approval 1.585 ± 0.004 1.578 1.592 1.53 ± 0.01

Benchmark Results: ERC20Mint

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Mint 136.4 ± 0.8 135.7 138.2 1.00 ± 0.03
main_levm_ERC20Mint 257.5 ± 2.5 255.3 264.0 1.89 ± 0.05
pr_revm_ERC20Mint 136.3 ± 3.6 134.2 145.7 1.00
pr_levm_ERC20Mint 267.8 ± 1.5 266.6 271.9 1.96 ± 0.05

Benchmark Results: ERC20Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Transfer 240.1 ± 1.6 237.9 242.6 1.00 ± 0.01
main_levm_ERC20Transfer 407.3 ± 4.2 403.2 417.5 1.70 ± 0.02
pr_revm_ERC20Transfer 239.8 ± 1.7 238.0 243.1 1.00
pr_levm_ERC20Transfer 415.9 ± 1.7 413.2 417.8 1.73 ± 0.01

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Factorial 234.0 ± 12.2 227.8 268.5 1.01 ± 0.05
main_levm_Factorial 438.6 ± 2.7 435.8 444.2 1.89 ± 0.02
pr_revm_Factorial 231.6 ± 1.5 229.5 235.4 1.00
pr_levm_Factorial 481.2 ± 26.8 467.8 557.2 2.08 ± 0.12

Benchmark Results: FactorialRecursive

Command Mean [s] Min [s] Max [s] Relative
main_revm_FactorialRecursive 1.590 ± 0.018 1.569 1.613 1.02 ± 0.02
main_levm_FactorialRecursive 2.738 ± 0.039 2.673 2.791 1.75 ± 0.04
pr_revm_FactorialRecursive 1.566 ± 0.027 1.516 1.594 1.00
pr_levm_FactorialRecursive 2.770 ± 0.017 2.745 2.799 1.77 ± 0.03

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Fibonacci 207.7 ± 2.8 206.2 215.5 1.00
main_levm_Fibonacci 453.9 ± 54.2 432.4 607.4 2.18 ± 0.26
pr_revm_Fibonacci 208.8 ± 3.3 206.7 216.0 1.01 ± 0.02
pr_levm_Fibonacci 470.1 ± 4.1 465.0 477.3 2.26 ± 0.04

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ManyHashes 8.6 ± 0.1 8.5 8.7 1.00
main_levm_ManyHashes 13.4 ± 0.1 13.3 13.7 1.56 ± 0.02
pr_revm_ManyHashes 8.7 ± 0.1 8.6 8.8 1.01 ± 0.01
pr_levm_ManyHashes 13.4 ± 0.1 13.2 13.6 1.56 ± 0.02

Copy link

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.176 ± 0.012 3.155 3.195 1.00
main_levm_BubbleSort 4.533 ± 0.101 4.472 4.803 1.43 ± 0.03
pr_revm_BubbleSort 3.210 ± 0.022 3.188 3.248 1.01 ± 0.01
pr_levm_BubbleSort 4.539 ± 0.012 4.522 4.565 1.43 ± 0.01

Benchmark Results: ERC20Approval

Command Mean [s] Min [s] Max [s] Relative
main_revm_ERC20Approval 1.035 ± 0.008 1.023 1.048 1.00
main_levm_ERC20Approval 1.575 ± 0.003 1.571 1.582 1.52 ± 0.01
pr_revm_ERC20Approval 1.074 ± 0.011 1.065 1.101 1.04 ± 0.01
pr_levm_ERC20Approval 1.602 ± 0.006 1.595 1.613 1.55 ± 0.01

Benchmark Results: ERC20Mint

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Mint 134.7 ± 0.5 134.1 135.6 1.00
main_levm_ERC20Mint 263.9 ± 3.6 261.1 273.9 1.96 ± 0.03
pr_revm_ERC20Mint 138.8 ± 1.0 136.3 140.4 1.03 ± 0.01
pr_levm_ERC20Mint 268.5 ± 2.3 266.5 273.6 1.99 ± 0.02

Benchmark Results: ERC20Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Transfer 240.1 ± 2.6 237.9 245.8 1.00
main_levm_ERC20Transfer 412.3 ± 1.6 411.0 415.4 1.72 ± 0.02
pr_revm_ERC20Transfer 249.3 ± 1.6 247.5 253.2 1.04 ± 0.01
pr_levm_ERC20Transfer 419.8 ± 1.3 417.5 422.0 1.75 ± 0.02

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Factorial 231.4 ± 2.6 229.2 236.7 1.01 ± 0.01
main_levm_Factorial 442.7 ± 4.0 437.5 452.1 1.92 ± 0.02
pr_revm_Factorial 230.2 ± 0.6 229.2 231.0 1.00
pr_levm_Factorial 481.4 ± 10.4 472.6 501.5 2.09 ± 0.05

Benchmark Results: FactorialRecursive

Command Mean [s] Min [s] Max [s] Relative
main_revm_FactorialRecursive 1.602 ± 0.035 1.529 1.645 1.03 ± 0.03
main_levm_FactorialRecursive 2.698 ± 0.015 2.685 2.726 1.74 ± 0.05
pr_revm_FactorialRecursive 1.552 ± 0.039 1.468 1.617 1.00
pr_levm_FactorialRecursive 2.808 ± 0.032 2.767 2.874 1.81 ± 0.05

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Fibonacci 207.5 ± 0.7 207.0 209.3 1.00
main_levm_Fibonacci 448.8 ± 54.8 429.4 604.5 2.16 ± 0.26
pr_revm_Fibonacci 207.7 ± 0.6 206.9 209.1 1.00 ± 0.00
pr_levm_Fibonacci 471.6 ± 2.9 469.4 478.9 2.27 ± 0.02

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ManyHashes 8.6 ± 0.1 8.6 8.9 1.00
main_levm_ManyHashes 13.5 ± 0.1 13.3 13.6 1.56 ± 0.02
pr_revm_ManyHashes 8.7 ± 0.1 8.6 9.0 1.01 ± 0.02
pr_levm_ManyHashes 13.4 ± 0.1 13.3 13.5 1.55 ± 0.02

@iovoid iovoid marked this pull request as ready for review June 27, 2025 20:24
@iovoid iovoid requested review from jrchatruc, ManuelBilbao and a team as code owners June 27, 2025 20:24
Copy link

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.189 ± 0.039 3.152 3.291 1.00
main_levm_BubbleSort 4.454 ± 0.010 4.440 4.473 1.40 ± 0.02
pr_revm_BubbleSort 3.196 ± 0.014 3.181 3.225 1.00 ± 0.01
pr_levm_BubbleSort 4.559 ± 0.042 4.525 4.658 1.43 ± 0.02

Benchmark Results: ERC20Approval

Command Mean [s] Min [s] Max [s] Relative
main_revm_ERC20Approval 1.071 ± 0.007 1.063 1.087 1.03 ± 0.01
main_levm_ERC20Approval 1.546 ± 0.009 1.534 1.565 1.49 ± 0.01
pr_revm_ERC20Approval 1.039 ± 0.008 1.031 1.058 1.00
pr_levm_ERC20Approval 1.609 ± 0.011 1.599 1.628 1.55 ± 0.02

Benchmark Results: ERC20Mint

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Mint 139.5 ± 0.9 138.4 140.7 1.03 ± 0.01
main_levm_ERC20Mint 259.2 ± 4.0 255.1 265.6 1.92 ± 0.03
pr_revm_ERC20Mint 135.1 ± 0.6 134.3 136.4 1.00
pr_levm_ERC20Mint 271.3 ± 6.3 267.0 288.6 2.01 ± 0.05

Benchmark Results: ERC20Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Transfer 247.4 ± 2.9 245.5 253.3 1.03 ± 0.01
main_levm_ERC20Transfer 403.1 ± 0.8 401.7 404.1 1.67 ± 0.01
pr_revm_ERC20Transfer 240.8 ± 1.5 239.5 244.6 1.00
pr_levm_ERC20Transfer 418.5 ± 2.1 416.2 422.8 1.74 ± 0.01

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Factorial 230.3 ± 1.5 227.4 232.1 1.00
main_levm_Factorial 439.5 ± 5.1 435.8 453.1 1.91 ± 0.03
pr_revm_Factorial 231.1 ± 0.8 230.2 232.8 1.00 ± 0.01
pr_levm_Factorial 475.5 ± 4.8 469.2 486.0 2.06 ± 0.02

Benchmark Results: FactorialRecursive

Command Mean [s] Min [s] Max [s] Relative
main_revm_FactorialRecursive 1.574 ± 0.016 1.555 1.597 1.01 ± 0.02
main_levm_FactorialRecursive 2.661 ± 0.013 2.644 2.687 1.71 ± 0.03
pr_revm_FactorialRecursive 1.555 ± 0.024 1.519 1.595 1.00
pr_levm_FactorialRecursive 2.832 ± 0.041 2.780 2.932 1.82 ± 0.04

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Fibonacci 206.8 ± 1.5 202.9 208.5 1.00
main_levm_Fibonacci 431.4 ± 3.5 425.9 437.3 2.09 ± 0.02
pr_revm_Fibonacci 207.1 ± 1.3 203.9 209.2 1.00 ± 0.01
pr_levm_Fibonacci 475.9 ± 5.3 469.7 488.6 2.30 ± 0.03

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ManyHashes 8.7 ± 0.1 8.6 8.9 1.00
main_levm_ManyHashes 13.2 ± 0.1 13.1 13.6 1.53 ± 0.02
pr_revm_ManyHashes 8.7 ± 0.1 8.6 8.8 1.00 ± 0.01
pr_levm_ManyHashes 13.6 ± 0.2 13.4 14.0 1.57 ± 0.02

Copy link

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.249 ± 0.048 3.203 3.344 1.01 ± 0.02
main_levm_BubbleSort 4.395 ± 0.014 4.370 4.410 1.37 ± 0.01
pr_revm_BubbleSort 3.214 ± 0.019 3.194 3.263 1.00
pr_levm_BubbleSort 4.392 ± 0.039 4.350 4.491 1.37 ± 0.01

Benchmark Results: ERC20Approval

Command Mean [s] Min [s] Max [s] Relative
main_revm_ERC20Approval 1.040 ± 0.008 1.032 1.058 1.00 ± 0.01
main_levm_ERC20Approval 1.521 ± 0.020 1.503 1.567 1.47 ± 0.02
pr_revm_ERC20Approval 1.037 ± 0.010 1.026 1.052 1.00
pr_levm_ERC20Approval 1.543 ± 0.008 1.529 1.557 1.49 ± 0.02

Benchmark Results: ERC20Mint

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Mint 139.1 ± 0.5 138.5 140.0 1.00 ± 0.02
main_levm_ERC20Mint 257.7 ± 4.9 254.4 268.1 1.86 ± 0.05
pr_revm_ERC20Mint 138.6 ± 2.3 137.0 144.7 1.00
pr_levm_ERC20Mint 259.4 ± 4.2 256.0 270.6 1.87 ± 0.04

Benchmark Results: ERC20Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Transfer 243.5 ± 1.9 242.1 248.0 1.01 ± 0.01
main_levm_ERC20Transfer 396.5 ± 1.6 394.9 399.9 1.64 ± 0.02
pr_revm_ERC20Transfer 242.3 ± 2.6 239.3 247.1 1.00
pr_levm_ERC20Transfer 405.1 ± 2.8 402.0 411.7 1.67 ± 0.02

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Factorial 239.9 ± 3.1 238.4 248.7 1.02 ± 0.01
main_levm_Factorial 452.2 ± 18.3 444.3 503.9 1.91 ± 0.08
pr_revm_Factorial 236.3 ± 1.1 234.5 238.1 1.00
pr_levm_Factorial 436.8 ± 1.5 434.7 440.0 1.85 ± 0.01

Benchmark Results: FactorialRecursive

Command Mean [s] Min [s] Max [s] Relative
main_revm_FactorialRecursive 1.625 ± 0.028 1.567 1.663 1.01 ± 0.02
main_levm_FactorialRecursive 2.780 ± 0.019 2.756 2.818 1.73 ± 0.03
pr_revm_FactorialRecursive 1.611 ± 0.029 1.579 1.658 1.00
pr_levm_FactorialRecursive 2.726 ± 0.033 2.689 2.774 1.69 ± 0.04

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Fibonacci 210.0 ± 1.0 208.5 212.3 1.00 ± 0.01
main_levm_Fibonacci 437.8 ± 4.1 433.9 445.9 2.08 ± 0.02
pr_revm_Fibonacci 210.0 ± 1.3 208.2 212.7 1.00
pr_levm_Fibonacci 433.0 ± 13.4 426.6 471.0 2.06 ± 0.07

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ManyHashes 8.8 ± 0.1 8.7 8.9 1.00 ± 0.01
main_levm_ManyHashes 13.3 ± 0.2 13.1 13.6 1.52 ± 0.02
pr_revm_ManyHashes 8.8 ± 0.1 8.7 8.9 1.00
pr_levm_ManyHashes 13.3 ± 0.2 12.9 13.5 1.52 ± 0.03

Benchmark Results: Push

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Push 290.1 ± 0.7 288.9 291.4 1.00
main_levm_Push 1046.2 ± 2.3 1042.6 1050.0 3.61 ± 0.01
pr_revm_Push 290.7 ± 1.4 289.5 293.3 1.00 ± 0.01
pr_levm_Push 1038.4 ± 2.8 1035.0 1043.2 3.58 ± 0.01

@iovoid iovoid force-pushed the refactor/simplify-privileged branch from 8c2f401 to f7e6cae Compare June 30, 2025 20:53
Copy link
Contributor

@tomip01 tomip01 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! Just two comments

@MegaRedHand MegaRedHand enabled auto-merge July 2, 2025 14:29
@iovoid iovoid self-assigned this Jul 2, 2025
@iovoid iovoid added this to ethrex_l2 Jul 2, 2025
@MegaRedHand MegaRedHand added the L2 Rollup client label Jul 2, 2025
@MegaRedHand MegaRedHand moved this to In Review in ethrex_l2 Jul 2, 2025
Comment on lines -107 to 113
function getPendingDepositLogs() public view returns (bytes32[] memory) {
return pendingDepositLogs;
function getPendingTransactionHashes()
public
view
returns (bytes32[] memory)
{
return pendingTxHashes;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd fully remove this function and use pendingTxHashes()(bytes32[]) instead

Copy link
Contributor Author

@iovoid iovoid Jul 2, 2025

Choose a reason for hiding this comment

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

Removed in 6ed285b

@MegaRedHand MegaRedHand added this pull request to the merge queue Jul 2, 2025
Merged via the queue into main with commit eee2e9d Jul 2, 2025
35 checks passed
@github-project-automation github-project-automation bot moved this from In Review to Done in ethrex_l2 Jul 2, 2025
@MegaRedHand MegaRedHand deleted the refactor/simplify-privileged branch July 2, 2025 20:09
Copy link
Contributor

@mationorato mationorato left a comment

Choose a reason for hiding this comment

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

This is just a small modification to enhance the user experience for end users.

event L1ToL2Message(
uint256 indexed amount,
event PrivilegedTxSent (
address indexed from,
Copy link
Contributor

Choose a reason for hiding this comment

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

I discussed this with @ilitteri and @jrchatruc, and we agreed that we should add an address indexed L1From (the name can be adjusted) so that wallets can track their own privileged transactions for UX purposes.

We also agreed that this should be the only indexed parameter, unless someone can provide a strong reason to keep from, to, or id indexed.

L1From should be set to msg.sender when emitted.

github-merge-queue bot pushed a commit that referenced this pull request Jul 4, 2025
**Description**

This PR updates our native bridge documentation with the latest changes,
including those from #3365
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L2 Rollup client
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Simplify privileged transaction
8 participants