Skip to content

Commit c1adf82

Browse files
authored
fix(l2): disable system calls for prover & proposer in L2 mode (#2227)
**Motivation** Currently ethrex-prover fails to prove blocks created from the proposer because both the proposer and the prover are executing system calls that are exclusive for L1 mode.
1 parent c0983e0 commit c1adf82

File tree

8 files changed

+16
-8
lines changed

8 files changed

+16
-8
lines changed

cmd/ethrex/Cargo.toml

+7-2
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,17 @@ path = "./lib.rs"
4747
[features]
4848
default = ["libmdbx", "c-kzg", "blst"]
4949
dev = ["dep:ethrex-dev"]
50-
c-kzg = ["ethrex-vm/c-kzg", "ethrex-common/c-kzg", "ethrex-blockchain/c-kzg", "ethrex-p2p/c-kzg"]
50+
c-kzg = [
51+
"ethrex-vm/c-kzg",
52+
"ethrex-common/c-kzg",
53+
"ethrex-blockchain/c-kzg",
54+
"ethrex-p2p/c-kzg",
55+
]
5156
metrics = ["ethrex-blockchain/metrics"]
5257
libmdbx = ["ethrex-storage/libmdbx"]
5358
redb = ["dep:redb", "ethrex-storage/redb"]
5459
blst = ["ethrex-vm/blst"]
55-
l2 = ["dep:ethrex-l2", "ethrex-vm/l2"]
60+
l2 = ["dep:ethrex-l2", "ethrex-vm/l2", "ethrex-blockchain/l2"]
5661
based = ["l2", "ethrex-rpc/based"]
5762

5863

crates/blockchain/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@ path = "./blockchain.rs"
3030

3131
[features]
3232
default = []
33+
l2 = []
3334
c-kzg = ["ethrex-common/c-kzg", "ethrex-vm/c-kzg"]
3435
metrics = ["ethrex-metrics/transactions"]

crates/blockchain/payload.rs

+1
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ impl Blockchain {
262262
debug!("Building payload");
263263
let mut context = PayloadBuildContext::new(payload, self.evm_engine, &self.storage)?;
264264

265+
#[cfg(not(feature = "l2"))]
265266
self.apply_system_operations(&mut context)?;
266267
self.apply_withdrawals(&mut context)?;
267268
self.fill_transactions(&mut context)?;

crates/l2/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ ethereum-types.workspace = true
1616
ethrex-common.workspace = true
1717
ethrex-rlp.workspace = true
1818
ethrex-rpc.workspace = true
19-
ethrex-blockchain.workspace = true
19+
ethrex-blockchain = { workspace = true, features = ["l2"] }
2020
ethrex-storage.workspace = true
21-
ethrex-vm.workspace = true
21+
ethrex-vm = { workspace = true, features = ["l2"] }
2222
ethrex-dev = { path = "../../crates/blockchain/dev", default-features = false }
2323
hex.workspace = true
2424
bytes.workspace = true
@@ -30,7 +30,7 @@ thiserror.workspace = true
3030
directories = "5.0.1"
3131
toml = { version = "0.8.19", features = ["parse"] }
3232

33-
zkvm_interface = { path = "./prover/zkvm/interface/", default-features = false }
33+
zkvm_interface = { path = "./prover/zkvm/interface/", features = ["l2"] }
3434

3535
# risc0
3636
risc0-zkvm = { version = "1.2.2" }

crates/l2/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ init-prover: ## 🚀 Initializes the Prover
157157
else \
158158
GPU=",gpu"; \
159159
fi; \
160-
cargo run --release --features "build_$$T$$GPU" --manifest-path ./prover/Cargo.toml --bin ethrex_prover -- $$T
160+
cargo run --release --features "build_$$T$$GPU,l2" --manifest-path ./prover/Cargo.toml --bin ethrex_prover -- $$T
161161

162162
rm-db-l2: ## 🛑 Removes the DB used by the L2
163163
cargo run --release --manifest-path ../../Cargo.toml --bin ethrex -- removedb --datadir ${ethrex_L2_DEV_LIBMDBX}

crates/l2/prover/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ build_sp1 = ["zkvm_interface/build_sp1"]
5151
l2 = [
5252
"ethrex-vm/l2",
5353
"zkvm_interface/l2",
54+
"ethrex-blockchain/l2",
5455
] # the prover can work with both l1 or l2 blocks
5556
gpu = ["risc0-zkvm/cuda", "sp1-sdk/cuda"]
5657

crates/l2/prover/zkvm/interface/risc0/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ secp256k1 = { git = "https://github.com/sp1-patches/rust-secp256k1", branch = "p
2222
ecdsa-core = { git = "https://github.com/sp1-patches/signatures", package = "ecdsa", branch = "patch-ecdsa-v0.16.9" }
2323

2424
[features]
25-
l2 = ["ethrex-vm/l2", "zkvm_interface/l2"]
25+
l2 = ["ethrex-vm/l2", "zkvm_interface/l2", "ethrex-blockchain/l2"]

crates/l2/prover/zkvm/interface/sp1/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ ecdsa-core = { git = "https://github.com/sp1-patches/signatures", package = "ecd
2323
tiny-keccak = { git = "https://github.com/sp1-patches/tiny-keccak", tag = "patch-2.0.2-sp1-4.0.0" }
2424

2525
[features]
26-
l2 = ["ethrex-vm/l2", "zkvm_interface/l2"]
26+
l2 = ["ethrex-vm/l2", "zkvm_interface/l2", "ethrex-blockchain/l2"]

0 commit comments

Comments
 (0)