From 393cfd7013da60f92b256779a4e0bf5ceffd1968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20I=C3=B1aki=20Bilbao?= Date: Mon, 27 Oct 2025 15:54:13 -0300 Subject: [PATCH 1/5] Bump version to 6.0.0 --- Cargo.lock | 202 +++++++++--------- Cargo.toml | 2 +- .../src/guest_program/src/risc0/Cargo.lock | 22 +- .../src/guest_program/src/sp1/Cargo.lock | 22 +- 4 files changed, 124 insertions(+), 124 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 05916ae26d0..c28cf5b4b6b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -258,15 +258,15 @@ dependencies = [ [[package]] name = "archive_sync" -version = "5.0.0" +version = "6.0.0" dependencies = [ "clap 4.5.48", "clap_complete", "ethrex", - "ethrex-common 5.0.0", - "ethrex-rlp 5.0.0", + "ethrex-common 6.0.0", + "ethrex-rlp 6.0.0", "ethrex-rpc", - "ethrex-storage 5.0.0", + "ethrex-storage 6.0.0", "eyre", "hex", "lazy_static", @@ -2900,15 +2900,15 @@ dependencies = [ [[package]] name = "ef_tests-blockchain" -version = "5.0.0" +version = "6.0.0" dependencies = [ "bytes", "datatest-stable", "ethrex-blockchain", - "ethrex-common 5.0.0", + "ethrex-common 6.0.0", "ethrex-prover", - "ethrex-rlp 5.0.0", - "ethrex-storage 5.0.0", + "ethrex-rlp 6.0.0", + "ethrex-storage 6.0.0", "ethrex-vm", "guest_program", "hex", @@ -2921,7 +2921,7 @@ dependencies = [ [[package]] name = "ef_tests-statev2" -version = "5.0.0" +version = "6.0.0" dependencies = [ "alloy-rlp", "bytes", @@ -2930,11 +2930,11 @@ dependencies = [ "clap_complete", "colored", "ethrex-blockchain", - "ethrex-common 5.0.0", + "ethrex-common 6.0.0", "ethrex-l2-rpc", "ethrex-levm", - "ethrex-rlp 5.0.0", - "ethrex-storage 5.0.0", + "ethrex-rlp 6.0.0", + "ethrex-storage 6.0.0", "ethrex-vm", "hex", "prettytable-rs", @@ -3509,7 +3509,7 @@ dependencies = [ [[package]] name = "ethrex" -version = "5.0.0" +version = "6.0.0" dependencies = [ "anyhow", "bytes", @@ -3517,7 +3517,7 @@ dependencies = [ "clap_complete", "directories 5.0.1", "ethrex-blockchain", - "ethrex-common 5.0.0", + "ethrex-common 6.0.0", "ethrex-config", "ethrex-crypto", "ethrex-dev", @@ -3527,10 +3527,10 @@ dependencies = [ "ethrex-metrics", "ethrex-p2p", "ethrex-prover", - "ethrex-rlp 5.0.0", + "ethrex-rlp 6.0.0", "ethrex-rpc", "ethrex-sdk", - "ethrex-storage 5.0.0", + "ethrex-storage 6.0.0", "ethrex-storage-rollup", "ethrex-vm", "eyre", @@ -3557,16 +3557,16 @@ dependencies = [ [[package]] name = "ethrex-benches" -version = "5.0.0" +version = "6.0.0" dependencies = [ "bytes", "criterion", "ethrex", "ethrex-blockchain", - "ethrex-common 5.0.0", + "ethrex-common 6.0.0", "ethrex-config", "ethrex-l2-rpc", - "ethrex-storage 5.0.0", + "ethrex-storage 6.0.0", "secp256k1", "serde_json", "tempfile", @@ -3575,13 +3575,13 @@ dependencies = [ [[package]] name = "ethrex-blockchain" -version = "5.0.0" +version = "6.0.0" dependencies = [ "bytes", - "ethrex-common 5.0.0", + "ethrex-common 6.0.0", "ethrex-metrics", - "ethrex-rlp 5.0.0", - "ethrex-storage 5.0.0", + "ethrex-rlp 6.0.0", + "ethrex-storage 6.0.0", "ethrex-vm", "hex", "secp256k1", @@ -3622,14 +3622,14 @@ dependencies = [ [[package]] name = "ethrex-common" -version = "5.0.0" +version = "6.0.0" dependencies = [ "bytes", "crc32fast", "ethereum-types 0.15.1", "ethrex-crypto", - "ethrex-rlp 5.0.0", - "ethrex-trie 5.0.0", + "ethrex-rlp 6.0.0", + "ethrex-trie 6.0.0", "hex", "hex-literal", "kzg-rs", @@ -3651,9 +3651,9 @@ dependencies = [ [[package]] name = "ethrex-config" -version = "5.0.0" +version = "6.0.0" dependencies = [ - "ethrex-common 5.0.0", + "ethrex-common 6.0.0", "ethrex-p2p", "hex", "serde", @@ -3662,7 +3662,7 @@ dependencies = [ [[package]] name = "ethrex-crypto" -version = "5.0.0" +version = "6.0.0" dependencies = [ "c-kzg", "kzg-rs", @@ -3671,7 +3671,7 @@ dependencies = [ [[package]] name = "ethrex-dev" -version = "5.0.0" +version = "6.0.0" dependencies = [ "bytes", "envy", @@ -3690,7 +3690,7 @@ dependencies = [ [[package]] name = "ethrex-l2" -version = "5.0.0" +version = "6.0.0" dependencies = [ "aligned-sdk", "anyhow", @@ -3706,7 +3706,7 @@ dependencies = [ "ethereum-types 0.15.1", "ethers", "ethrex-blockchain", - "ethrex-common 5.0.0", + "ethrex-common 6.0.0", "ethrex-config", "ethrex-dev", "ethrex-l2-common", @@ -3714,12 +3714,12 @@ dependencies = [ "ethrex-levm", "ethrex-metrics", "ethrex-p2p", - "ethrex-rlp 5.0.0", + "ethrex-rlp 6.0.0", "ethrex-rpc", "ethrex-sdk", - "ethrex-storage 5.0.0", + "ethrex-storage 6.0.0", "ethrex-storage-rollup", - "ethrex-trie 5.0.0", + "ethrex-trie 6.0.0", "ethrex-vm", "futures", "guest_program", @@ -3748,14 +3748,14 @@ dependencies = [ [[package]] name = "ethrex-l2-common" -version = "5.0.0" +version = "6.0.0" dependencies = [ "bytes", "ethereum-types 0.15.1", - "ethrex-common 5.0.0", - "ethrex-rlp 5.0.0", - "ethrex-storage 5.0.0", - "ethrex-trie 5.0.0", + "ethrex-common 6.0.0", + "ethrex-rlp 6.0.0", + "ethrex-storage 6.0.0", + "ethrex-trie 6.0.0", "ethrex-vm", "lambdaworks-crypto 0.11.0", "rkyv", @@ -3768,18 +3768,18 @@ dependencies = [ [[package]] name = "ethrex-l2-rpc" -version = "5.0.0" +version = "6.0.0" dependencies = [ "axum 0.8.6", "bytes", "ethereum-types 0.15.1", "ethrex-blockchain", - "ethrex-common 5.0.0", + "ethrex-common 6.0.0", "ethrex-l2-common", "ethrex-p2p", - "ethrex-rlp 5.0.0", + "ethrex-rlp 6.0.0", "ethrex-rpc", - "ethrex-storage 5.0.0", + "ethrex-storage 6.0.0", "ethrex-storage-rollup", "hex", "reqwest 0.12.23", @@ -3797,7 +3797,7 @@ dependencies = [ [[package]] name = "ethrex-levm" -version = "5.0.0" +version = "6.0.0" dependencies = [ "ark-bn254", "ark-ec", @@ -3808,9 +3808,9 @@ dependencies = [ "colored", "datatest-stable", "derive_more 1.0.0", - "ethrex-common 5.0.0", + "ethrex-common 6.0.0", "ethrex-crypto", - "ethrex-rlp 5.0.0", + "ethrex-rlp 6.0.0", "hex", "k256 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", "lambdaworks-math 0.11.0", @@ -3832,10 +3832,10 @@ dependencies = [ [[package]] name = "ethrex-metrics" -version = "5.0.0" +version = "6.0.0" dependencies = [ "axum 0.8.6", - "ethrex-common 5.0.0", + "ethrex-common 6.0.0", "prometheus 0.13.4", "serde", "serde_json", @@ -3847,7 +3847,7 @@ dependencies = [ [[package]] name = "ethrex-p2p" -version = "5.0.0" +version = "6.0.0" dependencies = [ "aes", "async-trait", @@ -3857,12 +3857,12 @@ dependencies = [ "ctr", "ethereum-types 0.15.1", "ethrex-blockchain", - "ethrex-common 5.0.0", - "ethrex-rlp 5.0.0", - "ethrex-storage 5.0.0", + "ethrex-common 6.0.0", + "ethrex-rlp 6.0.0", + "ethrex-storage 6.0.0", "ethrex-storage-rollup", "ethrex-threadpool", - "ethrex-trie 5.0.0", + "ethrex-trie 6.0.0", "futures", "hex", "hex-literal", @@ -3890,7 +3890,7 @@ dependencies = [ [[package]] name = "ethrex-prover" -version = "5.0.0" +version = "6.0.0" dependencies = [ "anyhow", "bincode", @@ -3898,12 +3898,12 @@ dependencies = [ "clap 4.5.48", "ethereum-types 0.15.1", "ethrex-blockchain", - "ethrex-common 5.0.0", + "ethrex-common 6.0.0", "ethrex-l2", "ethrex-l2-common", - "ethrex-rlp 5.0.0", + "ethrex-rlp 6.0.0", "ethrex-sdk", - "ethrex-storage 5.0.0", + "ethrex-storage 6.0.0", "ethrex-vm", "guest_program", "hex", @@ -3940,7 +3940,7 @@ dependencies = [ [[package]] name = "ethrex-rlp" -version = "5.0.0" +version = "6.0.0" dependencies = [ "bytes", "ethereum-types 0.15.1", @@ -3954,7 +3954,7 @@ dependencies = [ [[package]] name = "ethrex-rpc" -version = "5.0.0" +version = "6.0.0" dependencies = [ "axum 0.8.6", "axum-extra", @@ -3962,13 +3962,13 @@ dependencies = [ "envy", "ethereum-types 0.15.1", "ethrex-blockchain", - "ethrex-common 5.0.0", + "ethrex-common 6.0.0", "ethrex-l2-common", "ethrex-p2p", - "ethrex-rlp 5.0.0", - "ethrex-storage 5.0.0", + "ethrex-rlp 6.0.0", + "ethrex-storage 6.0.0", "ethrex-storage-rollup", - "ethrex-trie 5.0.0", + "ethrex-trie 6.0.0", "ethrex-vm", "hex", "hex-literal", @@ -3992,14 +3992,14 @@ dependencies = [ [[package]] name = "ethrex-sdk" -version = "5.0.0" +version = "6.0.0" dependencies = [ "bytes", "ethereum-types 0.15.1", - "ethrex-common 5.0.0", + "ethrex-common 6.0.0", "ethrex-l2-common", "ethrex-l2-rpc", - "ethrex-rlp 5.0.0", + "ethrex-rlp 6.0.0", "ethrex-rpc", "ethrex-sdk-contract-utils", "eyre", @@ -4017,7 +4017,7 @@ dependencies = [ [[package]] name = "ethrex-sdk-contract-utils" -version = "5.0.0" +version = "6.0.0" dependencies = [ "thiserror 2.0.17", "tracing", @@ -4048,16 +4048,16 @@ dependencies = [ [[package]] name = "ethrex-storage" -version = "5.0.0" +version = "6.0.0" dependencies = [ "anyhow", "async-trait", "bincode", "bytes", "ethereum-types 0.15.1", - "ethrex-common 5.0.0", - "ethrex-rlp 5.0.0", - "ethrex-trie 5.0.0", + "ethrex-common 6.0.0", + "ethrex-rlp 6.0.0", + "ethrex-trie 6.0.0", "hex", "hex-literal", "rocksdb", @@ -4073,17 +4073,17 @@ dependencies = [ [[package]] name = "ethrex-storage-rollup" -version = "5.0.0" +version = "6.0.0" dependencies = [ "anyhow", "async-trait", "bincode", "ethereum-types 0.15.1", - "ethrex-common 5.0.0", + "ethrex-common 6.0.0", "ethrex-l2-common", - "ethrex-rlp 5.0.0", - "ethrex-storage 5.0.0", - "ethrex-trie 5.0.0", + "ethrex-rlp 6.0.0", + "ethrex-storage 6.0.0", + "ethrex-trie 6.0.0", "futures", "libsql", "rkyv", @@ -4122,7 +4122,7 @@ dependencies = [ [[package]] name = "ethrex-trie" -version = "5.0.0" +version = "6.0.0" dependencies = [ "anyhow", "bytes", @@ -4131,7 +4131,7 @@ dependencies = [ "crossbeam 0.8.4", "digest 0.10.7", "ethereum-types 0.15.1", - "ethrex-rlp 5.0.0", + "ethrex-rlp 6.0.0", "ethrex-threadpool", "hasher", "hex", @@ -4151,17 +4151,17 @@ dependencies = [ [[package]] name = "ethrex-vm" -version = "5.0.0" +version = "6.0.0" dependencies = [ "bincode", "bytes", "derive_more 1.0.0", "dyn-clone", "ethereum-types 0.15.1", - "ethrex-common 5.0.0", + "ethrex-common 6.0.0", "ethrex-levm", - "ethrex-rlp 5.0.0", - "ethrex-trie 5.0.0", + "ethrex-rlp 6.0.0", + "ethrex-trie 6.0.0", "hex", "lazy_static", "rkyv", @@ -4616,9 +4616,9 @@ dependencies = [ [[package]] name = "genesis-tool" -version = "5.0.0" +version = "6.0.0" dependencies = [ - "ethrex-common 5.0.0", + "ethrex-common 6.0.0", "serde_json", ] @@ -4790,16 +4790,16 @@ dependencies = [ [[package]] name = "guest_program" -version = "5.0.0" +version = "6.0.0" dependencies = [ "bytes", "ethrex-blockchain", - "ethrex-common 5.0.0", + "ethrex-common 6.0.0", "ethrex-crypto", "ethrex-l2-common", - "ethrex-rlp 5.0.0", - "ethrex-storage 5.0.0", - "ethrex-trie 5.0.0", + "ethrex-rlp 6.0.0", + "ethrex-storage 6.0.0", + "ethrex-trie 6.0.0", "ethrex-vm", "hex", "risc0-build", @@ -5056,7 +5056,7 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "hive_report" -version = "5.0.0" +version = "6.0.0" dependencies = [ "serde", "serde_json", @@ -6346,12 +6346,12 @@ checksum = "f5e54036fe321fd421e10d732f155734c4e4afd610dd556d9a82833ab3ee0bed" [[package]] name = "load_test" -version = "5.0.0" +version = "6.0.0" dependencies = [ "clap 4.5.48", "ethereum-types 0.15.1", "ethrex-blockchain", - "ethrex-common 5.0.0", + "ethrex-common 6.0.0", "ethrex-l2-common", "ethrex-l2-rpc", "ethrex-rpc", @@ -6365,7 +6365,7 @@ dependencies = [ [[package]] name = "loc" -version = "5.0.0" +version = "6.0.0" dependencies = [ "clap 4.5.48", "clap_complete", @@ -6689,14 +6689,14 @@ dependencies = [ [[package]] name = "migrations" -version = "5.0.0" +version = "6.0.0" dependencies = [ "clap 4.5.48", "ethrex-blockchain", "ethrex-common 1.0.0", - "ethrex-common 5.0.0", + "ethrex-common 6.0.0", "ethrex-storage 1.0.0", - "ethrex-storage 5.0.0", + "ethrex-storage 6.0.0", "tokio", ] @@ -8676,11 +8676,11 @@ dependencies = [ [[package]] name = "reorgs" -version = "5.0.0" +version = "6.0.0" dependencies = [ "ethrex", "ethrex-blockchain", - "ethrex-common 5.0.0", + "ethrex-common 6.0.0", "ethrex-config", "ethrex-l2-common", "ethrex-l2-rpc", @@ -9421,9 +9421,9 @@ dependencies = [ "clap 4.5.48", "env_logger 0.11.8", "ethrex-blockchain", - "ethrex-common 5.0.0", + "ethrex-common 6.0.0", "ethrex-levm", - "ethrex-storage 5.0.0", + "ethrex-storage 6.0.0", "ethrex-vm", "hex", "json5", diff --git a/Cargo.toml b/Cargo.toml index d86c3574955..d37bad46152 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,7 +40,7 @@ resolver = "2" default-members = ["cmd/ethrex"] [workspace.package] -version = "5.0.0" +version = "6.0.0" edition = "2024" authors = ["LambdaClass"] documentation = "https://docs.ethrex.xyz" diff --git a/crates/l2/prover/src/guest_program/src/risc0/Cargo.lock b/crates/l2/prover/src/guest_program/src/risc0/Cargo.lock index 8e8c96b1bb5..9ebf94c2cf1 100644 --- a/crates/l2/prover/src/guest_program/src/risc0/Cargo.lock +++ b/crates/l2/prover/src/guest_program/src/risc0/Cargo.lock @@ -1183,7 +1183,7 @@ dependencies = [ [[package]] name = "ethrex-blockchain" -version = "5.0.0" +version = "6.0.0" dependencies = [ "bytes", "ethrex-common", @@ -1201,7 +1201,7 @@ dependencies = [ [[package]] name = "ethrex-common" -version = "5.0.0" +version = "6.0.0" dependencies = [ "bytes", "crc32fast", @@ -1229,7 +1229,7 @@ dependencies = [ [[package]] name = "ethrex-crypto" -version = "5.0.0" +version = "6.0.0" dependencies = [ "c-kzg", "kzg-rs", @@ -1238,7 +1238,7 @@ dependencies = [ [[package]] name = "ethrex-l2-common" -version = "5.0.0" +version = "6.0.0" dependencies = [ "bytes", "ethereum-types", @@ -1258,7 +1258,7 @@ dependencies = [ [[package]] name = "ethrex-levm" -version = "5.0.0" +version = "6.0.0" dependencies = [ "ark-bn254", "ark-ec", @@ -1289,7 +1289,7 @@ dependencies = [ [[package]] name = "ethrex-metrics" -version = "5.0.0" +version = "6.0.0" dependencies = [ "ethrex-common", "serde", @@ -1300,7 +1300,7 @@ dependencies = [ [[package]] name = "ethrex-rlp" -version = "5.0.0" +version = "6.0.0" dependencies = [ "bytes", "ethereum-types", @@ -1313,7 +1313,7 @@ dependencies = [ [[package]] name = "ethrex-storage" -version = "5.0.0" +version = "6.0.0" dependencies = [ "anyhow", "async-trait", @@ -1341,7 +1341,7 @@ dependencies = [ [[package]] name = "ethrex-trie" -version = "5.0.0" +version = "6.0.0" dependencies = [ "anyhow", "bytes", @@ -1362,7 +1362,7 @@ dependencies = [ [[package]] name = "ethrex-vm" -version = "5.0.0" +version = "6.0.0" dependencies = [ "bincode", "bytes", @@ -1601,7 +1601,7 @@ dependencies = [ [[package]] name = "guest_program" -version = "5.0.0" +version = "6.0.0" dependencies = [ "bytes", "ethrex-blockchain", diff --git a/crates/l2/prover/src/guest_program/src/sp1/Cargo.lock b/crates/l2/prover/src/guest_program/src/sp1/Cargo.lock index cedd71882f5..17cf2ab4bcf 100644 --- a/crates/l2/prover/src/guest_program/src/sp1/Cargo.lock +++ b/crates/l2/prover/src/guest_program/src/sp1/Cargo.lock @@ -962,7 +962,7 @@ dependencies = [ [[package]] name = "ethrex-blockchain" -version = "5.0.0" +version = "6.0.0" dependencies = [ "bytes", "ethrex-common", @@ -980,7 +980,7 @@ dependencies = [ [[package]] name = "ethrex-common" -version = "5.0.0" +version = "6.0.0" dependencies = [ "bytes", "crc32fast", @@ -1008,7 +1008,7 @@ dependencies = [ [[package]] name = "ethrex-crypto" -version = "5.0.0" +version = "6.0.0" dependencies = [ "kzg-rs", "thiserror", @@ -1016,7 +1016,7 @@ dependencies = [ [[package]] name = "ethrex-l2-common" -version = "5.0.0" +version = "6.0.0" dependencies = [ "bytes", "ethereum-types", @@ -1036,7 +1036,7 @@ dependencies = [ [[package]] name = "ethrex-levm" -version = "5.0.0" +version = "6.0.0" dependencies = [ "ark-bn254", "ark-ec", @@ -1068,7 +1068,7 @@ dependencies = [ [[package]] name = "ethrex-metrics" -version = "5.0.0" +version = "6.0.0" dependencies = [ "ethrex-common", "serde", @@ -1079,7 +1079,7 @@ dependencies = [ [[package]] name = "ethrex-rlp" -version = "5.0.0" +version = "6.0.0" dependencies = [ "bytes", "ethereum-types", @@ -1092,7 +1092,7 @@ dependencies = [ [[package]] name = "ethrex-storage" -version = "5.0.0" +version = "6.0.0" dependencies = [ "anyhow", "async-trait", @@ -1120,7 +1120,7 @@ dependencies = [ [[package]] name = "ethrex-trie" -version = "5.0.0" +version = "6.0.0" dependencies = [ "anyhow", "bytes", @@ -1141,7 +1141,7 @@ dependencies = [ [[package]] name = "ethrex-vm" -version = "5.0.0" +version = "6.0.0" dependencies = [ "bincode", "bytes", @@ -1347,7 +1347,7 @@ dependencies = [ [[package]] name = "guest_program" -version = "5.0.0" +version = "6.0.0" dependencies = [ "bytes", "ethrex-blockchain", From 42b32e0d848acfd0e2dedfd65d4569d0136bda47 Mon Sep 17 00:00:00 2001 From: Ivan Litteri <67517699+ilitteri@users.noreply.github.com> Date: Wed, 29 Oct 2025 20:33:13 -0300 Subject: [PATCH 2/5] fix(l2): remove one-time checkpoint if already exists (#5083) **Motivation** In a previous PR, DB checkpoints were introduced to ensure old state availability in the current path-based fashion. Every time a batch is sealed, a checkpoint whose state is the state of the latest block of the sealed batch is created to be used in the next batch. The checkpoint is needed in two different steps of the batch commitment: for batch preparation (this is essentially building the batch) and for witness generation. Both steps need a non-modified checkpoint, but they both need to modify the checkpoint to be able to re-execute the batch. As batch preparation occurs before witness generation, we opted to create a one-time checkpoint out of the main checkpoint that can be modified during batch preparation if needed (sometimes the batch was already available in the DB, and there's no need to re-execute anything); then, witness generation modifies the original checkpoint as needed because it is no longer needed. Once the one-time checkpoint fulfills its purpose, it is removed. Currently, if batch preparation fails, the one-time checkpoint is not removed, and after retrying batch preparation, there's another attempt at creating the one-time checkpoint, which ends in an error because the directory already exists. We need to either avoid creating the one-time checkpoint again or to remove the existing one. **Description** Remove the existing one-time checkpoint if it already exists. --------- Co-authored-by: avilagaston9 Co-authored-by: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> --- crates/l2/sequencer/l1_committer.rs | 139 +++++++++++++--------------- 1 file changed, 64 insertions(+), 75 deletions(-) diff --git a/crates/l2/sequencer/l1_committer.rs b/crates/l2/sequencer/l1_committer.rs index dd3ae3b2648..f2de8823836 100644 --- a/crates/l2/sequencer/l1_committer.rs +++ b/crates/l2/sequencer/l1_committer.rs @@ -46,6 +46,7 @@ use ethrex_storage::EngineType; use ethrex_storage::Store; use ethrex_storage_rollup::StoreRollup; use ethrex_vm::{BlockExecutionResult, Evm}; +use rand::Rng; use serde::Serialize; use std::{ collections::{BTreeMap, HashMap}, @@ -270,16 +271,50 @@ impl L1Committer { )?; let first_block_to_commit = last_block + 1; + // We need to guarantee that the checkpoint path is new + // to avoid causing a lock error under rocksdb feature. + let rand_suffix: u32 = rand::thread_rng().r#gen(); + let one_time_checkpoint_path = self + .checkpoints_dir + .join(format!("temp_checkpoint_{batch_to_commit}_{rand_suffix}")); + + // For re-execution we need to use a checkpoint to the previous state + // (i.e. checkpoint of the state to the latest block from the previous + // batch, or the state of the genesis if this is the first batch). + // We already have this initial checkpoint as part of the L1Committer + // struct, but we need to create a one-time copy of it because + // we still need to use the current checkpoint store later for witness + // generation. + + let (one_time_checkpoint_store, one_time_checkpoint_blockchain) = self + .create_checkpoint(&self.current_checkpoint_store, &one_time_checkpoint_path) + .await?; + // Try to prepare batch + let result = self + .prepare_batch_from_block( + *last_block, + batch_to_commit, + one_time_checkpoint_store, + one_time_checkpoint_blockchain, + ) + .await; + + if one_time_checkpoint_path.exists() { + let _ = remove_dir_all(&one_time_checkpoint_path).inspect_err(|e| { + error!( + "Failed to remove one-time checkpoint directory at path {one_time_checkpoint_path:?}. Should be removed manually. Error: {}", e.to_string() + ) + }); + } + let ( blobs_bundle, new_state_root, message_hashes, privileged_transactions_hash, last_block_of_batch, - ) = self - .prepare_batch_from_block(*last_block, batch_to_commit) - .await?; + ) = result?; if *last_block == last_block_of_batch { debug!("No new blocks to commit, skipping"); @@ -370,6 +405,8 @@ impl L1Committer { &mut self, mut last_added_block_number: BlockNumber, batch_number: u64, + one_time_checkpoint_store: Store, + one_time_checkpoint_blockchain: Arc, ) -> Result<(BlobsBundle, H256, Vec, H256, BlockNumber), CommitterError> { let first_block_of_batch = last_added_block_number + 1; let mut blobs_bundle = BlobsBundle::default(); @@ -391,21 +428,6 @@ impl L1Committer { info!("Preparing state diff from block {first_block_of_batch}, {batch_number}"); - let one_time_checkpoint_path = self - .checkpoints_dir - .join(format!("temp_checkpoint_batch_{batch_number}")); - - // For re-execution we need to use a checkpoint to the previous state - // (i.e. checkpoint of the state to the latest block from the previous - // batch, or the state of the genesis if this is the first batch). - // We already have this initial checkpoint as part of the L1Committer - // struct, but we need to create a one-time copy of it because - // we still need to use the current checkpoint store later for witness - // generation. - let (one_time_checkpoint_store, one_time_checkpoint_blockchain) = self - .create_checkpoint(&self.current_checkpoint_store, &one_time_checkpoint_path) - .await?; - loop { let block_to_commit_number = last_added_block_number + 1; @@ -660,12 +682,6 @@ impl L1Committer { let privileged_transactions_hash = compute_privileged_transactions_hash(privileged_transactions_hashes)?; - remove_dir_all(&one_time_checkpoint_path).map_err(|e| { - CommitterError::FailedToCreateCheckpoint(format!( - "Failed to remove one-time checkpoint directory {one_time_checkpoint_path:?}: {e}" - )) - })?; - Ok(( blobs_bundle, new_state_root, @@ -686,11 +702,30 @@ impl L1Committer { ) .await?; - let batch_witness = self - .current_checkpoint_blockchain + let rand_suffix: u32 = rand::thread_rng().r#gen(); + let one_time_checkpoint_path = self.checkpoints_dir.join(format!( + "temp_checkpoint_witness_{}_{rand_suffix}", + batch.number + )); + // We need to create a one-time checkpoint copy because if witness generation fails the checkpoint would be modified + let (_, one_time_checkpoint_blockchain) = self + .create_checkpoint(&self.current_checkpoint_store, &one_time_checkpoint_path) + .await?; + + let result = one_time_checkpoint_blockchain .generate_witness_for_blocks_with_fee_configs(&blocks, Some(&fee_configs)) .await - .map_err(CommitterError::FailedToGenerateBatchWitness)?; + .map_err(CommitterError::FailedToGenerateBatchWitness); + + if one_time_checkpoint_path.exists() { + let _ = remove_dir_all(&one_time_checkpoint_path).inspect_err(|e| { + error!( + "Failed to remove one-time checkpoint directory at path {one_time_checkpoint_path:?}. Should be removed manually. Error: {}", e.to_string() + ) + }); + } + + let batch_witness = result?; // We still need to differentiate the validium case because for validium // we are generating the BlobsBundle with BlobsBundle::default which @@ -755,7 +790,7 @@ impl L1Committer { // We need to skip checkpoint creation if the directory already exists. // Sometimes the commit_next_batch task is retried after a failure, and in // that case we would try to create a checkpoint again at the same path, - // causing an lock error under rocksdb feature. + // causing a lock error under rocksdb feature. if new_checkpoint_path.exists() { debug!("Checkpoint at path {new_checkpoint_path:?} already exists, skipping creation"); return Ok(()); @@ -778,7 +813,7 @@ impl L1Committer { /// 1. Creates a checkpoint of the provided store at the specified path. /// 2. Initializes a new store and blockchain for the checkpoint. /// 3. Regenerates the head state in the checkpoint store. - /// 4. Validates that the checkpoint store's head block number and latest block match those of the original store. + /// 4. TODO: Validates that the checkpoint contains the needed state root. async fn create_checkpoint( &self, checkpointee: &Store, @@ -806,54 +841,8 @@ impl L1Committer { self.blockchain.options.clone(), )); - let checkpoint_head_block_number = checkpoint_store.get_latest_block_number().await?; - - let db_head_block_number = checkpointee.get_latest_block_number().await?; - - if checkpoint_head_block_number != db_head_block_number { - return Err(CommitterError::FailedToCreateCheckpoint( - "checkpoint store head block number does not match main store head block number before regeneration".to_string(), - )); - } - regenerate_head_state(&checkpoint_store, &checkpoint_blockchain).await?; - let checkpoint_latest_block_number = checkpoint_store.get_latest_block_number().await?; - - let db_latest_block_number = checkpointee.get_latest_block_number().await?; - - let checkpoint_latest_block = checkpoint_store - .get_block_by_number(checkpoint_latest_block_number) - .await? - .ok_or(CommitterError::FailedToCreateCheckpoint( - "latest block not found in checkpoint store".to_string(), - ))?; - - let db_latest_block = checkpointee - .get_block_by_number(db_latest_block_number) - .await? - .ok_or(CommitterError::FailedToCreateCheckpoint( - "latest block not found in main store".to_string(), - ))?; - - if !checkpoint_store.has_state_root(checkpoint_latest_block.header.state_root)? { - return Err(CommitterError::FailedToCreateCheckpoint( - "checkpoint store state is not regenerated properly".to_string(), - )); - } - - if checkpoint_latest_block_number != db_head_block_number { - return Err(CommitterError::FailedToCreateCheckpoint( - "checkpoint store latest block number does not match main store head block number after regeneration".to_string(), - )); - } - - if checkpoint_latest_block.hash() != db_latest_block.hash() { - return Err(CommitterError::FailedToCreateCheckpoint( - "checkpoint store latest block hash does not match main store latest block hash after regeneration".to_string(), - )); - } - Ok((checkpoint_store, checkpoint_blockchain)) } From 408578d68f370335778f99a6abb9b46f4449c65d Mon Sep 17 00:00:00 2001 From: ilitteri Date: Sat, 1 Nov 2025 14:22:12 -0300 Subject: [PATCH 3/5] Fix tag release workflow Update the path to the SP1 VKs --- .github/workflows/tag_release.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tag_release.yaml b/.github/workflows/tag_release.yaml index 6d88f7a2e3e..24dade79b97 100644 --- a/.github/workflows/tag_release.yaml +++ b/.github/workflows/tag_release.yaml @@ -133,7 +133,8 @@ jobs: run: | mkdir -p ./verification_keys mv crates/l2/prover/src/guest_program/src/risc0/out/riscv32im-risc0-vk verification_keys/ethrex-riscv32im-risc0-vk - mv crates/l2/prover/src/guest_program/src/sp1/out/riscv32im-succinct-zkvm-vk verification_keys/ethrex-riscv32im-succinct-zkvm-vk + mv crates/l2/prover/src/guest_program/src/sp1/out/riscv32im-succinct-zkvm-vk-bn254 verification_keys/ethrex-riscv32im-succinct-zkvm-vk-bn254 + mv crates/l2/prover/src/guest_program/src/sp1/out/riscv32im-succinct-zkvm-vk-u32 verification_keys/ethrex-riscv32im-succinct-zkvm-vk-u32 - name: Upload artifact uses: actions/upload-artifact@v4 From 03576da920df8037d4c906f9ac1a711b89522fbb Mon Sep 17 00:00:00 2001 From: ilitteri Date: Sat, 1 Nov 2025 14:31:54 -0300 Subject: [PATCH 4/5] Fic pr-main_l2.yaml too --- .github/workflows/pr-main_l2.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-main_l2.yaml b/.github/workflows/pr-main_l2.yaml index a9b104cb7d6..fca914ac0f5 100644 --- a/.github/workflows/pr-main_l2.yaml +++ b/.github/workflows/pr-main_l2.yaml @@ -198,7 +198,7 @@ jobs: run: | cd crates/l2 make build-prover-exec - mkdir -p prover/src/guest_program/src/sp1/out && touch prover/src/guest_program/src/sp1/out/riscv32im-succinct-zkvm-vk + mkdir -p prover/src/guest_program/src/sp1/out && touch prover/src/guest_program/src/sp1/out/riscv32im-succinct-zkvm-vk-bn254 && touch prover/src/guest_program/src/sp1/out/riscv32im-succinct-zkvm-vk-u32 - name: Build test run: | From e8fce20f3c2fc5ebe736d39457ac902ca53eb286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20I=C3=B1aki=20Bilbao?= Date: Mon, 3 Nov 2025 14:25:00 -0300 Subject: [PATCH 5/5] fix(l2): set `pendingPrivilegedTxIndex` in initializer (#5161) **Motivation** OZ's upgrade tools require the variables to be set in initializers and not in constructor/variable declaration. This should not be such a problem as it will always be initialized as 0, but with this change we avoid the tool error **Description** --- crates/l2/contracts/src/l1/CommonBridge.sol | 3 ++- crates/l2/sdk/src/sdk.rs | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/l2/contracts/src/l1/CommonBridge.sol b/crates/l2/contracts/src/l1/CommonBridge.sol index ffb75f40a38..665a2d5682c 100644 --- a/crates/l2/contracts/src/l1/CommonBridge.sol +++ b/crates/l2/contracts/src/l1/CommonBridge.sol @@ -93,7 +93,7 @@ contract CommonBridge is address public NATIVE_TOKEN_L1; /// @dev Index pointing to the first unprocessed privileged transaction in the queue. - uint256 private pendingPrivilegedTxIndex = 0; + uint256 private pendingPrivilegedTxIndex; modifier onlyOnChainProposer() { require( @@ -124,6 +124,7 @@ contract CommonBridge is lastFetchedL1Block = block.number; transactionId = 0; + pendingPrivilegedTxIndex = 0; PRIVILEGED_TX_MAX_WAIT_BEFORE_INCLUSION = inclusionMaxWait; diff --git a/crates/l2/sdk/src/sdk.rs b/crates/l2/sdk/src/sdk.rs index cbcc3e64564..282bcfa4136 100644 --- a/crates/l2/sdk/src/sdk.rs +++ b/crates/l2/sdk/src/sdk.rs @@ -37,10 +37,10 @@ pub use ethrex_sdk_contract_utils::*; use calldata::from_hex_string_to_h256_array; -// 0x79d6af40f7c9145b0741639ea969c13d5faa3cc6 +// 0xcecd5910a4404ccf2718feb58dac13e975a862a2 pub const DEFAULT_BRIDGE_ADDRESS: Address = H160([ - 0x79, 0xd6, 0xaf, 0x40, 0xf7, 0xc9, 0x14, 0x5b, 0x07, 0x41, 0x63, 0x9e, 0xa9, 0x69, 0xc1, 0x3d, - 0x5f, 0xaa, 0x3c, 0xc6, + 0xce, 0xcd, 0x59, 0x10, 0xa4, 0x40, 0x4c, 0xcf, 0x27, 0x18, 0xfe, 0xb5, 0x8d, 0xac, 0x13, 0xe9, + 0x75, 0xa8, 0x62, 0xa2, ]); // 0x000000000000000000000000000000000000ffff