Skip to content

Conversation

tomip01
Copy link
Contributor

@tomip01 tomip01 commented Sep 23, 2025

Motivation

Running docker compose up was broken running on crates/l2. The problem is that the ethrex l2 container reads the .env at the moment of running the docker compose up and miss the updates on the file that writes the deployer.

Description

  • Deployer now creates the empty .env in the shared volume that the ethrex_l2 container will read
  • Add a parsing and exporting the env vars in the ethrex_l2 container as a previous step to running the sequencer.
  • Add a copy step on CI jobs to retrieve the addresses used in the deployment since they are no longer on the host machine
  • Change base image of the Dockerfile to use a Debian as we need to use common unix binaries

How to Test

cd crates/l2
docker compose up

@github-actions github-actions bot added the L2 Rollup client label Sep 23, 2025
Copy link

Lines of code report

Total lines added: 37
Total lines removed: 152
Total lines changed: 189

Detailed view
+------------------------------------------------------------------------+-------+------+
| File                                                                   | Lines | Diff |
+------------------------------------------------------------------------+-------+------+
| ethrex/cmd/ethrex_replay/src/cache.rs                                  | 124   | -5   |
+------------------------------------------------------------------------+-------+------+
| ethrex/cmd/ethrex_replay/src/cli.rs                                    | 924   | -1   |
+------------------------------------------------------------------------+-------+------+
| ethrex/cmd/ethrex_replay/src/fetcher.rs                                | 241   | +2   |
+------------------------------------------------------------------------+-------+------+
| ethrex/cmd/ethrex_replay/src/lib.rs                                    | 9     | -1   |
+------------------------------------------------------------------------+-------+------+
| ethrex/cmd/ethrex_replay/src/run.rs                                    | 179   | +5   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/common/config/networks.rs                                | 168   | -10  |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/l1_proof_sender.rs                          | 395   | -8   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/l1_proof_verifier.rs                        | 282   | -8   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/discv4/server.rs                          | 516   | -14  |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/network.rs                                | 364   | -2   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/rlpx/connection/server.rs                 | 860   | -8   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/rlpx/l2/l2_connection.rs                  | 423   | -5   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/sync.rs                                   | 1215  | -1   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/sync/storage_healing.rs                   | 580   | +1   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/types.rs                                  | 485   | -23  |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/call_frame.rs                                | 323   | -27  |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/errors.rs                                    | 229   | -1   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/opcode_handlers/arithmetic.rs                | 215   | +3   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/opcode_handlers/block.rs                     | 123   | +6   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/opcode_handlers/environment.rs               | 302   | +2   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/opcode_handlers/push.rs                      | 45    | +3   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/opcode_handlers/stack_memory_storage_flow.rs | 262   | +10  |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/opcode_handlers/system.rs                    | 799   | +1   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/opcodes.rs                                   | 503   | -29  |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/precompiles.rs                               | 1478  | +4   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/vm.rs                                        | 450   | -9   |
+------------------------------------------------------------------------+-------+------+

@tomip01 tomip01 force-pushed the fix_l2_docker_compose branch from f242924 to cb60fa6 Compare September 24, 2025 19:39
Copy link

Benchmark for f1d1a5d

Click to view benchmark
Test Base PR %
Trie/cita-trie insert 10k 35.6±1.02ms 35.0±0.43ms -1.69%
Trie/cita-trie insert 1k 3.6±0.08ms 3.8±0.24ms +5.56%
Trie/ethrex-trie insert 10k 55.5±1.61ms 55.0±0.97ms -0.90%
Trie/ethrex-trie insert 1k 6.2±0.03ms 6.2±0.04ms 0.00%

Copy link

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.774 ± 0.045 4.724 4.863 1.04 ± 0.01
main_levm_BubbleSort 4.609 ± 0.023 4.589 4.669 1.00
pr_revm_BubbleSort 4.742 ± 0.041 4.710 4.821 1.03 ± 0.01
pr_levm_BubbleSort 4.743 ± 0.015 4.724 4.768 1.03 ± 0.01

Benchmark Results: ERC20Approval

Command Mean [s] Min [s] Max [s] Relative
main_revm_ERC20Approval 1.544 ± 0.008 1.535 1.555 1.00
main_levm_ERC20Approval 1.659 ± 0.054 1.627 1.809 1.07 ± 0.04
pr_revm_ERC20Approval 1.549 ± 0.009 1.536 1.567 1.00 ± 0.01
pr_levm_ERC20Approval 1.635 ± 0.004 1.628 1.643 1.06 ± 0.01

Benchmark Results: ERC20Mint

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Mint 184.9 ± 2.8 182.1 189.0 1.00 ± 0.02
main_levm_ERC20Mint 194.9 ± 0.5 194.3 195.9 1.06 ± 0.02
pr_revm_ERC20Mint 184.7 ± 2.6 182.7 189.6 1.00
pr_levm_ERC20Mint 196.4 ± 2.9 193.7 201.3 1.06 ± 0.02

