Skip to content

refactor(core): remove l2 feature from cmd/ethrex achieving a single binary for both L1 and L2 #3381

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

Open
wants to merge 51 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
b8b3e3e
Add `ethrex-l2-rpc` crate
ilitteri Jun 26, 2025
c851fba
Remove feature l2 from rpc crate
ilitteri Jun 26, 2025
9920eaf
Move `init_rollup_store` to `l2::initializers`
ilitteri Jun 26, 2025
2aab6db
Remove last piece of l2 code from rpc crate
ilitteri Jun 26, 2025
0faf575
Add a TODO
ilitteri Jun 26, 2025
721479a
Reject blob transactions in l2
ilitteri Jun 26, 2025
aa40204
Clean dead code
ilitteri Jun 26, 2025
56fd63e
Add clippy allow
ilitteri Jun 26, 2025
6feefca
Fix lint
ilitteri Jun 26, 2025
87ccd57
Fix lint
ilitteri Jun 26, 2025
6637c1c
Remove type aliases
ilitteri Jun 26, 2025
26d3bf7
Use namespace instead of import aliasing
ilitteri Jun 26, 2025
4d14da5
Refactor
ilitteri Jun 26, 2025
cb573d2
Replace allow with expect for clippy lint
ilitteri Jun 26, 2025
1c87759
Remove unused imports
ilitteri Jun 26, 2025
28843a6
Move l2 precompiles logic to new module
ilitteri Jun 26, 2025
39a509f
Remove feature flag from hooks public API
ilitteri Jun 26, 2025
3023b88
Use the correct functions
ilitteri Jun 26, 2025
88bc9a2
Replace get_hooks
ilitteri Jun 26, 2025
8b09883
Remove `l2` feature flag from `levm`
ilitteri Jun 27, 2025
fd971be
Remove `l2` feature flag from `vm` crate
ilitteri Jun 27, 2025
32557eb
Implement `BlockchainType` and fix compilation
ilitteri Jun 27, 2025
137ca29
Merge branch 'main' of github.com:lambdaclass/ethrex into remove_l2_f…
ilitteri Jun 27, 2025
1fe36d4
Fix l2 command
ilitteri Jun 27, 2025
cda4244
Remove last occurrences of `ethrex-vm/l2` import
ilitteri Jun 27, 2025
0860942
Fix `p_256_verify_test`
ilitteri Jun 27, 2025
1c7f2a5
Update crates/vm/backends/revm/mod.rs
ilitteri Jun 27, 2025
68d0524
Fix stateless execution
ilitteri Jun 27, 2025
93efc4a
Update crates/vm/levm/bench/revm_comparison/src/levm_bench.rs
ilitteri Jun 27, 2025
7841613
Fix stateless execution
ilitteri Jun 27, 2025
70651a6
Merge branch 'remove_l2_feature_flag_from_levm' of github.com:lambdac…
ilitteri Jun 27, 2025
ecc43d8
Decouple L2 metrics from L1 metrics
ilitteri Jun 27, 2025
3607923
Remove `l2` feature flag from `ethrex-blockchain`
ilitteri Jun 27, 2025
db68fb2
Fix lint
ilitteri Jun 27, 2025
fc24bb8
Remove unused function
ilitteri Jun 27, 2025
5b4e65a
Halt when non L2 LEVM functions are called in L2
ilitteri Jun 27, 2025
0736eae
Merge branch 'remove_l2_feature_flag_from_levm' of github.com:lambdac…
ilitteri Jun 27, 2025
cb0f2a9
Remove feature flag l2 from metrics
ilitteri Jun 27, 2025
059d48b
Restore condition
ilitteri Jun 27, 2025
cae395b
Revert
ilitteri Jun 27, 2025
884a966
Revert change
ilitteri Jun 27, 2025
618eb2a
Remove l2 feature flag from cmd/ethrex, achieving a single binary for…
ilitteri Jun 27, 2025
3943c13
Merge branch 'main' of github.com:lambdaclass/ethrex into remove_l2_f…
ilitteri Jun 30, 2025
5b7cb79
Fix merge
ilitteri Jun 30, 2025
d837126
Merge branch 'remove_l2_feature_flag_from_levm' of github.com:lambdac…
ilitteri Jun 30, 2025
2bc3534
Merge branch 'remove_l2_feature_flag_from_blockchain' of github.com:l…
ilitteri Jun 30, 2025
74ab4b2
Merge branch 'main' of github.com:lambdaclass/ethrex into remove_l2_f…
ilitteri Jul 2, 2025
fea8617
Merge branch 'main' of github.com:lambdaclass/ethrex into remove_l2_f…
ilitteri Jul 3, 2025
d241bd6
Remove l2 feature from docker
ilitteri Jul 3, 2025
2642aa2
Update help
ilitteri Jul 3, 2025
c5e88c2
Remove l2 feature from makefile
ilitteri Jul 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions cmd/ethrex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ ethrex-p2p.workspace = true
ethrex-storage.workspace = true
ethrex-vm.workspace = true
ethrex-rlp.workspace = true
ethrex-storage-rollup = { workspace = true, optional = true }
ethrex-l2 = { workspace = true, optional = true }
ethrex-l2-common = { workspace = true, optional = true }
ethrex-sdk = { workspace = true, optional = true }
ethrex-l2-rpc = { workspace = true, optional = true }
ethrex-storage-rollup.workspace = true
ethrex-l2.workspace = true
ethrex-l2-common.workspace = true
ethrex-sdk.workspace = true
ethrex-l2-rpc.workspace = true