Benchmark Results: ERC20Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Transfer 354.6 ± 1.9 351.6 357.7 1.00
main_levm_ERC20Transfer 381.8 ± 1.4 378.4 383.2 1.08 ± 0.01
pr_revm_ERC20Transfer 356.7 ± 3.1 353.0 363.0 1.01 ± 0.01
pr_levm_ERC20Transfer 381.9 ± 2.1 380.4 387.5 1.08 ± 0.01

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Factorial 233.9 ± 0.6 233.0 234.7 1.00 ± 0.01
main_levm_Factorial 299.0 ± 18.5 292.3 351.6 1.28 ± 0.08
pr_revm_Factorial 232.8 ± 1.2 231.8 235.5 1.00
pr_levm_Factorial 293.2 ± 1.6 291.6 296.1 1.26 ± 0.01

Benchmark Results: FactorialRecursive

Command Mean [s] Min [s] Max [s] Relative
main_revm_FactorialRecursive 1.606 ± 0.034 1.562 1.680 1.03 ± 0.06
main_levm_FactorialRecursive 8.089 ± 0.082 7.932 8.190 5.18 ± 0.29
pr_revm_FactorialRecursive 1.560 ± 0.087 1.343 1.627 1.00
pr_levm_FactorialRecursive 8.162 ± 0.069 8.048 8.299 5.23 ± 0.30

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Fibonacci 210.2 ± 0.8 208.9 211.4 1.00 ± 0.01
main_levm_Fibonacci 284.5 ± 3.2 281.4 291.6 1.36 ± 0.02
pr_revm_Fibonacci 209.5 ± 0.7 208.9 211.3 1.00
pr_levm_Fibonacci 281.2 ± 1.6 277.3 283.0 1.34 ± 0.01

Benchmark Results: FibonacciRecursive

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_FibonacciRecursive 861.1 ± 5.4 852.2 868.9 1.01 ± 0.02
main_levm_FibonacciRecursive 1102.1 ± 4.1 1095.9 1109.4 1.30 ± 0.02
pr_revm_FibonacciRecursive 850.4 ± 11.6 836.1 866.8 1.00
pr_levm_FibonacciRecursive 1079.6 ± 6.1 1071.4 1091.7 1.27 ± 0.02

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ManyHashes 12.5 ± 0.1 12.4 12.8 1.00 ± 0.02
main_levm_ManyHashes 13.9 ± 0.1 13.7 14.1 1.12 ± 0.02
pr_revm_ManyHashes 12.5 ± 0.2 12.3 13.1 1.00
pr_levm_ManyHashes 14.1 ± 0.1 13.9 14.2 1.13 ± 0.02

Benchmark Results: MstoreBench

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_MstoreBench 263.9 ± 3.6 261.2 271.8 1.00 ± 0.02
main_levm_MstoreBench 801.7 ± 1.5 800.1 805.0 3.05 ± 0.05
pr_revm_MstoreBench 262.8 ± 3.9 258.7 268.6 1.00
pr_levm_MstoreBench 808.1 ± 17.2 800.4 857.0 3.07 ± 0.08

Benchmark Results: Push

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Push 292.7 ± 1.6 291.3 296.8 1.00
main_levm_Push 920.1 ± 10.3 913.0 947.9 3.14 ± 0.04
pr_revm_Push 294.1 ± 8.3 290.0 317.3 1.00 ± 0.03
pr_levm_Push 914.7 ± 1.4 912.4 916.7 3.12 ± 0.02

Benchmark Results: SstoreBench_no_opt

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_SstoreBench_no_opt 226.5 ± 6.2 218.8 235.0 2.72 ± 0.08
main_levm_SstoreBench_no_opt 83.6 ± 0.8 82.5 84.9 1.00 ± 0.02
pr_revm_SstoreBench_no_opt 224.1 ± 5.7 218.4 231.6 2.69 ± 0.08
pr_levm_SstoreBench_no_opt 83.4 ± 1.0 82.1 85.2 1.00

FROM debian:12-slim
WORKDIR /usr/local/bin

RUN apt-get update && apt-get install -y --no-install-recommends libssl3
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is because we need ssl that it is not included on the base image

@tomip01 tomip01 marked this pull request as ready for review September 25, 2025 14:55
@tomip01 tomip01 requested a review from a team as a code owner September 25, 2025 14:55
Copy link
Contributor

@ManuelBilbao ManuelBilbao 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 some small comments

entrypoint:
- /bin/bash
- -c
- touch /env/.env; exec ./ethrex "$0" "$@"
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 put "l2 deploy" as part of the entrypoint, as the contract deployer is always suposed to run it. This way, you can run:

docker compose run contract_deployer <custom_deployer_options>

instead of

docker compose run contract_deployer l2 deploy <custom_deployer_options>

Also, the exec is not needed.

    entrypoint:
      - /bin/bash
      - -c
      - touch /env/.env; exec ./ethrex "$0" "$@"
    command: >
      --randomize-contract-deployment

Copy link
Contributor Author

@tomip01 tomip01 Sep 25, 2025

Choose a reason for hiding this comment

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

Done e9ec17b

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the "$@" is still needed. By default the command is just one argument, but the user may want to add more

entrypoint:
- /bin/bash
- -c
- export $$(xargs < /env/.env); exec ./ethrex "$$0" "$$@"
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here about l2 subcommand and exec. Also, it's weird the double $ here but not in the previous command

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remove the extra $ here 6921165

Copy link
Contributor Author

@tomip01 tomip01 Sep 25, 2025

Choose a reason for hiding this comment

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

Done the remaining here e9ec17b

@tomip01 tomip01 force-pushed the fix_l2_docker_compose branch from 60bfc00 to 6921165 Compare September 25, 2025 21:10
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