bytes.workspace = true
hex.workspace = true
Expand Down Expand Up @@ -66,17 +66,10 @@ c-kzg = [
"ethrex-blockchain/c-kzg",
"ethrex-p2p/c-kzg",
]
metrics = ["ethrex-blockchain/metrics", "ethrex-l2?/metrics"]
libmdbx = ["ethrex-storage/libmdbx", "ethrex-storage-rollup?/libmdbx"]
metrics = ["ethrex-blockchain/metrics", "ethrex-l2/metrics"]
libmdbx = ["ethrex-storage/libmdbx", "ethrex-storage-rollup/libmdbx"]
redb = ["dep:redb", "ethrex-storage/redb"]
blst = ["ethrex-vm/blst"]
l2 = [
"dep:ethrex-l2",
"dep:ethrex-l2-common",
"dep:ethrex-sdk",
"dep:ethrex-l2-rpc",
"ethrex-storage-rollup",
]
rollup_storage_libmdbx = ["ethrex-storage-rollup/libmdbx"]
rollup_storage_redb = ["ethrex-storage-rollup/redb"]
rollup_storage_sql = ["ethrex-storage-rollup/sql"]
Expand Down
8 changes: 2 additions & 6 deletions cmd/ethrex/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ use tracing::{Level, info, warn};
use crate::{
DEFAULT_DATADIR,
initializers::{init_blockchain, init_store, open_store},
l2,
networks::{Network, PublicNetwork},
utils::{self, get_client_version, set_datadir},
};

#[cfg(feature = "l2")]
use crate::l2;

#[allow(clippy::upper_case_acronyms)]
#[derive(ClapParser)]
#[command(name="ethrex", author = "Lambdaclass", version=get_client_version(), about = "ethrex Execution client")]
Expand Down Expand Up @@ -159,7 +157,7 @@ pub struct Options {
help_heading = "RPC options"
)]
pub authrpc_jwtsecret: String,
#[arg(long = "p2p.enabled", default_value = if cfg!(feature = "l2") { "false" } else { "true" }, value_name = "P2P_ENABLED", action = ArgAction::SetTrue, help_heading = "P2P options")]
#[arg(long = "p2p.enabled", default_value = "true", value_name = "P2P_ENABLED", action = ArgAction::SetTrue, help_heading = "P2P options")]
pub p2p_enabled: bool,
#[arg(
long = "p2p.addr",
Expand Down Expand Up @@ -281,7 +279,6 @@ pub enum Subcommand {
)]
genesis_path: PathBuf,
},
#[cfg(feature = "l2")]
#[command(subcommand)]
L2(l2::Command),
}
Expand Down Expand Up @@ -322,7 +319,6 @@ impl Subcommand {
let state_root = genesis.compute_state_root();
println!("{state_root:#x}");
}
#[cfg(feature = "l2")]
Subcommand::L2(command) => command.run().await?,
}
Ok(())
Expand Down
6 changes: 5 additions & 1 deletion cmd/ethrex/l2/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,11 @@ impl Command {
l2::initializers::init_metrics(&opts.node_opts, tracker.clone());
}

if opts.node_opts.p2p_enabled {
// TODO: This should be handled differently, the current problem
// with using opts.node_opts.p2p_enabled is that with the removal
// of the l2 feature flag, p2p_enabled is set to true by default
// prioritizing the L1 UX.
if opts.sequencer_opts.based {
init_network(
&opts.node_opts,
&network,
Expand Down
7 changes: 2 additions & 5 deletions cmd/ethrex/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
pub mod initializers;
pub mod utils;

pub mod cli;

#[cfg(feature = "l2")]
pub mod initializers;
pub mod l2;
pub mod utils;

mod decode;
pub mod networks;
Expand Down
2 changes: 0 additions & 2 deletions cmd/ethrex/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use ethrex_p2p::{
use ethrex_rlp::decode::RLPDecode;
use ethrex_vm::EvmEngine;
use hex::FromHexError;
#[cfg(feature = "l2")]
use secp256k1::SecretKey;
use serde::{Deserialize, Serialize};
use std::{
Expand Down Expand Up @@ -139,7 +138,6 @@ pub fn read_node_config_file(file_path: PathBuf) -> Result<NodeConfigFile, Strin
}
}

#[cfg(feature = "l2")]
pub fn parse_private_key(s: &str) -> eyre::Result<SecretKey> {
Ok(SecretKey::from_slice(&parse_hex(s)?)?)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/l2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ COPY --from=planner /ethrex/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json

COPY . .
RUN cargo build --release --features "l2,rollup_storage_libmdbx"
RUN cargo build --release --features "rollup_storage_libmdbx"

FROM ubuntu:24.04
ENV CI_ETHREX_WORKDIR=$CI_ETHREX_WORKDIR
Expand Down
4 changes: 2 additions & 2 deletions crates/l2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ DEFAULT_ON_CHAIN_PROPOSER_ADDRESS=$$(grep ETHREX_COMMITTER_ON_CHAIN_PROPOSER_ADD
init-l2-no-metrics: ## 🚀 Initializes an L2 Lambda ethrex Client
export $(shell cat .env | xargs); \
ETHREX_PROOF_COORDINATOR_DEV_MODE=${ETHREX_PROOF_COORDINATOR_DEV_MODE} \
cargo run --release --manifest-path ../../Cargo.toml --bin ethrex --features "l2,rollup_storage_sql,metrics" -- \
cargo run --release --manifest-path ../../Cargo.toml --bin ethrex --features "rollup_storage_sql,metrics" -- \
l2 init \
--watcher.block-delay 0 \
--network ${L2_GENESIS_FILE_PATH} \
Expand Down Expand Up @@ -230,7 +230,7 @@ integration-test-gpu: rm-db-l2 rm-db-l1
# State reconstruction tests
state-diff-test:
touch .env
cargo run --release --manifest-path ../../cmd/ethrex/Cargo.toml --features l2 --bin ethrex -- \
cargo run --release --manifest-path ../../cmd/ethrex/Cargo.toml --bin ethrex -- \
l2 reconstruct \
-g ../../fixtures/genesis/l2.json \
-b ../../fixtures/blobs/ \
Expand Down
1 change: 0 additions & 1 deletion crates/l2/tee/quote-gen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ secp256k1 = { version = "0.29.1", default-features = false, features = [
[build-dependencies]
vergen-git2 = { version = "1.0.7" }


[workspace]

[features]
Expand Down
7 changes: 4 additions & 3 deletions docs/l1/dev-setup-l1.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ make localnet-assertoor-blob

Those are two different set of assertoor checks the details are as follows:

*assertoor-tx*
_assertoor-tx_

- [eoa-transaction-test](https://raw.githubusercontent.com/ethpandaops/assertoor/refs/heads/master/playbooks/stable/eoa-transactions-test.yaml)

*assertoor-blob*
_assertoor-blob_

- [blob-transaction-test](https://raw.githubusercontent.com/ethpandaops/assertoor/refs/heads/master/playbooks/stable/blob-transactions-test.yaml)
- *Custom* [el-stability-check](https://raw.githubusercontent.com/lambdaclass/ethrex/refs/heads/main/.github/config/assertoor/el-stability-check.yaml)
- _Custom_ [el-stability-check](https://raw.githubusercontent.com/lambdaclass/ethrex/refs/heads/main/.github/config/assertoor/el-stability-check.yaml)

For reference on each individual check see the [assertoor-wiki](https://github.com/ethpandaops/assertoor/wiki#supported-tasks-in-assertoor)

Expand Down Expand Up @@ -158,6 +158,7 @@ Commands:
import Import blocks to the database
export Export blocks in the current chain into a file in rlp encoding
compute-state-root Compute the state root from a genesis file
l2
help Print this message or the help of the given subcommand(s)

Options:
Expand Down
Loading