diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 11b0d1c1e9..f972dd3da9 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -541,18 +541,18 @@ jobs: name: citrea-build path: target/release - - name: Check BITCOIN_DA_ID + - name: Check BATCH_PROVER_BITCOIN_ID id: check-id run: | - RESULT=$(grep -R "BITCOIN_DA_ID" target/ || echo "Grep failed") + RESULT=$(grep -R "BATCH_PROVER_BITCOIN_ID" target/ || echo "Grep failed") EXPECTED_BITCOIN_DA_ID=$(echo "${{ env.EXPECTED_BITCOIN_DA_ID }}" | tr -d '\n\r') if echo "$RESULT" | grep -q "$EXPECTED_BITCOIN_DA_ID"; then echo "Check passed successfully." - echo "Expected: BITCOIN_DA_ID ${{ env.EXPECTED_BITCOIN_DA_ID }} " + echo "Expected: BATCH_PROVER_BITCOIN_ID ${{ env.EXPECTED_BITCOIN_DA_ID }} " echo "Actual: $RESULT" else - echo "Check failed. Expected: BITCOIN_DA_ID ${{ env.EXPECTED_BITCOIN_DA_ID }} " + echo "Check failed. Expected: BATCH_PROVER_BITCOIN_ID ${{ env.EXPECTED_BITCOIN_DA_ID }} " echo "Actual: $RESULT" exit 1 fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 324a59e4df..6df3980148 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -125,18 +125,18 @@ jobs: run: | cargo build --release - - name: Check BITCOIN_DA_ID + - name: Check BATCH_PROVER_BITCOIN_ID id: check-id run: | - RESULT=$(grep -R "BITCOIN_DA_ID" target/ || echo "Grep failed") + RESULT=$(grep -R "BATCH_PROVER_BITCOIN_ID" target/ || echo "Grep failed") EXPECTED_BITCOIN_DA_ID=$(echo "${{ env.EXPECTED_BITCOIN_DA_ID }}" | tr -d '\n\r') if echo "$RESULT" | grep -q "$EXPECTED_BITCOIN_DA_ID"; then echo "Check passed successfully." - echo "Expected: BITCOIN_DA_ID ${{ env.EXPECTED_BITCOIN_DA_ID }} " + echo "Expected: BATCH_PROVER_BITCOIN_ID ${{ env.EXPECTED_BITCOIN_DA_ID }} " echo "Actual: $RESULT" else - echo "Check failed. Expected: BITCOIN_DA_ID ${{ env.EXPECTED_BITCOIN_DA_ID }} " + echo "Check failed. Expected: BATCH_PROVER_BITCOIN_ID ${{ env.EXPECTED_BITCOIN_DA_ID }} " echo "Actual: $RESULT" exit 1 fi @@ -178,18 +178,18 @@ jobs: source $HOME/.cargo/env cargo build --release - - name: Check BITCOIN_DA_ID + - name: Check BATCH_PROVER_BITCOIN_ID id: check-id run: | - RESULT=$(grep -R "BITCOIN_DA_ID" target/ || echo "Grep failed") + RESULT=$(grep -R "BATCH_PROVER_BITCOIN_ID" target/ || echo "Grep failed") EXPECTED_BITCOIN_DA_ID=$(echo "${{ env.EXPECTED_BITCOIN_DA_ID }}" | tr -d '\n\r') if echo "$RESULT" | grep -q "$EXPECTED_BITCOIN_DA_ID"; then echo "Check passed successfully." - echo "Expected: BITCOIN_DA_ID ${{ env.EXPECTED_BITCOIN_DA_ID }} " + echo "Expected: BATCH_PROVER_BITCOIN_ID ${{ env.EXPECTED_BITCOIN_DA_ID }} " echo "Actual: $RESULT" else - echo "Check failed. Expected: BITCOIN_DA_ID ${{ env.EXPECTED_BITCOIN_DA_ID }} " + echo "Check failed. Expected: BATCH_PROVER_BITCOIN_ID ${{ env.EXPECTED_BITCOIN_DA_ID }} " echo "Actual: $RESULT" exit 1 fi diff --git a/.gitignore b/.gitignore index 208d79daba..6d62a34d5f 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,8 @@ demo_data/ resources/dbs/da-db/ resources/dbs/sequencer-db/ resources/dbs/full-node-db/ -resources/dbs/prover-db/ +resources/dbs/batch-prover-db/ +resources/dbs/light-client-prover-db/ resources/bitcoin/inscription_txs/ /.vscode/* diff --git a/Cargo.lock b/Cargo.lock index 6761b4ab6a..9342c422a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1700,12 +1700,13 @@ dependencies = [ "bitcoin-da", "bitcoincore-rpc", "borsh", + "citrea-batch-prover", "citrea-common", "citrea-e2e", "citrea-evm", "citrea-fullnode", + "citrea-light-client-prover", "citrea-primitives", - "citrea-prover", "citrea-risc0-bonsai-adapter", "citrea-sequencer", "citrea-stf", @@ -1716,6 +1717,7 @@ dependencies = [ "log", "log-panics", "proptest", + "prover-services", "regex", "reqwest 0.12.5", "reth-primitives", @@ -1747,6 +1749,45 @@ dependencies = [ "tracing-subscriber 0.3.18", ] +[[package]] +name = "citrea-batch-prover" +version = "0.5.0-rc.1" +dependencies = [ + "anyhow", + "async-trait", + "backoff", + "borsh", + "citrea-common", + "citrea-primitives", + "citrea-stf", + "futures", + "hex", + "jsonrpsee", + "num_cpus", + "parking_lot", + "prover-services", + "rand 0.8.5", + "rayon", + "rs_merkle", + "sequencer-client", + "serde", + "sha2", + "sov-db", + "sov-mock-da", + "sov-mock-zkvm", + "sov-modules-api", + "sov-modules-core", + "sov-modules-rollup-blueprint", + "sov-modules-stf-blueprint", + "sov-rollup-interface 0.5.0-rc.1", + "sov-stf-runner", + "tempfile", + "tokio", + "tokio-util", + "tower", + "tracing", +] + [[package]] name = "citrea-common" version = "0.5.0-rc.1" @@ -1778,7 +1819,7 @@ dependencies = [ [[package]] name = "citrea-e2e" version = "0.1.0" -source = "git+https://github.com/chainwayxyz/citrea-e2e?rev=fc12cb0#fc12cb0bbf14cd55a0279014dc67db478c2ec39b" +source = "git+https://github.com/chainwayxyz/citrea-e2e?rev=0a6492ebbb7#0a6492ebbb7861a263d274bf11efa5556547247e" dependencies = [ "anyhow", "async-trait", @@ -1887,57 +1928,40 @@ dependencies = [ ] [[package]] -name = "citrea-primitives" +name = "citrea-light-client-prover" version = "0.5.0-rc.1" dependencies = [ - "alloy-eips", "anyhow", - "brotli", - "reth-primitives", - "serde", - "sov-rollup-interface 0.5.0-rc.1", - "tokio", - "tracing", -] - -[[package]] -name = "citrea-prover" -version = "0.5.0-rc.1" -dependencies = [ - "anyhow", - "async-trait", - "backoff", "borsh", "citrea-common", - "citrea-primitives", - "citrea-stf", - "futures", "hex", "jsonrpsee", - "num_cpus", - "parking_lot", - "rand 0.8.5", - "rayon", - "rs_merkle", "sequencer-client", - "serde", - "sha2", "sov-db", - "sov-mock-da", - "sov-mock-zkvm", "sov-modules-api", - "sov-modules-core", "sov-modules-rollup-blueprint", - "sov-modules-stf-blueprint", "sov-rollup-interface 0.5.0-rc.1", "sov-stf-runner", - "tempfile", "tokio", "tokio-util", "tower", "tracing", ] +[[package]] +name = "citrea-primitives" +version = "0.5.0-rc.1" +dependencies = [ + "alloy-eips", + "anyhow", + "brotli", + "reth-primitives", + "serde", + "sov-rollup-interface 0.5.0-rc.1", + "tokio", + "tracing", +] + [[package]] name = "citrea-pruning" version = "0.5.0-rc.1" @@ -4274,7 +4298,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -4306,7 +4330,6 @@ dependencies = [ "libc", "libz-sys", "lz4-sys", - "zstd-sys", ] [[package]] @@ -5199,12 +5222,44 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9552f850d5f0964a4e4d0bf306459ac29323ddfbae05e35a7c0d35cb0803cc5" dependencies = [ "anyhow", - "itertools 0.13.0", + "itertools 0.10.5", "proc-macro2", "quote", "syn 2.0.72", ] +[[package]] +name = "prover-services" +version = "0.5.0-rc.1" +dependencies = [ + "anyhow", + "async-trait", + "bincode", + "borsh", + "citrea-primitives", + "citrea-stf", + "futures", + "hex", + "jsonrpsee", + "num_cpus", + "parking_lot", + "rand 0.8.5", + "rayon", + "risc0-zkvm", + "rs_merkle", + "serde", + "sha2", + "sov-db", + "sov-modules-api", + "sov-rollup-interface 0.5.0-rc.1", + "sov-stf-runner", + "tempfile", + "tokio", + "tokio-util", + "tower", + "tracing", +] + [[package]] name = "puffin" version = "0.19.1" diff --git a/Cargo.toml b/Cargo.toml index 917d7c87ec..0cb8904ff9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,13 +3,17 @@ resolver = "2" members = [ # Citrea "bin/citrea", - "crates/common", - "crates/primitives", - "crates/pruning", + "crates/batch-prover", "crates/bitcoin-da", - "crates/evm", + "crates/citrea-stf", + "crates/common", "crates/ethereum-rpc", + "crates/evm", "crates/fullnode", + "crates/light-client-prover", + "crates/primitives", + "crates/prover-services", + "crates/pruning", "crates/risc0-bonsai", "crates/sequencer", "crates/sequencer-client", @@ -102,7 +106,7 @@ rayon = "1.8.0" rlimit = "0.10.2" rustc_version_runtime = { version = "0.3.0", default-features = false } reqwest = { version = "0.12.5", features = ["rustls-tls", "json", "http2"], default-features = false } -rocksdb = { version = "0.22.0", features = ["lz4"] } +rocksdb = { version = "0.22.0", features = ["lz4"], default-features = false } serde = { version = "1.0.192", default-features = false, features = ["alloc", "derive"] } serde_json = { version = "1.0", default-features = false, features = ["alloc"] } sha2 = { version = "0.10.8", default-features = false } diff --git a/Makefile b/Makefile index fcdefb79a8..95793b36e1 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,8 @@ clean: ## Cleans compiled clean-node: ## Cleans local dbs needed for sequencer and nodes rm -rf resources/dbs/sequencer-db - rm -rf resources/dbs/prover-db + rm -rf resources/dbs/batch-prover-db + rm -rf resources/dbs/light-client-prover-db rm -rf resources/dbs/full-node-db clean-txs: diff --git a/bin/citrea/Cargo.toml b/bin/citrea/Cargo.toml index 46de0048fd..bfe6ea4280 100644 --- a/bin/citrea/Cargo.toml +++ b/bin/citrea/Cargo.toml @@ -14,15 +14,17 @@ resolver = "2" [dependencies] # Citrea deps bitcoin-da = { path = "../../crates/bitcoin-da", features = ["native"] } +citrea-batch-prover = { path = "../../crates/batch-prover" } citrea-common = { path = "../../crates/common" } citrea-fullnode = { path = "../../crates/fullnode" } +citrea-light-client-prover = { path = "../../crates/light-client-prover", features = ["native"] } citrea-primitives = { path = "../../crates/primitives" } -citrea-prover = { path = "../../crates/prover" } citrea-risc0 = { package = "risc0", path = "./provers/risc0" } citrea-risc0-bonsai-adapter = { path = "../../crates/risc0-bonsai", features = ["native"] } citrea-sequencer = { path = "../../crates/sequencer" } citrea-stf = { path = "../../crates/citrea-stf", features = ["native"] } ethereum-rpc = { path = "../../crates/ethereum-rpc" } +prover-services = { path = "../../crates/prover-services" } sequencer-client = { path = "../../crates/sequencer-client" } # Sovereign-SDK deps @@ -86,7 +88,7 @@ rustc_version_runtime = { workspace = true } # bitcoin-e2e dependencies bitcoin.workspace = true bitcoincore-rpc.workspace = true -citrea-e2e = { git = "https://github.com/chainwayxyz/citrea-e2e", rev = "fc12cb0" } +citrea-e2e = { git = "https://github.com/chainwayxyz/citrea-e2e", rev = "0a6492ebbb7" } [features] default = [] # Deviate from convention by making the "native" feature active by default. This aligns with how this package is meant to be used (as a binary first, library second). diff --git a/bin/citrea/provers/risc0/Cargo.toml b/bin/citrea/provers/risc0/Cargo.toml index 635fe74fdd..5084a12c99 100644 --- a/bin/citrea/provers/risc0/Cargo.toml +++ b/bin/citrea/provers/risc0/Cargo.toml @@ -10,7 +10,7 @@ resolver = "2" risc0-build = { workspace = true } [package.metadata.risc0] -methods = ["guest-mock", "guest-bitcoin"] +methods = ["batch-prover-bitcoin", "batch-prover-mock", "light-client-prover-bitcoin", "light-client-prover-mock"] [features] bench = [] diff --git a/bin/citrea/provers/risc0/guest-bitcoin/Cargo.lock b/bin/citrea/provers/risc0/batch-prover-bitcoin/Cargo.lock similarity index 98% rename from bin/citrea/provers/risc0/guest-bitcoin/Cargo.lock rename to bin/citrea/provers/risc0/batch-prover-bitcoin/Cargo.lock index b3ec7de6e9..072ff628af 100644 --- a/bin/citrea/provers/risc0/guest-bitcoin/Cargo.lock +++ b/bin/citrea/provers/risc0/batch-prover-bitcoin/Cargo.lock @@ -14,6 +14,21 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "alloc-no-stdlib" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" +dependencies = [ + "alloc-no-stdlib", +] + [[package]] name = "allocator-api2" version = "0.2.18" @@ -544,6 +559,23 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +[[package]] +name = "batch-prover-bitcoin" +version = "0.5.0-rc.1" +dependencies = [ + "anyhow", + "bitcoin-da", + "citrea-primitives", + "citrea-stf", + "risc0-zkvm", + "risc0-zkvm-platform", + "sov-modules-api", + "sov-modules-stf-blueprint", + "sov-risc0-adapter", + "sov-rollup-interface", + "sov-state", +] + [[package]] name = "bcs" version = "0.1.6" @@ -616,6 +648,7 @@ dependencies = [ "async-trait", "bitcoin", "borsh", + "citrea-primitives", "futures", "hex", "rand", @@ -777,6 +810,27 @@ dependencies = [ "syn_derive", ] +[[package]] +name = "brotli" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74f7971dbd9326d58187408ab83117d8ac1bb9c17b085fdacd1cf2f598719b6b" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a45bd2e4095a8b518033b128020dd4a55aab1c0a381ba4404a472630f4bc362" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + [[package]] name = "byte-slice-cast" version = "1.2.2" @@ -850,23 +904,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" -[[package]] -name = "citrea-bitcoin-prover" -version = "0.5.0-rc.1" -dependencies = [ - "anyhow", - "bitcoin-da", - "citrea-primitives", - "citrea-stf", - "risc0-zkvm", - "risc0-zkvm-platform", - "sov-modules-api", - "sov-modules-stf-blueprint", - "sov-risc0-adapter", - "sov-rollup-interface", - "sov-state", -] - [[package]] name = "citrea-evm" version = "0.5.0-rc.1" @@ -893,6 +930,7 @@ version = "0.5.0-rc.1" dependencies = [ "alloy-eips", "anyhow", + "brotli", "reth-primitives", "sov-rollup-interface", ] diff --git a/bin/citrea/provers/risc0/guest-bitcoin/Cargo.toml b/bin/citrea/provers/risc0/batch-prover-bitcoin/Cargo.toml similarity index 98% rename from bin/citrea/provers/risc0/guest-bitcoin/Cargo.toml rename to bin/citrea/provers/risc0/batch-prover-bitcoin/Cargo.toml index c38b5b8ea7..8d01a16d4c 100644 --- a/bin/citrea/provers/risc0/guest-bitcoin/Cargo.toml +++ b/bin/citrea/provers/risc0/batch-prover-bitcoin/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "citrea-bitcoin-prover" +name = "batch-prover-bitcoin" version = "0.5.0-rc.1" edition = "2021" resolver = "2" diff --git a/bin/citrea/provers/risc0/guest-bitcoin/src/bin/bitcoin_da.rs b/bin/citrea/provers/risc0/batch-prover-bitcoin/src/bin/batch_prover_bitcoin.rs similarity index 100% rename from bin/citrea/provers/risc0/guest-bitcoin/src/bin/bitcoin_da.rs rename to bin/citrea/provers/risc0/batch-prover-bitcoin/src/bin/batch_prover_bitcoin.rs diff --git a/bin/citrea/provers/risc0/guest-mock/Cargo.lock b/bin/citrea/provers/risc0/batch-prover-mock/Cargo.lock similarity index 98% rename from bin/citrea/provers/risc0/guest-mock/Cargo.lock rename to bin/citrea/provers/risc0/batch-prover-mock/Cargo.lock index f9c680132f..9df1e7c5ac 100644 --- a/bin/citrea/provers/risc0/guest-mock/Cargo.lock +++ b/bin/citrea/provers/risc0/batch-prover-mock/Cargo.lock @@ -14,6 +14,21 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "alloc-no-stdlib" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" +dependencies = [ + "alloc-no-stdlib", +] + [[package]] name = "allocator-api2" version = "0.2.18" @@ -534,6 +549,21 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +[[package]] +name = "batch-prover-mock" +version = "0.5.0-rc.1" +dependencies = [ + "anyhow", + "citrea-stf", + "risc0-zkvm", + "risc0-zkvm-platform", + "sov-mock-da", + "sov-modules-api", + "sov-modules-stf-blueprint", + "sov-risc0-adapter", + "sov-state", +] + [[package]] name = "bcs" version = "0.1.6" @@ -689,6 +719,27 @@ dependencies = [ "syn_derive", ] +[[package]] +name = "brotli" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74f7971dbd9326d58187408ab83117d8ac1bb9c17b085fdacd1cf2f598719b6b" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a45bd2e4095a8b518033b128020dd4a55aab1c0a381ba4404a472630f4bc362" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + [[package]] name = "byte-slice-cast" version = "1.2.2" @@ -788,6 +839,7 @@ version = "0.5.0-rc.1" dependencies = [ "alloy-eips", "anyhow", + "brotli", "reth-primitives", "sov-rollup-interface", ] @@ -2663,21 +2715,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "sov-demo-prover-guest-mock" -version = "0.5.0-rc.1" -dependencies = [ - "anyhow", - "citrea-stf", - "risc0-zkvm", - "risc0-zkvm-platform", - "sov-mock-da", - "sov-modules-api", - "sov-modules-stf-blueprint", - "sov-risc0-adapter", - "sov-state", -] - [[package]] name = "sov-mock-da" version = "0.5.0-rc.1" diff --git a/bin/citrea/provers/risc0/guest-mock/Cargo.toml b/bin/citrea/provers/risc0/batch-prover-mock/Cargo.toml similarity index 97% rename from bin/citrea/provers/risc0/guest-mock/Cargo.toml rename to bin/citrea/provers/risc0/batch-prover-mock/Cargo.toml index 521818eb6c..1e68f0476f 100644 --- a/bin/citrea/provers/risc0/guest-mock/Cargo.toml +++ b/bin/citrea/provers/risc0/batch-prover-mock/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "sov-demo-prover-guest-mock" +name = "batch-prover-mock" version = "0.5.0-rc.1" edition = "2021" resolver = "2" diff --git a/bin/citrea/provers/risc0/guest-mock/src/bin/mock_da.rs b/bin/citrea/provers/risc0/batch-prover-mock/src/bin/batch_prover_mock.rs similarity index 100% rename from bin/citrea/provers/risc0/guest-mock/src/bin/mock_da.rs rename to bin/citrea/provers/risc0/batch-prover-mock/src/bin/batch_prover_mock.rs diff --git a/bin/citrea/provers/risc0/build.rs b/bin/citrea/provers/risc0/build.rs index af2061b65d..822b1accf9 100644 --- a/bin/citrea/provers/risc0/build.rs +++ b/bin/citrea/provers/risc0/build.rs @@ -16,10 +16,14 @@ fn main() { let methods_path = out_dir.join("methods.rs"); let elf = r#" - pub const BITCOIN_DA_ELF: &[u8] = &[]; - pub const MOCK_DA_ELF: &[u8] = &[]; - pub const BITCOIN_DA_ID: [u32; 8] = [0u32; 8]; - pub const MOCK_DA_ID: [u32; 8] = [0u32; 8]; + pub const BATCH_PROVER_BITCOIN_ELF: &[u8] = &[]; + pub const BATCH_PROVER_BITCOIN_ID: [u32; 8] = [0u32; 8]; + pub const BATCH_PROVER_MOCK_ELF: &[u8] = &[]; + pub const BATCH_PROVER_MOCK_ID: [u32; 8] = [0u32; 8]; + pub const LIGHT_CLIENT_PROVER_BITCOIN_ELF: &[u8] = &[]; + pub const LIGHT_CLIENT_PROVER_BITCOIN_ID: [u32; 8] = [0u32; 8]; + pub const LIGHT_CLIENT_PROVER_MOCK_ELF: &[u8] = &[]; + pub const LIGHT_CLIENT_PROVER_MOCK_ID: [u32; 8] = [0u32; 8]; "#; return std::fs::write(methods_path, elf).expect("Failed to write mock rollup elf"); @@ -61,14 +65,28 @@ fn get_guest_options() -> HashMap<&'static str, risc0_build::GuestOptions> { }; guest_pkg_to_options.insert( - "sov-demo-prover-guest-mock", + "batch-prover-bitcoin", GuestOptions { features: features.clone(), use_docker: use_docker.clone(), }, ); guest_pkg_to_options.insert( - "citrea-bitcoin-prover", + "batch-prover-mock", + GuestOptions { + features: features.clone(), + use_docker: use_docker.clone(), + }, + ); + guest_pkg_to_options.insert( + "light-client-prover-bitcoin", + GuestOptions { + features: features.clone(), + use_docker: use_docker.clone(), + }, + ); + guest_pkg_to_options.insert( + "light-client-prover-mock", GuestOptions { features: features.clone(), use_docker: use_docker.clone(), diff --git a/bin/citrea/provers/risc0/light-client-prover-bitcoin/Cargo.lock b/bin/citrea/provers/risc0/light-client-prover-bitcoin/Cargo.lock new file mode 100644 index 0000000000..0f80440add --- /dev/null +++ b/bin/citrea/provers/risc0/light-client-prover-bitcoin/Cargo.lock @@ -0,0 +1,3261 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "alloc-no-stdlib" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" +dependencies = [ + "alloc-no-stdlib", +] + +[[package]] +name = "allocator-api2" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" + +[[package]] +name = "alloy-chains" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94c225801d42099570d0674701dddd4142f0ef715282aeb5985042e2ec962df7" +dependencies = [ + "num_enum", + "serde", + "strum", +] + +[[package]] +name = "alloy-consensus" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04c309895995eaa4bfcc345f5515a39c7df9447798645cc8bf462b6c5bf1dc96" +dependencies = [ + "alloy-eips", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "serde", +] + +[[package]] +name = "alloy-eips" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9431c99a3b3fe606ede4b3d4043bdfbcb780c45b8d8d226c3804e2b75cfbe68" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "c-kzg", + "k256", + "once_cell", + "serde", + "sha2", +] + +[[package]] +name = "alloy-genesis" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79614dfe86144328da11098edcc7bc1a3f25ad8d3134a9eb9e857e06f0d9840d" +dependencies = [ + "alloy-primitives", + "alloy-serde", + "serde", +] + +[[package]] +name = "alloy-primitives" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccb3ead547f4532bc8af961649942f0b9c16ee9226e26caa3f38420651cc0bf4" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more", + "getrandom", + "hex-literal", + "itoa", + "k256", + "keccak-asm", + "proptest", + "rand", + "ruint", + "serde", + "tiny-keccak", +] + +[[package]] +name = "alloy-rlp" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26154390b1d205a4a7ac7352aa2eb4f81f391399d4e2f546fb81a2f8bb383f62" +dependencies = [ + "alloy-rlp-derive", + "arrayvec", + "bytes", +] + +[[package]] +name = "alloy-rlp-derive" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d0f2d905ebd295e7effec65e5f6868d153936130ae718352771de3e7d03c75c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "alloy-serde" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33feda6a53e6079895aed1d08dcb98a1377b000d80d16370fbbdb8155d547ef" +dependencies = [ + "alloy-primitives", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-trie" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03704f265cbbb943b117ecb5055fd46e8f41e7dc8a58b1aed20bcd40ace38c15" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "derive_more", + "hashbrown 0.14.5", + "nybbles", + "serde", + "smallvec", + "tracing", +] + +[[package]] +name = "anyhow" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" + +[[package]] +name = "ark-bn254" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-crypto-primitives" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3a13b34da09176a8baba701233fdffbaa7c1b1192ce031a3da4e55ce1f1a56" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-relations", + "ark-serialize 0.4.2", + "ark-snark", + "ark-std 0.4.0", + "blake2", + "derivative", + "digest 0.10.7", + "sha2", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff 0.4.2", + "ark-poly", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "hashbrown 0.13.2", + "itertools 0.10.5", + "num-traits", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b3235cc41ee7a12aaaf2c575a2ad7b46713a8a50bda2fc3b003a04845c05dd6" +dependencies = [ + "ark-ff-asm 0.3.0", + "ark-ff-macros 0.3.0", + "ark-serialize 0.3.0", + "ark-std 0.3.0", + "derivative", + "num-bigint", + "num-traits", + "paste", + "rustc_version 0.3.3", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm 0.4.2", + "ark-ff-macros 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "digest 0.10.7", + "itertools 0.10.5", + "num-bigint", + "num-traits", + "paste", + "rustc_version 0.4.1", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" +dependencies = [ + "num-bigint", + "num-traits", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-groth16" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20ceafa83848c3e390f1cbf124bc3193b3e639b3f02009e0e290809a501b95fc" +dependencies = [ + "ark-crypto-primitives", + "ark-ec", + "ark-ff 0.4.2", + "ark-poly", + "ark-relations", + "ark-serialize 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-relations" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00796b6efc05a3f48225e59cb6a2cda78881e7c390872d5786aaf112f31fb4f0" +dependencies = [ + "ark-ff 0.4.2", + "ark-std 0.4.0", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "ark-serialize" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671" +dependencies = [ + "ark-std 0.3.0", + "digest 0.9.0", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-serialize-derive", + "ark-std 0.4.0", + "digest 0.10.7", + "num-bigint", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-snark" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84d3cc6833a335bb8a600241889ead68ee89a3cf8448081fb7694c0fe503da63" +dependencies = [ + "ark-ff 0.4.2", + "ark-relations", + "ark-serialize 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-std" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "async-trait" +version = "0.1.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "auto_impl" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base58ck" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c8d66485a3a2ea485c1913c4572ce0256067a5377ac8c75c4960e1cda98605f" +dependencies = [ + "bitcoin-internals", + "bitcoin_hashes", +] + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bcs" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85b6598a2f5d564fb7855dc6b06fd1c38cff5a72bd8b863a4d021938497b440a" +dependencies = [ + "serde", + "thiserror", +] + +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + +[[package]] +name = "bech32" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + +[[package]] +name = "bitcoin" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0032b0e8ead7074cda7fc4f034409607e3f03a6f71d66ade8a307f79b4d99e73" +dependencies = [ + "base58ck", + "bech32 0.11.0", + "bitcoin-internals", + "bitcoin-io", + "bitcoin-units", + "bitcoin_hashes", + "hex-conservative", + "hex_lit", + "secp256k1", + "serde", +] + +[[package]] +name = "bitcoin-da" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "bitcoin", + "borsh", + "citrea-primitives", + "futures", + "hex", + "rand", + "serde", + "serde_json", + "sha2", + "sov-rollup-interface", + "thiserror", +] + +[[package]] +name = "bitcoin-internals" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30bdbe14aa07b06e6cfeffc529a1f099e5fbe249524f8125358604df99a4bed2" +dependencies = [ + "serde", +] + +[[package]] +name = "bitcoin-io" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "340e09e8399c7bd8912f495af6aa58bea0c9214773417ffaa8f6460f93aaee56" + +[[package]] +name = "bitcoin-units" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5285c8bcaa25876d07f37e3d30c303f2609179716e11d688f51e8f1fe70063e2" +dependencies = [ + "bitcoin-internals", + "serde", +] + +[[package]] +name = "bitcoin_hashes" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb18c03d0db0247e147a21a6faafd5a7eb851c743db062de72018b6b7e8e4d16" +dependencies = [ + "bitcoin-io", + "hex-conservative", + "serde", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +dependencies = [ + "serde", +] + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "serde", + "tap", + "wyz", +] + +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "blake3" +version = "1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d82033247fd8e890df8f740e407ad4d038debb9eb1f40533fffb32e7d17dc6f7" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq", +] + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bls12_381" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7bc6d6292be3a19e6379786dac800f551e5865a5bb51ebbe3064ab80433f403" +dependencies = [ + "ff", + "group", + "pairing", + "rand_core", + "subtle", +] + +[[package]] +name = "blst" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4378725facc195f1a538864863f6de233b500a8862747e7f165078a419d5e874" +dependencies = [ + "cc", + "glob", + "threadpool", + "zeroize", +] + +[[package]] +name = "borsh" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed" +dependencies = [ + "borsh-derive", + "bytes", + "cfg_aliases", +] + +[[package]] +name = "borsh-derive" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b" +dependencies = [ + "once_cell", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.79", + "syn_derive", +] + +[[package]] +name = "brotli" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74f7971dbd9326d58187408ab83117d8ac1bb9c17b085fdacd1cf2f598719b6b" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a45bd2e4095a8b518033b128020dd4a55aab1c0a381ba4404a472630f4bc362" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + +[[package]] +name = "bytemuck" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc8b54b395f2fcfbb3d90c47b01c7f444d94d05bdeb775811dec868ac3bbc26" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" +dependencies = [ + "serde", +] + +[[package]] +name = "c-kzg" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0307f72feab3300336fb803a57134159f6e20139af1357f36c54cb90d8e8928" +dependencies = [ + "blst", + "cc", + "glob", + "hex", + "libc", + "once_cell", + "serde", +] + +[[package]] +name = "cc" +version = "1.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8d9e0b4957f635b8d3da819d0db5603620467ecf1f692d22a8c2717ce27e6d8" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "citrea-light-client-prover" +version = "0.5.0-rc.1" +dependencies = [ + "borsh", + "hex", + "sov-modules-api", + "sov-rollup-interface", +] + +[[package]] +name = "citrea-primitives" +version = "0.5.0-rc.1" +dependencies = [ + "alloy-eips", + "anyhow", + "brotli", + "reth-primitives", + "sov-rollup-interface", +] + +[[package]] +name = "const-hex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0121754e84117e65f9d90648ee6aa4882a6e63110307ab73967a4c5e7e69e586" +dependencies = [ + "cfg-if", + "cpufeatures", + "hex", + "proptest", + "serde", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "constant_time_eq" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics-types" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +dependencies = [ + "libc", +] + +[[package]] +name = "crc" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "git+https://github.com/risc0/RustCrypto-crypto-bigint?tag=v0.5.5-risczero.0#3ab63a6f1048833f7047d5a50532e4a4cc789384" +dependencies = [ + "generic-array", + "getrandom", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.2" +source = "git+https://github.com/risc0/curve25519-dalek?tag=curve25519-4.1.2-risczero.0#3dccc5b71b806f500e73829e2a5cbfe288cce2a0" +dependencies = [ + "cfg-if", + "cpufeatures", + "crypto-bigint", + "curve25519-dalek-derive", + "digest 0.10.7", + "fiat-crypto", + "hex", + "platforms", + "rustc_version 0.4.1", + "subtle", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "git+https://github.com/risc0/curve25519-dalek?tag=curve25519-4.1.2-risczero.0#3dccc5b71b806f500e73829e2a5cbfe288cce2a0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive_more" +version = "0.99.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" +dependencies = [ + "convert_case 0.4.0", + "proc-macro2", + "quote", + "rustc_version 0.4.1", + "syn 2.0.79", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "dyn-clone" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest 0.10.7", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "serde", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.1.1" +source = "git+https://github.com/risc0/curve25519-dalek?tag=curve25519-4.1.2-risczero.0#3dccc5b71b806f500e73829e2a5cbfe288cce2a0" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", +] + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "elf" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4445909572dbd556c457c849c4ca58623d84b27c8fff1e74b0b4227d8b90d17b" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest 0.10.7", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "enumn" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f9ed6b3789237c8a0c1c505af1c7eb2c560df6186f01b098c3a1064ea532f38" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "fastrand" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" + +[[package]] +name = "fastrlp" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139834ddba373bbdd213dffe02c8d110508dcf1726c2be27e8d1f7d7e1856418" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", +] + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "bitvec", + "rand_core", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "fixed-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" +dependencies = [ + "byteorder", + "rand", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "allocator-api2", + "serde", +] + +[[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] + +[[package]] +name = "hex-conservative" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5313b072ce3c597065a808dbf612c4c8e8590bdbf8b579508bf7a762c5eae6cd" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + +[[package]] +name = "hex_lit" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3011d1213f159867b13cfd6ac92d2cd5f1345762c63be3554e84092d85a50bbd" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "ics23" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18798160736c1e368938ba6967dbcb3c7afb3256b442a5506ba5222eebb68a5a" +dependencies = [ + "anyhow", + "blake2", + "blake3", + "bytes", + "hex", + "informalsystems-pbjson", + "prost", + "ripemd", + "serde", + "sha2", + "sha3", +] + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "indexmap" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +dependencies = [ + "equivalent", + "hashbrown 0.15.0", +] + +[[package]] +name = "informalsystems-pbjson" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aa4a0980c8379295100d70854354e78df2ee1c6ca0f96ffe89afeb3140e3a3d" +dependencies = [ + "base64", + "serde", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "jmt" +version = "0.10.0" +source = "git+https://github.com/penumbra-zone/jmt.git?rev=fd1c8ef#fd1c8ef99913663eb801576a9b13a31523861d87" +dependencies = [ + "anyhow", + "borsh", + "digest 0.10.7", + "hashbrown 0.13.2", + "hex", + "ics23", + "itertools 0.10.5", + "mirai-annotations", + "num-derive", + "num-traits", + "serde", + "sha2", + "thiserror", + "tracing", +] + +[[package]] +name = "k256" +version = "0.13.3" +source = "git+https://github.com/risc0/RustCrypto-elliptic-curves?tag=k256/v0.13.3-risczero.0#d4f457a04410397cbb652a67c168b6cd6e9757c4" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "keccak-asm" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "505d1856a39b200489082f90d897c3f07c455563880bc5952e38eabf731c83b6" +dependencies = [ + "digest 0.10.7", + "sha3-asm", +] + +[[package]] +name = "kzg-rs" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd9920cd4460ce3cbca19c62f3bb9a9611562478a4dc9d2c556f4a7d049c5b6b" +dependencies = [ + "bls12_381", + "glob", + "hex", + "once_cell", + "serde", + "serde_derive", + "serde_yaml", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.159" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "light-client-prover-bitcoin" +version = "0.5.0-rc.1" +dependencies = [ + "anyhow", + "bitcoin-da", + "citrea-light-client-prover", + "citrea-primitives", + "risc0-zkvm", + "risc0-zkvm-platform", + "sov-modules-api", + "sov-modules-stf-blueprint", + "sov-risc0-adapter", + "sov-rollup-interface", + "sov-state", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "metal" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ecfd3296f8c56b7c1f6fbac3c71cefa9d78ce009850c45000015f206dc7fa21" +dependencies = [ + "bitflags 2.6.0", + "block", + "core-graphics-types", + "foreign-types", + "log", + "objc", + "paste", +] + +[[package]] +name = "mirai-annotations" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" + +[[package]] +name = "modular-bitfield" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a53d79ba8304ac1c4f9eb3b9d281f21f7be9d4626f72ce7df4ad8fbde4f38a74" +dependencies = [ + "modular-bitfield-impl", + "static_assertions", +] + +[[package]] +name = "modular-bitfield-impl" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a7d5f7076603ebc68de2dc6a650ec331a062a13abaa346975be747bbfa4b789" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "num_enum" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "nybbles" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95f06be0417d97f81fe4e5c86d7d01b392655a9cac9c19a848aa033e18937b23" +dependencies = [ + "alloy-rlp", + "const-hex", + "proptest", + "serde", + "smallvec", +] + +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", +] + +[[package]] +name = "once_cell" +version = "1.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" + +[[package]] +name = "pairing" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fec4625e73cf41ef4bb6846cafa6d44736525f442ba45e407c4a000a13996f" +dependencies = [ + "group", +] + +[[package]] +name = "parity-scale-codec" +version = "3.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee" +dependencies = [ + "arrayvec", + "bitvec", + "byte-slice-cast", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pest" +version = "2.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdbef9d1d47087a895abd220ed25eb4ad973a5e26f6a4367b038c25e28dfc2d9" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "platforms" +version = "3.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e4c7666f2019727f9e8e14bf14456e99c707d780922869f1ba473eee101fa49" + +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "primitive-types" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" +dependencies = [ + "fixed-hash", + "impl-codec", + "uint", +] + +[[package]] +name = "proc-macro-crate" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proptest" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" +dependencies = [ + "bit-set", + "bit-vec", + "bitflags 2.6.0", + "lazy_static", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax", + "rusty-fork", + "tempfile", + "unarray", +] + +[[package]] +name = "prost" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-derive" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" +dependencies = [ + "anyhow", + "itertools 0.12.1", + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_xorshift" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "reth-codecs" +version = "1.0.4" +source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-genesis", + "alloy-primitives", + "alloy-trie", + "bytes", + "modular-bitfield", + "reth-codecs-derive", + "serde", +] + +[[package]] +name = "reth-codecs-derive" +version = "1.0.4" +source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +dependencies = [ + "convert_case 0.6.0", + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "reth-ethereum-forks" +version = "1.0.4" +source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +dependencies = [ + "alloy-chains", + "alloy-primitives", + "alloy-rlp", + "auto_impl", + "crc", + "dyn-clone", + "once_cell", + "rustc-hash", + "serde", + "thiserror-no-std", +] + +[[package]] +name = "reth-primitives" +version = "1.0.4" +source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +dependencies = [ + "alloy-eips", + "alloy-genesis", + "alloy-primitives", + "alloy-rlp", + "bytes", + "derive_more", + "k256", + "once_cell", + "rayon", + "reth-ethereum-forks", + "reth-primitives-traits", + "reth-static-file-types", + "reth-trie-common", + "revm-primitives", + "serde", +] + +[[package]] +name = "reth-primitives-traits" +version = "1.0.4" +source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-genesis", + "alloy-primitives", + "alloy-rlp", + "byteorder", + "bytes", + "derive_more", + "modular-bitfield", + "reth-codecs", + "revm-primitives", + "roaring", + "serde", +] + +[[package]] +name = "reth-static-file-types" +version = "1.0.4" +source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +dependencies = [ + "alloy-primitives", + "derive_more", + "serde", + "strum", +] + +[[package]] +name = "reth-trie-common" +version = "1.0.4" +source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +dependencies = [ + "alloy-consensus", + "alloy-genesis", + "alloy-primitives", + "alloy-rlp", + "alloy-trie", + "bytes", + "derive_more", + "itertools 0.13.0", + "nybbles", + "reth-codecs", + "reth-primitives-traits", + "revm-primitives", + "serde", +] + +[[package]] +name = "revm-primitives" +version = "7.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fc4311037ee093ec50ec734e1424fcb3e12d535c6cef683b75d1c064639630c" +dependencies = [ + "alloy-eips", + "alloy-primitives", + "auto_impl", + "bitflags 2.6.0", + "bitvec", + "c-kzg", + "cfg-if", + "dyn-clone", + "enumn", + "hashbrown 0.14.5", + "hex", + "kzg-rs", + "serde", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "risc0-binfmt" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "543230f7117ce0e6b92b4797fbb3da722575973258cc38a48e28af8d3cf3a26d" +dependencies = [ + "anyhow", + "borsh", + "elf", + "risc0-zkp", + "risc0-zkvm-platform", + "serde", + "tracing", +] + +[[package]] +name = "risc0-circuit-recursion" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436c762db677faf2cd616c55a69012d6b4f46c426b7d553c1b3d717e0c7e9438" +dependencies = [ + "anyhow", + "bytemuck", + "hex", + "metal", + "risc0-core", + "risc0-zkp", + "tracing", +] + +[[package]] +name = "risc0-circuit-rv32im" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21f81638d4349eb5a816f3fd6ea12b314007572fc63d45cdb83891bed64e2a2a" +dependencies = [ + "anyhow", + "metal", + "risc0-binfmt", + "risc0-core", + "risc0-zkp", + "risc0-zkvm-platform", + "serde", + "tracing", +] + +[[package]] +name = "risc0-core" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1714b8968a5e4583a15018dc2ae95878c76f4cdbc643268a34670fde5b08252a" +dependencies = [ + "bytemuck", + "rand_core", +] + +[[package]] +name = "risc0-groth16" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5f11beecdcabeac264fb868e0b5db22c7e2db5fa2ce68fd482d8ab9ffb88e5d" +dependencies = [ + "anyhow", + "ark-bn254", + "ark-ec", + "ark-groth16", + "ark-serialize 0.4.2", + "bytemuck", + "hex", + "num-bigint", + "num-traits", + "risc0-binfmt", + "risc0-zkp", + "serde", +] + +[[package]] +name = "risc0-zkp" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "285aa3993827b4a646d70e68240e138f71574680a02d2e97ad30b1db80efda80" +dependencies = [ + "anyhow", + "blake2", + "borsh", + "bytemuck", + "cfg-if", + "digest 0.10.7", + "hex", + "hex-literal", + "metal", + "paste", + "rand_core", + "risc0-core", + "risc0-zkvm-platform", + "serde", + "sha2", + "tracing", +] + +[[package]] +name = "risc0-zkvm" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "614fad8046130321e3be9ca3a36d9edad6ff4c538549ae191ec4d82576bb3893" +dependencies = [ + "anyhow", + "borsh", + "bytemuck", + "getrandom", + "hex", + "risc0-binfmt", + "risc0-circuit-recursion", + "risc0-circuit-rv32im", + "risc0-core", + "risc0-groth16", + "risc0-zkp", + "risc0-zkvm-platform", + "rrs-lib", + "semver 1.0.23", + "serde", + "sha2", + "stability", + "tracing", +] + +[[package]] +name = "risc0-zkvm-platform" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6acf0b0d7a55578f892e0460ed1f2ca06d0380e32440531d80ca82530d41272" +dependencies = [ + "bytemuck", + "getrandom", + "libm", + "stability", +] + +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes", + "rustc-hex", +] + +[[package]] +name = "roaring" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f4b84ba6e838ceb47b41de5194a60244fac43d9fe03b71dbe8c5a201081d6d1" +dependencies = [ + "bytemuck", + "byteorder", +] + +[[package]] +name = "rrs-lib" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4382d3af3a4ebdae7f64ba6edd9114fff92c89808004c4943b393377a25d001" +dependencies = [ + "downcast-rs", + "paste", +] + +[[package]] +name = "rs_merkle" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b241d2e59b74ef9e98d94c78c47623d04c8392abaf82014dfd372a16041128f" +dependencies = [ + "sha2", +] + +[[package]] +name = "ruint" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3cc4c2511671f327125da14133d0c5c5d137f006a1017a16f557bc85b16286" +dependencies = [ + "alloy-rlp", + "ark-ff 0.3.0", + "ark-ff 0.4.2", + "bytes", + "fastrlp", + "num-bigint", + "num-traits", + "parity-scale-codec", + "primitive-types", + "proptest", + "rand", + "rlp", + "ruint-macro", + "serde", + "valuable", + "zeroize", +] + +[[package]] +name = "ruint-macro" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" + +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + +[[package]] +name = "rustc_version" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" +dependencies = [ + "semver 0.11.0", +] + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver 1.0.23", +] + +[[package]] +name = "rustix" +version = "0.38.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +dependencies = [ + "bitflags 2.6.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustversion" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" + +[[package]] +name = "rusty-fork" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" +dependencies = [ + "fnv", + "quick-error", + "tempfile", + "wait-timeout", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "schemars" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09c024468a378b7e36765cd36702b7a90cc3cba11654f6685c8f233408e89e92" +dependencies = [ + "dyn-clone", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1eee588578aff73f856ab961cd2f79e36bc45d7ded33a7562adba4667aecc0e" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 2.0.79", +] + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "secp256k1" +version = "0.29.0" +source = "git+https://github.com/Sovereign-Labs/rust-secp256k1.git?branch=risc0-compatible-0-29-0#3769ab9b2227d430ca2c58546daf3680017cfefb" +dependencies = [ + "bitcoin_hashes", + "rand", + "secp256k1-sys", + "serde", +] + +[[package]] +name = "secp256k1-sys" +version = "0.10.0" +source = "git+https://github.com/Sovereign-Labs/rust-secp256k1.git?branch=risc0-compatible-0-29-0#3769ab9b2227d430ca2c58546daf3680017cfefb" +dependencies = [ + "cc", +] + +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + +[[package]] +name = "semver-parser" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +dependencies = [ + "pest", +] + +[[package]] +name = "serde" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "serde_derive_internals" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "serde_json" +version = "1.0.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_yaml" +version = "0.9.34+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" +dependencies = [ + "indexmap", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "git+https://github.com/risc0/RustCrypto-hashes?tag=sha2-v0.10.8-risczero.0#244dc3b08788f7a4ccce14c66896ae3b4f24c166" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest 0.10.7", + "keccak", +] + +[[package]] +name = "sha3-asm" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28efc5e327c837aa837c59eae585fc250715ef939ac32881bcc11677cd02d46" +dependencies = [ + "cc", + "cfg-if", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest 0.10.7", + "rand_core", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +dependencies = [ + "serde", +] + +[[package]] +name = "sov-modules-api" +version = "0.5.0-rc.1" +dependencies = [ + "anyhow", + "bech32 0.9.1", + "borsh", + "derive_more", + "ed25519-dalek", + "hex", + "jmt", + "serde", + "sha2", + "sov-modules-core", + "sov-rollup-interface", + "sov-state", + "thiserror", +] + +[[package]] +name = "sov-modules-core" +version = "0.5.0-rc.1" +dependencies = [ + "anyhow", + "bech32 0.9.1", + "borsh", + "derive_more", + "digest 0.10.7", + "hex", + "jmt", + "schemars", + "serde", + "sha2", + "sov-rollup-interface", + "thiserror", +] + +[[package]] +name = "sov-modules-stf-blueprint" +version = "0.5.0-rc.1" +dependencies = [ + "anyhow", + "borsh", + "hex", + "itertools 0.13.0", + "jmt", + "risc0-zkvm", + "risc0-zkvm-platform", + "rs_merkle", + "serde", + "sov-modules-api", + "sov-rollup-interface", + "sov-state", + "sov-zk-cycle-macros", + "thiserror", +] + +[[package]] +name = "sov-risc0-adapter" +version = "0.5.0-rc.1" +dependencies = [ + "anyhow", + "bincode", + "borsh", + "bytemuck", + "risc0-zkvm", + "risc0-zkvm-platform", + "serde", + "sov-rollup-interface", +] + +[[package]] +name = "sov-rollup-interface" +version = "0.5.0-rc.1" +dependencies = [ + "anyhow", + "async-trait", + "borsh", + "bytes", + "digest 0.10.7", + "hex", + "proptest", + "serde", + "sha2", + "thiserror", +] + +[[package]] +name = "sov-state" +version = "0.5.0-rc.1" +dependencies = [ + "anyhow", + "bcs", + "borsh", + "hex", + "jmt", + "risc0-zkvm", + "risc0-zkvm-platform", + "serde", + "serde_json", + "sha2", + "sov-modules-core", + "sov-rollup-interface", + "sov-zk-cycle-macros", + "thiserror", +] + +[[package]] +name = "sov-zk-cycle-macros" +version = "0.5.0-rc.1" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "stability" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d904e7009df136af5297832a3ace3370cd14ff1546a232f4f185036c2736fcac" +dependencies = [ + "quote", + "syn 2.0.79", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strum" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.79", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn_derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tempfile" +version = "3.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +dependencies = [ + "cfg-if", + "fastrand", + "once_cell", + "rustix", + "windows-sys 0.59.0", +] + +[[package]] +name = "thiserror" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "thiserror-impl-no-std" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58e6318948b519ba6dc2b442a6d0b904ebfb8d411a3ad3e07843615a72249758" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "thiserror-no-std" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3ad459d94dd517257cc96add8a43190ee620011bb6e6cdc82dafd97dfafafea" +dependencies = [ + "thiserror-impl-no-std", +] + +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" + +[[package]] +name = "toml_edit" +version = "0.22.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +dependencies = [ + "indexmap", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-subscriber" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +dependencies = [ + "tracing-core", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + +[[package]] +name = "unsafe-libyaml" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wait-timeout" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +dependencies = [ + "libc", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +dependencies = [ + "memchr", +] + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] diff --git a/bin/citrea/provers/risc0/light-client-prover-bitcoin/Cargo.toml b/bin/citrea/provers/risc0/light-client-prover-bitcoin/Cargo.toml new file mode 100644 index 0000000000..041a7da0ca --- /dev/null +++ b/bin/citrea/provers/risc0/light-client-prover-bitcoin/Cargo.toml @@ -0,0 +1,41 @@ +[package] +name = "light-client-prover-bitcoin" +version = "0.5.0-rc.1" +edition = "2021" +resolver = "2" + +[workspace] + +[dependencies] +risc0-zkvm = { version = "1.1.2", default-features = false } +risc0-zkvm-platform = { version = "1.1.2" } + +anyhow = "1.0.68" +bitcoin-da = { path = "../../../../../crates/bitcoin-da", default-features = false } +citrea-light-client-prover = { path = "../../../../../crates/light-client-prover", default-features = false } +citrea-primitives = { path = "../../../../../crates/primitives" } +sov-modules-api = { path = "../../../../../crates/sovereign-sdk/module-system/sov-modules-api", default-features = false } +sov-modules-stf-blueprint = { path = "../../../../../crates/sovereign-sdk/module-system/sov-modules-stf-blueprint" } +sov-risc0-adapter = { path = "../../../../../crates/sovereign-sdk/adapters/risc0" } +sov-rollup-interface = { path = "../../../../../crates/sovereign-sdk/rollup-interface" } +sov-state = { path = "../../../../../crates/sovereign-sdk/module-system/sov-state" } + +[patch.crates-io] +sha2 = { git = "https://github.com/risc0/RustCrypto-hashes", tag = "sha2-v0.10.8-risczero.0" } +ed25519-dalek = { git = "https://github.com/risc0/curve25519-dalek", tag = "curve25519-4.1.2-risczero.0" } +crypto-bigint = { git = "https://github.com/risc0/RustCrypto-crypto-bigint", tag = "v0.5.5-risczero.0" } +secp256k1 = { git = "https://github.com/Sovereign-Labs/rust-secp256k1.git", branch = "risc0-compatible-0-29-0" } +k256 = { git = "https://github.com/risc0/RustCrypto-elliptic-curves", tag = "k256/v0.13.3-risczero.0" } + +[profile.release] +debug = 0 +lto = true +opt-level = 3 +codegen-units = 1 + +[features] +bench = [ + "sov-modules-api/bench", + "sov-state/bench", + "sov-modules-stf-blueprint/bench", +] diff --git a/bin/citrea/provers/risc0/light-client-prover-bitcoin/src/bin/light_client_prover_bitcoin.rs b/bin/citrea/provers/risc0/light-client-prover-bitcoin/src/bin/light_client_prover_bitcoin.rs new file mode 100644 index 0000000000..bb8d909cb9 --- /dev/null +++ b/bin/citrea/provers/risc0/light-client-prover-bitcoin/src/bin/light_client_prover_bitcoin.rs @@ -0,0 +1,53 @@ +#![no_main] +use bitcoin_da::spec::{BitcoinSpec, RollupParams}; +use bitcoin_da::verifier::BitcoinVerifier; +use citrea_light_client_prover::circuit::run_circuit; +use citrea_light_client_prover::input::LightClientCircuitInput; +use citrea_primitives::{REVEAL_BATCH_PROOF_PREFIX, REVEAL_LIGHT_CLIENT_PREFIX}; +#[cfg(feature = "bench")] +use risc0_zkvm::guest::env; +use sov_risc0_adapter::guest::Risc0Guest; +use sov_rollup_interface::da::DaVerifier; +use sov_rollup_interface::zk::ZkvmGuest; + +#[cfg(feature = "bench")] +fn report_bench_metrics(start_cycles: u64, end_cycles: u64) { + let cycles_per_block = end_cycles - start_cycles; + let tuple = ("Cycles per block".to_string(), cycles_per_block); + let mut serialized = Vec::new(); + serialized.extend(tuple.0.as_bytes()); + serialized.push(0); + let size_bytes = tuple.1.to_ne_bytes(); + serialized.extend(&size_bytes); + + // calculate the syscall name. + let name = c"cycle_metrics"; + let metrics_syscall_name = risc0_zkvm_platform::syscall::SyscallName::from_c_str(name).unwrap(); + + risc0_zkvm::guest::env::send_recv_slice::(metrics_syscall_name, &serialized); +} + +risc0_zkvm::guest::entry!(main); + +pub fn main() { + let guest = Risc0Guest::new(); + #[cfg(feature = "bench")] + let start_cycles = env::cycle_count(); + + let input: LightClientCircuitInput = guest.read_from_host(); + + let da_verifier = BitcoinVerifier::new(RollupParams { + reveal_batch_prover_prefix: REVEAL_BATCH_PROOF_PREFIX.to_vec(), + reveal_light_client_prefix: REVEAL_LIGHT_CLIENT_PREFIX.to_vec(), + }); + + let output = run_circuit::(input, da_verifier).unwrap(); + + guest.commit(&output); + + #[cfg(feature = "bench")] + { + let end_cycles = env::cycle_count(); + report_bench_metrics(start_cycles, end_cycles); + } +} diff --git a/bin/citrea/provers/risc0/light-client-prover-mock/Cargo.lock b/bin/citrea/provers/risc0/light-client-prover-mock/Cargo.lock new file mode 100644 index 0000000000..16f7efa801 --- /dev/null +++ b/bin/citrea/provers/risc0/light-client-prover-mock/Cargo.lock @@ -0,0 +1,3049 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "alloc-no-stdlib" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" +dependencies = [ + "alloc-no-stdlib", +] + +[[package]] +name = "allocator-api2" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" + +[[package]] +name = "alloy-chains" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94c225801d42099570d0674701dddd4142f0ef715282aeb5985042e2ec962df7" +dependencies = [ + "num_enum", + "serde", + "strum", +] + +[[package]] +name = "alloy-consensus" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04c309895995eaa4bfcc345f5515a39c7df9447798645cc8bf462b6c5bf1dc96" +dependencies = [ + "alloy-eips", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "serde", +] + +[[package]] +name = "alloy-eips" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9431c99a3b3fe606ede4b3d4043bdfbcb780c45b8d8d226c3804e2b75cfbe68" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "c-kzg", + "k256", + "once_cell", + "serde", + "sha2", +] + +[[package]] +name = "alloy-genesis" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79614dfe86144328da11098edcc7bc1a3f25ad8d3134a9eb9e857e06f0d9840d" +dependencies = [ + "alloy-primitives", + "alloy-serde", + "serde", +] + +[[package]] +name = "alloy-primitives" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccb3ead547f4532bc8af961649942f0b9c16ee9226e26caa3f38420651cc0bf4" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more", + "getrandom", + "hex-literal", + "itoa", + "k256", + "keccak-asm", + "proptest", + "rand", + "ruint", + "serde", + "tiny-keccak", +] + +[[package]] +name = "alloy-rlp" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26154390b1d205a4a7ac7352aa2eb4f81f391399d4e2f546fb81a2f8bb383f62" +dependencies = [ + "alloy-rlp-derive", + "arrayvec", + "bytes", +] + +[[package]] +name = "alloy-rlp-derive" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d0f2d905ebd295e7effec65e5f6868d153936130ae718352771de3e7d03c75c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "alloy-serde" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33feda6a53e6079895aed1d08dcb98a1377b000d80d16370fbbdb8155d547ef" +dependencies = [ + "alloy-primitives", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-trie" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03704f265cbbb943b117ecb5055fd46e8f41e7dc8a58b1aed20bcd40ace38c15" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "derive_more", + "hashbrown 0.14.5", + "nybbles", + "serde", + "smallvec", + "tracing", +] + +[[package]] +name = "anyhow" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" + +[[package]] +name = "ark-bn254" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-crypto-primitives" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3a13b34da09176a8baba701233fdffbaa7c1b1192ce031a3da4e55ce1f1a56" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-relations", + "ark-serialize 0.4.2", + "ark-snark", + "ark-std 0.4.0", + "blake2", + "derivative", + "digest 0.10.7", + "sha2", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff 0.4.2", + "ark-poly", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "hashbrown 0.13.2", + "itertools 0.10.5", + "num-traits", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b3235cc41ee7a12aaaf2c575a2ad7b46713a8a50bda2fc3b003a04845c05dd6" +dependencies = [ + "ark-ff-asm 0.3.0", + "ark-ff-macros 0.3.0", + "ark-serialize 0.3.0", + "ark-std 0.3.0", + "derivative", + "num-bigint", + "num-traits", + "paste", + "rustc_version 0.3.3", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm 0.4.2", + "ark-ff-macros 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "digest 0.10.7", + "itertools 0.10.5", + "num-bigint", + "num-traits", + "paste", + "rustc_version 0.4.1", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" +dependencies = [ + "num-bigint", + "num-traits", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-groth16" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20ceafa83848c3e390f1cbf124bc3193b3e639b3f02009e0e290809a501b95fc" +dependencies = [ + "ark-crypto-primitives", + "ark-ec", + "ark-ff 0.4.2", + "ark-poly", + "ark-relations", + "ark-serialize 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-relations" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00796b6efc05a3f48225e59cb6a2cda78881e7c390872d5786aaf112f31fb4f0" +dependencies = [ + "ark-ff 0.4.2", + "ark-std 0.4.0", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "ark-serialize" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671" +dependencies = [ + "ark-std 0.3.0", + "digest 0.9.0", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-serialize-derive", + "ark-std 0.4.0", + "digest 0.10.7", + "num-bigint", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-snark" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84d3cc6833a335bb8a600241889ead68ee89a3cf8448081fb7694c0fe503da63" +dependencies = [ + "ark-ff 0.4.2", + "ark-relations", + "ark-serialize 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-std" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "async-trait" +version = "0.1.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "auto_impl" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bcs" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85b6598a2f5d564fb7855dc6b06fd1c38cff5a72bd8b863a4d021938497b440a" +dependencies = [ + "serde", + "thiserror", +] + +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +dependencies = [ + "serde", +] + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "serde", + "tap", + "wyz", +] + +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "blake3" +version = "1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d82033247fd8e890df8f740e407ad4d038debb9eb1f40533fffb32e7d17dc6f7" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq", +] + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bls12_381" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7bc6d6292be3a19e6379786dac800f551e5865a5bb51ebbe3064ab80433f403" +dependencies = [ + "ff", + "group", + "pairing", + "rand_core", + "subtle", +] + +[[package]] +name = "blst" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4378725facc195f1a538864863f6de233b500a8862747e7f165078a419d5e874" +dependencies = [ + "cc", + "glob", + "threadpool", + "zeroize", +] + +[[package]] +name = "borsh" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed" +dependencies = [ + "borsh-derive", + "bytes", + "cfg_aliases", +] + +[[package]] +name = "borsh-derive" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b" +dependencies = [ + "once_cell", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.79", + "syn_derive", +] + +[[package]] +name = "brotli" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74f7971dbd9326d58187408ab83117d8ac1bb9c17b085fdacd1cf2f598719b6b" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a45bd2e4095a8b518033b128020dd4a55aab1c0a381ba4404a472630f4bc362" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + +[[package]] +name = "bytemuck" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc8b54b395f2fcfbb3d90c47b01c7f444d94d05bdeb775811dec868ac3bbc26" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" +dependencies = [ + "serde", +] + +[[package]] +name = "c-kzg" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0307f72feab3300336fb803a57134159f6e20139af1357f36c54cb90d8e8928" +dependencies = [ + "blst", + "cc", + "glob", + "hex", + "libc", + "once_cell", + "serde", +] + +[[package]] +name = "cc" +version = "1.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8d9e0b4957f635b8d3da819d0db5603620467ecf1f692d22a8c2717ce27e6d8" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "citrea-light-client-prover" +version = "0.5.0-rc.1" +dependencies = [ + "borsh", + "hex", + "sov-modules-api", + "sov-rollup-interface", +] + +[[package]] +name = "citrea-primitives" +version = "0.5.0-rc.1" +dependencies = [ + "alloy-eips", + "anyhow", + "brotli", + "reth-primitives", + "sov-rollup-interface", +] + +[[package]] +name = "const-hex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0121754e84117e65f9d90648ee6aa4882a6e63110307ab73967a4c5e7e69e586" +dependencies = [ + "cfg-if", + "cpufeatures", + "hex", + "proptest", + "serde", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "constant_time_eq" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics-types" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +dependencies = [ + "libc", +] + +[[package]] +name = "crc" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "git+https://github.com/risc0/RustCrypto-crypto-bigint?tag=v0.5.5-risczero.0#3ab63a6f1048833f7047d5a50532e4a4cc789384" +dependencies = [ + "generic-array", + "getrandom", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.2" +source = "git+https://github.com/risc0/curve25519-dalek?tag=curve25519-4.1.2-risczero.0#3dccc5b71b806f500e73829e2a5cbfe288cce2a0" +dependencies = [ + "cfg-if", + "cpufeatures", + "crypto-bigint", + "curve25519-dalek-derive", + "digest 0.10.7", + "fiat-crypto", + "hex", + "platforms", + "rustc_version 0.4.1", + "subtle", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "git+https://github.com/risc0/curve25519-dalek?tag=curve25519-4.1.2-risczero.0#3dccc5b71b806f500e73829e2a5cbfe288cce2a0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive_more" +version = "0.99.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" +dependencies = [ + "convert_case 0.4.0", + "proc-macro2", + "quote", + "rustc_version 0.4.1", + "syn 2.0.79", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "dyn-clone" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest 0.10.7", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "serde", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.1.1" +source = "git+https://github.com/risc0/curve25519-dalek?tag=curve25519-4.1.2-risczero.0#3dccc5b71b806f500e73829e2a5cbfe288cce2a0" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", +] + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "elf" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4445909572dbd556c457c849c4ca58623d84b27c8fff1e74b0b4227d8b90d17b" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest 0.10.7", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "enumn" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f9ed6b3789237c8a0c1c505af1c7eb2c560df6186f01b098c3a1064ea532f38" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "fastrand" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" + +[[package]] +name = "fastrlp" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139834ddba373bbdd213dffe02c8d110508dcf1726c2be27e8d1f7d7e1856418" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", +] + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "bitvec", + "rand_core", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "fixed-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" +dependencies = [ + "byteorder", + "rand", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "allocator-api2", + "serde", +] + +[[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] + +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "ics23" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18798160736c1e368938ba6967dbcb3c7afb3256b442a5506ba5222eebb68a5a" +dependencies = [ + "anyhow", + "blake2", + "blake3", + "bytes", + "hex", + "informalsystems-pbjson", + "prost", + "ripemd", + "serde", + "sha2", + "sha3", +] + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "indexmap" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +dependencies = [ + "equivalent", + "hashbrown 0.15.0", +] + +[[package]] +name = "informalsystems-pbjson" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aa4a0980c8379295100d70854354e78df2ee1c6ca0f96ffe89afeb3140e3a3d" +dependencies = [ + "base64", + "serde", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "jmt" +version = "0.10.0" +source = "git+https://github.com/penumbra-zone/jmt.git?rev=fd1c8ef#fd1c8ef99913663eb801576a9b13a31523861d87" +dependencies = [ + "anyhow", + "borsh", + "digest 0.10.7", + "hashbrown 0.13.2", + "hex", + "ics23", + "itertools 0.10.5", + "mirai-annotations", + "num-derive", + "num-traits", + "serde", + "sha2", + "thiserror", + "tracing", +] + +[[package]] +name = "k256" +version = "0.13.3" +source = "git+https://github.com/risc0/RustCrypto-elliptic-curves?tag=k256/v0.13.3-risczero.0#d4f457a04410397cbb652a67c168b6cd6e9757c4" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "keccak-asm" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "505d1856a39b200489082f90d897c3f07c455563880bc5952e38eabf731c83b6" +dependencies = [ + "digest 0.10.7", + "sha3-asm", +] + +[[package]] +name = "kzg-rs" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd9920cd4460ce3cbca19c62f3bb9a9611562478a4dc9d2c556f4a7d049c5b6b" +dependencies = [ + "bls12_381", + "glob", + "hex", + "once_cell", + "serde", + "serde_derive", + "serde_yaml", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.159" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "light-client-prover-mock" +version = "0.5.0-rc.1" +dependencies = [ + "anyhow", + "citrea-light-client-prover", + "citrea-primitives", + "risc0-zkvm", + "risc0-zkvm-platform", + "sov-mock-da", + "sov-modules-api", + "sov-modules-stf-blueprint", + "sov-risc0-adapter", + "sov-rollup-interface", + "sov-state", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "metal" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ecfd3296f8c56b7c1f6fbac3c71cefa9d78ce009850c45000015f206dc7fa21" +dependencies = [ + "bitflags 2.6.0", + "block", + "core-graphics-types", + "foreign-types", + "log", + "objc", + "paste", +] + +[[package]] +name = "mirai-annotations" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" + +[[package]] +name = "modular-bitfield" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a53d79ba8304ac1c4f9eb3b9d281f21f7be9d4626f72ce7df4ad8fbde4f38a74" +dependencies = [ + "modular-bitfield-impl", + "static_assertions", +] + +[[package]] +name = "modular-bitfield-impl" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a7d5f7076603ebc68de2dc6a650ec331a062a13abaa346975be747bbfa4b789" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "num_enum" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "nybbles" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95f06be0417d97f81fe4e5c86d7d01b392655a9cac9c19a848aa033e18937b23" +dependencies = [ + "alloy-rlp", + "const-hex", + "proptest", + "serde", + "smallvec", +] + +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", +] + +[[package]] +name = "once_cell" +version = "1.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" + +[[package]] +name = "pairing" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fec4625e73cf41ef4bb6846cafa6d44736525f442ba45e407c4a000a13996f" +dependencies = [ + "group", +] + +[[package]] +name = "parity-scale-codec" +version = "3.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee" +dependencies = [ + "arrayvec", + "bitvec", + "byte-slice-cast", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pest" +version = "2.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdbef9d1d47087a895abd220ed25eb4ad973a5e26f6a4367b038c25e28dfc2d9" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "platforms" +version = "3.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e4c7666f2019727f9e8e14bf14456e99c707d780922869f1ba473eee101fa49" + +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "primitive-types" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" +dependencies = [ + "fixed-hash", + "impl-codec", + "uint", +] + +[[package]] +name = "proc-macro-crate" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proptest" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" +dependencies = [ + "bit-set", + "bit-vec", + "bitflags 2.6.0", + "lazy_static", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax", + "rusty-fork", + "tempfile", + "unarray", +] + +[[package]] +name = "prost" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-derive" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" +dependencies = [ + "anyhow", + "itertools 0.12.1", + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_xorshift" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "reth-codecs" +version = "1.0.4" +source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-genesis", + "alloy-primitives", + "alloy-trie", + "bytes", + "modular-bitfield", + "reth-codecs-derive", + "serde", +] + +[[package]] +name = "reth-codecs-derive" +version = "1.0.4" +source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +dependencies = [ + "convert_case 0.6.0", + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "reth-ethereum-forks" +version = "1.0.4" +source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +dependencies = [ + "alloy-chains", + "alloy-primitives", + "alloy-rlp", + "auto_impl", + "crc", + "dyn-clone", + "once_cell", + "rustc-hash", + "serde", + "thiserror-no-std", +] + +[[package]] +name = "reth-primitives" +version = "1.0.4" +source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +dependencies = [ + "alloy-eips", + "alloy-genesis", + "alloy-primitives", + "alloy-rlp", + "bytes", + "derive_more", + "k256", + "once_cell", + "rayon", + "reth-ethereum-forks", + "reth-primitives-traits", + "reth-static-file-types", + "reth-trie-common", + "revm-primitives", + "serde", +] + +[[package]] +name = "reth-primitives-traits" +version = "1.0.4" +source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-genesis", + "alloy-primitives", + "alloy-rlp", + "byteorder", + "bytes", + "derive_more", + "modular-bitfield", + "reth-codecs", + "revm-primitives", + "roaring", + "serde", +] + +[[package]] +name = "reth-static-file-types" +version = "1.0.4" +source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +dependencies = [ + "alloy-primitives", + "derive_more", + "serde", + "strum", +] + +[[package]] +name = "reth-trie-common" +version = "1.0.4" +source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +dependencies = [ + "alloy-consensus", + "alloy-genesis", + "alloy-primitives", + "alloy-rlp", + "alloy-trie", + "bytes", + "derive_more", + "itertools 0.13.0", + "nybbles", + "reth-codecs", + "reth-primitives-traits", + "revm-primitives", + "serde", +] + +[[package]] +name = "revm-primitives" +version = "7.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fc4311037ee093ec50ec734e1424fcb3e12d535c6cef683b75d1c064639630c" +dependencies = [ + "alloy-eips", + "alloy-primitives", + "auto_impl", + "bitflags 2.6.0", + "bitvec", + "c-kzg", + "cfg-if", + "dyn-clone", + "enumn", + "hashbrown 0.14.5", + "hex", + "kzg-rs", + "serde", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "risc0-binfmt" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "543230f7117ce0e6b92b4797fbb3da722575973258cc38a48e28af8d3cf3a26d" +dependencies = [ + "anyhow", + "borsh", + "elf", + "risc0-zkp", + "risc0-zkvm-platform", + "serde", + "tracing", +] + +[[package]] +name = "risc0-circuit-recursion" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436c762db677faf2cd616c55a69012d6b4f46c426b7d553c1b3d717e0c7e9438" +dependencies = [ + "anyhow", + "bytemuck", + "hex", + "metal", + "risc0-core", + "risc0-zkp", + "tracing", +] + +[[package]] +name = "risc0-circuit-rv32im" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21f81638d4349eb5a816f3fd6ea12b314007572fc63d45cdb83891bed64e2a2a" +dependencies = [ + "anyhow", + "metal", + "risc0-binfmt", + "risc0-core", + "risc0-zkp", + "risc0-zkvm-platform", + "serde", + "tracing", +] + +[[package]] +name = "risc0-core" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1714b8968a5e4583a15018dc2ae95878c76f4cdbc643268a34670fde5b08252a" +dependencies = [ + "bytemuck", + "rand_core", +] + +[[package]] +name = "risc0-groth16" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5f11beecdcabeac264fb868e0b5db22c7e2db5fa2ce68fd482d8ab9ffb88e5d" +dependencies = [ + "anyhow", + "ark-bn254", + "ark-ec", + "ark-groth16", + "ark-serialize 0.4.2", + "bytemuck", + "hex", + "num-bigint", + "num-traits", + "risc0-binfmt", + "risc0-zkp", + "serde", +] + +[[package]] +name = "risc0-zkp" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "285aa3993827b4a646d70e68240e138f71574680a02d2e97ad30b1db80efda80" +dependencies = [ + "anyhow", + "blake2", + "borsh", + "bytemuck", + "cfg-if", + "digest 0.10.7", + "hex", + "hex-literal", + "metal", + "paste", + "rand_core", + "risc0-core", + "risc0-zkvm-platform", + "serde", + "sha2", + "tracing", +] + +[[package]] +name = "risc0-zkvm" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "614fad8046130321e3be9ca3a36d9edad6ff4c538549ae191ec4d82576bb3893" +dependencies = [ + "anyhow", + "borsh", + "bytemuck", + "getrandom", + "hex", + "risc0-binfmt", + "risc0-circuit-recursion", + "risc0-circuit-rv32im", + "risc0-core", + "risc0-groth16", + "risc0-zkp", + "risc0-zkvm-platform", + "rrs-lib", + "semver 1.0.23", + "serde", + "sha2", + "stability", + "tracing", +] + +[[package]] +name = "risc0-zkvm-platform" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6acf0b0d7a55578f892e0460ed1f2ca06d0380e32440531d80ca82530d41272" +dependencies = [ + "bytemuck", + "getrandom", + "libm", + "stability", +] + +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes", + "rustc-hex", +] + +[[package]] +name = "roaring" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f4b84ba6e838ceb47b41de5194a60244fac43d9fe03b71dbe8c5a201081d6d1" +dependencies = [ + "bytemuck", + "byteorder", +] + +[[package]] +name = "rrs-lib" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4382d3af3a4ebdae7f64ba6edd9114fff92c89808004c4943b393377a25d001" +dependencies = [ + "downcast-rs", + "paste", +] + +[[package]] +name = "rs_merkle" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b241d2e59b74ef9e98d94c78c47623d04c8392abaf82014dfd372a16041128f" +dependencies = [ + "sha2", +] + +[[package]] +name = "ruint" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3cc4c2511671f327125da14133d0c5c5d137f006a1017a16f557bc85b16286" +dependencies = [ + "alloy-rlp", + "ark-ff 0.3.0", + "ark-ff 0.4.2", + "bytes", + "fastrlp", + "num-bigint", + "num-traits", + "parity-scale-codec", + "primitive-types", + "proptest", + "rand", + "rlp", + "ruint-macro", + "serde", + "valuable", + "zeroize", +] + +[[package]] +name = "ruint-macro" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" + +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + +[[package]] +name = "rustc_version" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" +dependencies = [ + "semver 0.11.0", +] + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver 1.0.23", +] + +[[package]] +name = "rustix" +version = "0.38.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +dependencies = [ + "bitflags 2.6.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustversion" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" + +[[package]] +name = "rusty-fork" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" +dependencies = [ + "fnv", + "quick-error", + "tempfile", + "wait-timeout", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "schemars" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09c024468a378b7e36765cd36702b7a90cc3cba11654f6685c8f233408e89e92" +dependencies = [ + "dyn-clone", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1eee588578aff73f856ab961cd2f79e36bc45d7ded33a7562adba4667aecc0e" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 2.0.79", +] + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + +[[package]] +name = "semver-parser" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +dependencies = [ + "pest", +] + +[[package]] +name = "serde" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "serde_derive_internals" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "serde_json" +version = "1.0.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_yaml" +version = "0.9.34+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" +dependencies = [ + "indexmap", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "git+https://github.com/risc0/RustCrypto-hashes?tag=sha2-v0.10.8-risczero.0#244dc3b08788f7a4ccce14c66896ae3b4f24c166" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest 0.10.7", + "keccak", +] + +[[package]] +name = "sha3-asm" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28efc5e327c837aa837c59eae585fc250715ef939ac32881bcc11677cd02d46" +dependencies = [ + "cc", + "cfg-if", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest 0.10.7", + "rand_core", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +dependencies = [ + "serde", +] + +[[package]] +name = "sov-mock-da" +version = "0.5.0-rc.1" +dependencies = [ + "anyhow", + "async-trait", + "borsh", + "bytes", + "hex", + "serde", + "sha2", + "sov-rollup-interface", + "tracing", +] + +[[package]] +name = "sov-modules-api" +version = "0.5.0-rc.1" +dependencies = [ + "anyhow", + "bech32", + "borsh", + "derive_more", + "ed25519-dalek", + "hex", + "jmt", + "serde", + "sha2", + "sov-modules-core", + "sov-rollup-interface", + "sov-state", + "thiserror", +] + +[[package]] +name = "sov-modules-core" +version = "0.5.0-rc.1" +dependencies = [ + "anyhow", + "bech32", + "borsh", + "derive_more", + "digest 0.10.7", + "hex", + "jmt", + "schemars", + "serde", + "sha2", + "sov-rollup-interface", + "thiserror", +] + +[[package]] +name = "sov-modules-stf-blueprint" +version = "0.5.0-rc.1" +dependencies = [ + "anyhow", + "borsh", + "hex", + "itertools 0.13.0", + "jmt", + "risc0-zkvm", + "risc0-zkvm-platform", + "rs_merkle", + "serde", + "sov-modules-api", + "sov-rollup-interface", + "sov-state", + "sov-zk-cycle-macros", + "thiserror", +] + +[[package]] +name = "sov-risc0-adapter" +version = "0.5.0-rc.1" +dependencies = [ + "anyhow", + "bincode", + "borsh", + "bytemuck", + "risc0-zkvm", + "risc0-zkvm-platform", + "serde", + "sov-rollup-interface", +] + +[[package]] +name = "sov-rollup-interface" +version = "0.5.0-rc.1" +dependencies = [ + "anyhow", + "async-trait", + "borsh", + "bytes", + "digest 0.10.7", + "hex", + "proptest", + "serde", + "sha2", + "thiserror", +] + +[[package]] +name = "sov-state" +version = "0.5.0-rc.1" +dependencies = [ + "anyhow", + "bcs", + "borsh", + "hex", + "jmt", + "risc0-zkvm", + "risc0-zkvm-platform", + "serde", + "serde_json", + "sha2", + "sov-modules-core", + "sov-rollup-interface", + "sov-zk-cycle-macros", + "thiserror", +] + +[[package]] +name = "sov-zk-cycle-macros" +version = "0.5.0-rc.1" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "stability" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d904e7009df136af5297832a3ace3370cd14ff1546a232f4f185036c2736fcac" +dependencies = [ + "quote", + "syn 2.0.79", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strum" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.79", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn_derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tempfile" +version = "3.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +dependencies = [ + "cfg-if", + "fastrand", + "once_cell", + "rustix", + "windows-sys 0.59.0", +] + +[[package]] +name = "thiserror" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "thiserror-impl-no-std" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58e6318948b519ba6dc2b442a6d0b904ebfb8d411a3ad3e07843615a72249758" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "thiserror-no-std" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3ad459d94dd517257cc96add8a43190ee620011bb6e6cdc82dafd97dfafafea" +dependencies = [ + "thiserror-impl-no-std", +] + +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" + +[[package]] +name = "toml_edit" +version = "0.22.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +dependencies = [ + "indexmap", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-subscriber" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +dependencies = [ + "tracing-core", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + +[[package]] +name = "unsafe-libyaml" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wait-timeout" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +dependencies = [ + "libc", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +dependencies = [ + "memchr", +] + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] diff --git a/bin/citrea/provers/risc0/light-client-prover-mock/Cargo.toml b/bin/citrea/provers/risc0/light-client-prover-mock/Cargo.toml new file mode 100644 index 0000000000..dbb3f634eb --- /dev/null +++ b/bin/citrea/provers/risc0/light-client-prover-mock/Cargo.toml @@ -0,0 +1,41 @@ +[package] +name = "light-client-prover-mock" +version = "0.5.0-rc.1" +edition = "2021" +resolver = "2" + +[workspace] + +[dependencies] +risc0-zkvm = { version = "1.1.2", default-features = false } +risc0-zkvm-platform = { version = "1.1.2" } + +anyhow = "1.0.68" +sov-mock-da = { path = "../../../../../crates/sovereign-sdk/adapters/mock-da", default-features = false } + +citrea-light-client-prover = { path = "../../../../../crates/light-client-prover", default-features = false } +citrea-primitives = { path = "../../../../../crates/primitives" } +sov-modules-api = { path = "../../../../../crates/sovereign-sdk/module-system/sov-modules-api", default-features = false } +sov-modules-stf-blueprint = { path = "../../../../../crates/sovereign-sdk/module-system/sov-modules-stf-blueprint" } +sov-risc0-adapter = { path = "../../../../../crates/sovereign-sdk/adapters/risc0" } +sov-rollup-interface = { path = "../../../../../crates/sovereign-sdk/rollup-interface" } +sov-state = { path = "../../../../../crates/sovereign-sdk/module-system/sov-state" } + +[patch.crates-io] +sha2 = { git = "https://github.com/risc0/RustCrypto-hashes", tag = "sha2-v0.10.8-risczero.0" } +ed25519-dalek = { git = "https://github.com/risc0/curve25519-dalek", tag = "curve25519-4.1.2-risczero.0" } +crypto-bigint = { git = "https://github.com/risc0/RustCrypto-crypto-bigint", tag = "v0.5.5-risczero.0" } +k256 = { git = "https://github.com/risc0/RustCrypto-elliptic-curves", tag = "k256/v0.13.3-risczero.0" } + +[profile.release] +debug = 0 +lto = true +opt-level = 3 +codegen-units = 1 + +[features] +bench = [ + "sov-modules-api/bench", + "sov-state/bench", + "sov-modules-stf-blueprint/bench", +] diff --git a/bin/citrea/provers/risc0/light-client-prover-mock/src/bin/light_client_prover_mock.rs b/bin/citrea/provers/risc0/light-client-prover-mock/src/bin/light_client_prover_mock.rs new file mode 100644 index 0000000000..caa293f745 --- /dev/null +++ b/bin/citrea/provers/risc0/light-client-prover-mock/src/bin/light_client_prover_mock.rs @@ -0,0 +1,47 @@ +#![no_main] +use citrea_light_client_prover::circuit::run_circuit; +use citrea_light_client_prover::input::LightClientCircuitInput; +#[cfg(feature = "bench")] +use risc0_zkvm::guest::env; +use sov_mock_da::{MockDaSpec, MockDaVerifier}; +use sov_risc0_adapter::guest::Risc0Guest; +use sov_rollup_interface::zk::ZkvmGuest; + +#[cfg(feature = "bench")] +fn report_bench_metrics(start_cycles: u64, end_cycles: u64) { + let cycles_per_block = end_cycles - start_cycles; + let tuple = ("Cycles per block".to_string(), cycles_per_block); + let mut serialized = Vec::new(); + serialized.extend(tuple.0.as_bytes()); + serialized.push(0); + let size_bytes = tuple.1.to_ne_bytes(); + serialized.extend(&size_bytes); + + // calculate the syscall name. + let name = c"cycle_metrics"; + let metrics_syscall_name = risc0_zkvm_platform::syscall::SyscallName::from_c_str(name).unwrap(); + + risc0_zkvm::guest::env::send_recv_slice::(metrics_syscall_name, &serialized); +} + +risc0_zkvm::guest::entry!(main); + +pub fn main() { + let guest = Risc0Guest::new(); + #[cfg(feature = "bench")] + let start_cycles = env::cycle_count(); + + let input: LightClientCircuitInput = guest.read_from_host(); + + let da_verifier = MockDaVerifier {}; + + let output = run_circuit::(input, da_verifier).unwrap(); + + guest.commit(&output); + + #[cfg(feature = "bench")] + { + let end_cycles = env::cycle_count(); + report_bench_metrics(start_cycles, end_cycles); + } +} diff --git a/bin/citrea/src/main.rs b/bin/citrea/src/main.rs index 8a82322ccb..153836899c 100644 --- a/bin/citrea/src/main.rs +++ b/bin/citrea/src/main.rs @@ -3,7 +3,10 @@ use core::fmt::Debug as DebugTrait; use anyhow::Context as _; use bitcoin_da::service::BitcoinServiceConfig; use citrea::{initialize_logging, BitcoinRollup, CitreaRollupBlueprint, MockDemoRollup}; -use citrea_common::{from_toml_path, FromEnv, FullNodeConfig, ProverConfig, SequencerConfig}; +use citrea_common::{ + from_toml_path, BatchProverConfig, FromEnv, FullNodeConfig, LightClientProverConfig, + SequencerConfig, +}; use citrea_stf::genesis_config::GenesisPaths; use clap::Parser; use sov_mock_da::MockDaConfig; @@ -34,12 +37,16 @@ struct Args { rollup_config_path: Option, /// The option to run the node in sequencer mode, if a string is provided, it will be used as the path to the sequencer config, otherwise environment variables will be used. - #[arg(long, conflicts_with = "prover")] + #[arg(long, conflicts_with_all = ["batch_prover", "light_client_prover"])] sequencer: Option>, - /// The option to run the node in prover mode, if a string is provided, it will be used as the path to the prover config, otherwise the environment variables will be used. - #[arg(long, conflicts_with = "sequencer")] - prover: Option>, + /// The option to run the node in batch prover mode, if a string is provided, it will be used as the path to the batch prover config, otherwise the environment variables will be used. + #[arg(long, conflicts_with_all = ["sequencer", "light_client_prover"])] + batch_prover: Option>, + + /// The option to run the node in light client prover mode, if a string is provided, it will be used as the path to the light client prover config, otherwise the environment variables will be used. + #[arg(long, conflicts_with_all = ["sequencer", "batch_prover"])] + light_client_prover: Option>, /// Logging verbosity #[arg(long, short = 'v', action = clap::ArgAction::Count, default_value = "2")] @@ -83,21 +90,44 @@ async fn main() -> Result<(), anyhow::Error> { ), None => None, }; - let prover_config = match args.prover { + + let batch_prover_config = match args.batch_prover { Some(Some(path)) => Some( from_toml_path(path) .context("Failed to read prover configuration from the config file")?, ), Some(None) => Some( - ProverConfig::from_env() + BatchProverConfig::from_env() .context("Failed to read prover configuration from the environment")?, ), None => None, }; - if prover_config.is_some() && sequencer_config.is_some() { + let light_client_prover_config = match args.light_client_prover { + Some(Some(path)) => Some( + from_toml_path(path) + .context("Failed to read prover configuration from the config file")?, + ), + Some(None) => Some( + LightClientProverConfig::from_env() + .context("Failed to read prover configuration from the environment")?, + ), + None => None, + }; + + if batch_prover_config.is_some() && sequencer_config.is_some() { return Err(anyhow::anyhow!( - "Cannot run in both prover and sequencer mode at the same time" + "Cannot run in both batch prover and sequencer mode at the same time" + )); + } + if batch_prover_config.is_some() && light_client_prover_config.is_some() { + return Err(anyhow::anyhow!( + "Cannot run in both batch prover and light client prover mode at the same time" + )); + } + if light_client_prover_config.is_some() && sequencer_config.is_some() { + return Err(anyhow::anyhow!( + "Cannot run in both light client prover and sequencer mode at the same time" )); } @@ -106,7 +136,8 @@ async fn main() -> Result<(), anyhow::Error> { start_rollup::( &GenesisPaths::from_dir(&args.genesis_paths), args.rollup_config_path, - prover_config, + batch_prover_config, + light_client_prover_config, sequencer_config, ) .await?; @@ -115,7 +146,8 @@ async fn main() -> Result<(), anyhow::Error> { start_rollup::( &GenesisPaths::from_dir(&args.genesis_paths), args.rollup_config_path, - prover_config, + batch_prover_config, + light_client_prover_config, sequencer_config, ) .await?; @@ -132,7 +164,8 @@ async fn start_rollup( ::DaSpec, >>::GenesisPaths, rollup_config_path: Option, - prover_config: Option, + batch_prover_config: Option, + light_client_prover_config: Option, sequencer_config: Option, ) -> Result<(), anyhow::Error> where @@ -156,15 +189,26 @@ where if let Err(e) = sequencer_rollup.run().await { error!("Error: {}", e); } - } else if let Some(prover_config) = prover_config { - let prover = CitreaRollupBlueprint::create_new_prover( + } else if let Some(batch_prover_config) = batch_prover_config { + let prover = CitreaRollupBlueprint::create_new_batch_prover( &rollup_blueprint, rt_genesis_paths, rollup_config, - prover_config, + batch_prover_config, + ) + .await + .expect("Could not start batch prover"); + if let Err(e) = prover.run().await { + error!("Error: {}", e); + } + } else if let Some(light_client_prover_config) = light_client_prover_config { + let prover = CitreaRollupBlueprint::create_new_light_client_prover( + &rollup_blueprint, + rollup_config, + light_client_prover_config, ) .await - .expect("Coult not start prover"); + .expect("Could not start light client prover"); if let Err(e) = prover.run().await { error!("Error: {}", e); } diff --git a/bin/citrea/src/rollup/bitcoin.rs b/bin/citrea/src/rollup/bitcoin.rs index ae0d7529be..cf4ad94154 100644 --- a/bin/citrea/src/rollup/bitcoin.rs +++ b/bin/citrea/src/rollup/bitcoin.rs @@ -6,13 +6,13 @@ use bitcoin_da::service::{BitcoinService, BitcoinServiceConfig, TxidWrapper}; use bitcoin_da::spec::{BitcoinSpec, RollupParams}; use bitcoin_da::verifier::BitcoinVerifier; use citrea_common::rpc::register_healthcheck_rpc; -use citrea_common::{FullNodeConfig, ProverConfig}; +use citrea_common::{BatchProverConfig, FullNodeConfig, LightClientProverConfig}; use citrea_primitives::{REVEAL_BATCH_PROOF_PREFIX, REVEAL_LIGHT_CLIENT_PREFIX}; -use citrea_prover::prover_service::ParallelProverService; use citrea_risc0_bonsai_adapter::host::Risc0BonsaiHost; use citrea_risc0_bonsai_adapter::Digest; use citrea_stf::genesis_config::StorageConfig; use citrea_stf::runtime::Runtime; +use prover_services::ParallelProverService; use sov_db::ledger_db::LedgerDB; use sov_modules_api::default_context::{DefaultContext, ZkDefaultContext}; use sov_modules_api::{Address, Spec}; @@ -23,7 +23,7 @@ use sov_rollup_interface::da::DaVerifier; use sov_rollup_interface::services::da::SenderWithNotifier; use sov_rollup_interface::spec::SpecId; use sov_rollup_interface::zk::{Zkvm, ZkvmHost}; -use sov_state::{Storage, ZkStorage}; +use sov_state::ZkStorage; use tokio::sync::broadcast; use tokio::sync::mpsc::unbounded_channel; use tracing::instrument; @@ -51,8 +51,6 @@ impl RollupBlueprint for BitcoinRollup { type NativeRuntime = Runtime; type ProverService = ParallelProverService< - <::Storage as Storage>::Root, - <::Storage as Storage>::Witness, Self::DaService, Self::Vm, StfBlueprint::Guest, Self::ZkRuntime>, @@ -96,12 +94,22 @@ impl RollupBlueprint for BitcoinRollup { } #[instrument(level = "trace", skip(self), ret)] - fn get_code_commitments_by_spec(&self) -> HashMap::CodeCommitment> { + fn get_batch_prover_code_commitments_by_spec( + &self, + ) -> HashMap::CodeCommitment> { let mut map = HashMap::new(); - map.insert(SpecId::Genesis, Digest::new(citrea_risc0::BITCOIN_DA_ID)); + map.insert( + SpecId::Genesis, + Digest::new(citrea_risc0::BATCH_PROVER_BITCOIN_ID), + ); map } + #[instrument(level = "trace", skip(self), ret)] + fn get_light_client_prover_code_commitment(&self) -> ::CodeCommitment { + Digest::new(citrea_risc0::LIGHT_CLIENT_PROVER_BITCOIN_ID) + } + #[instrument(level = "trace", skip_all, err)] fn create_storage_manager( &self, @@ -154,15 +162,48 @@ impl RollupBlueprint for BitcoinRollup { } #[instrument(level = "trace", skip_all)] - async fn create_prover_service( + async fn create_batch_prover_service( + &self, + prover_config: BatchProverConfig, + _rollup_config: &FullNodeConfig, + _da_service: &Arc, + ledger_db: LedgerDB, + ) -> Self::ProverService { + let vm = Risc0BonsaiHost::new( + citrea_risc0::BATCH_PROVER_BITCOIN_ELF, + std::env::var("BONSAI_API_URL").unwrap_or("".to_string()), + std::env::var("BONSAI_API_KEY").unwrap_or("".to_string()), + ledger_db.clone(), + ); + let zk_stf = StfBlueprint::new(); + let zk_storage = ZkStorage::new(); + + let da_verifier = BitcoinVerifier::new(RollupParams { + reveal_light_client_prefix: REVEAL_LIGHT_CLIENT_PREFIX.to_vec(), + reveal_batch_prover_prefix: REVEAL_BATCH_PROOF_PREFIX.to_vec(), + }); + + ParallelProverService::new_with_default_workers( + vm, + zk_stf, + da_verifier, + prover_config.proving_mode, + zk_storage, + ledger_db, + ) + .expect("Should be able to instantiate prover service") + } + + #[instrument(level = "trace", skip_all)] + async fn create_light_client_prover_service( &self, - prover_config: ProverConfig, + prover_config: LightClientProverConfig, _rollup_config: &FullNodeConfig, _da_service: &Arc, ledger_db: LedgerDB, ) -> Self::ProverService { let vm = Risc0BonsaiHost::new( - citrea_risc0::BITCOIN_DA_ELF, + citrea_risc0::LIGHT_CLIENT_PROVER_BITCOIN_ELF, std::env::var("BONSAI_API_URL").unwrap_or("".to_string()), std::env::var("BONSAI_API_KEY").unwrap_or("".to_string()), ledger_db.clone(), @@ -179,7 +220,7 @@ impl RollupBlueprint for BitcoinRollup { vm, zk_stf, da_verifier, - prover_config, + prover_config.proving_mode, zk_storage, ledger_db, ) diff --git a/bin/citrea/src/rollup/mock.rs b/bin/citrea/src/rollup/mock.rs index 5419669a47..babd2ed611 100644 --- a/bin/citrea/src/rollup/mock.rs +++ b/bin/citrea/src/rollup/mock.rs @@ -3,12 +3,12 @@ use std::sync::Arc; use async_trait::async_trait; use citrea_common::rpc::register_healthcheck_rpc; -use citrea_common::{FullNodeConfig, ProverConfig}; -use citrea_prover::prover_service::ParallelProverService; +use citrea_common::{BatchProverConfig, FullNodeConfig, LightClientProverConfig}; use citrea_risc0_bonsai_adapter::host::Risc0BonsaiHost; use citrea_risc0_bonsai_adapter::Digest; use citrea_stf::genesis_config::StorageConfig; use citrea_stf::runtime::Runtime; +use prover_services::ParallelProverService; use sov_db::ledger_db::LedgerDB; use sov_mock_da::{MockDaConfig, MockDaService, MockDaSpec}; use sov_modules_api::default_context::{DefaultContext, ZkDefaultContext}; @@ -18,7 +18,7 @@ use sov_modules_stf_blueprint::StfBlueprint; use sov_prover_storage_manager::ProverStorageManager; use sov_rollup_interface::spec::SpecId; use sov_rollup_interface::zk::{Zkvm, ZkvmHost}; -use sov_state::{Storage, ZkStorage}; +use sov_state::ZkStorage; use tokio::sync::broadcast; use crate::CitreaRollupBlueprint; @@ -44,8 +44,6 @@ impl RollupBlueprint for MockDemoRollup { type NativeRuntime = Runtime; type ProverService = ParallelProverService< - <::Storage as Storage>::Root, - <::Storage as Storage>::Witness, Self::DaService, Self::Vm, StfBlueprint::Guest, Self::ZkRuntime>, @@ -86,12 +84,21 @@ impl RollupBlueprint for MockDemoRollup { Ok(rpc_methods) } - fn get_code_commitments_by_spec(&self) -> HashMap::CodeCommitment> { + fn get_batch_prover_code_commitments_by_spec( + &self, + ) -> HashMap::CodeCommitment> { let mut map = HashMap::new(); - map.insert(SpecId::Genesis, Digest::new(citrea_risc0::MOCK_DA_ID)); + map.insert( + SpecId::Genesis, + Digest::new(citrea_risc0::BATCH_PROVER_MOCK_ID), + ); map } + fn get_light_client_prover_code_commitment(&self) -> ::CodeCommitment { + Digest::new(citrea_risc0::LIGHT_CLIENT_PROVER_MOCK_ID) + } + async fn create_da_service( &self, rollup_config: &FullNodeConfig, @@ -103,15 +110,43 @@ impl RollupBlueprint for MockDemoRollup { ))) } - async fn create_prover_service( + async fn create_batch_prover_service( + &self, + prover_config: BatchProverConfig, + _rollup_config: &FullNodeConfig, + _da_service: &Arc, + ledger_db: LedgerDB, + ) -> Self::ProverService { + let vm = Risc0BonsaiHost::new( + citrea_risc0::BATCH_PROVER_MOCK_ELF, + std::env::var("BONSAI_API_URL").unwrap_or("".to_string()), + std::env::var("BONSAI_API_KEY").unwrap_or("".to_string()), + ledger_db.clone(), + ); + let zk_stf = StfBlueprint::new(); + let zk_storage = ZkStorage::new(); + let da_verifier = Default::default(); + + ParallelProverService::new_with_default_workers( + vm, + zk_stf, + da_verifier, + prover_config.proving_mode, + zk_storage, + ledger_db, + ) + .expect("Should be able to instantiate prover service") + } + + async fn create_light_client_prover_service( &self, - prover_config: ProverConfig, + prover_config: LightClientProverConfig, _rollup_config: &FullNodeConfig, _da_service: &Arc, ledger_db: LedgerDB, ) -> Self::ProverService { let vm = Risc0BonsaiHost::new( - citrea_risc0::MOCK_DA_ELF, + citrea_risc0::LIGHT_CLIENT_PROVER_MOCK_ELF, std::env::var("BONSAI_API_URL").unwrap_or("".to_string()), std::env::var("BONSAI_API_KEY").unwrap_or("".to_string()), ledger_db.clone(), @@ -124,7 +159,7 @@ impl RollupBlueprint for MockDemoRollup { vm, zk_stf, da_verifier, - prover_config, + prover_config.proving_mode, zk_storage, ledger_db, ) diff --git a/bin/citrea/src/rollup/mod.rs b/bin/citrea/src/rollup/mod.rs index ce9fa52451..8ba87930f2 100644 --- a/bin/citrea/src/rollup/mod.rs +++ b/bin/citrea/src/rollup/mod.rs @@ -2,10 +2,11 @@ use std::sync::Arc; use anyhow::anyhow; use async_trait::async_trait; -use citrea_common::{FullNodeConfig, ProverConfig, SequencerConfig}; +use citrea_batch_prover::{BatchProver, CitreaBatchProver}; +use citrea_common::{BatchProverConfig, FullNodeConfig, LightClientProverConfig, SequencerConfig}; use citrea_fullnode::{CitreaFullnode, FullNode}; +use citrea_light_client_prover::runner::{CitreaLightClientProver, LightClientProver}; use citrea_primitives::forks::FORKS; -use citrea_prover::{CitreaProver, Prover}; use citrea_sequencer::{CitreaSequencer, Sequencer}; use sov_db::ledger_db::migrations::LedgerDBMigrator; use sov_db::ledger_db::SharedLedgerOps; @@ -215,7 +216,7 @@ pub trait CitreaRollupBlueprint: RollupBlueprint { } }; - let code_commitments_by_spec = self.get_code_commitments_by_spec(); + let code_commitments_by_spec = self.get_batch_prover_code_commitments_by_spec(); let current_l2_height = ledger_db .get_head_soft_confirmation() @@ -248,15 +249,15 @@ pub trait CitreaRollupBlueprint: RollupBlueprint { /// Creates a new prover #[instrument(level = "trace", skip_all)] - async fn create_new_prover( + async fn create_new_batch_prover( &self, runtime_genesis_paths: &>::GenesisPaths, rollup_config: FullNodeConfig, - prover_config: ProverConfig, - ) -> Result, anyhow::Error> + prover_config: BatchProverConfig, + ) -> Result, anyhow::Error> where ::Storage: NativeStorage, { @@ -265,7 +266,7 @@ pub trait CitreaRollupBlueprint: RollupBlueprint { // Migrate before constructing ledger_db instance so that no lock is present. let migrator = LedgerDBMigrator::new( rollup_config.storage.path.as_path(), - citrea_prover::db_migrations::migrations(), + citrea_batch_prover::db_migrations::migrations(), ); migrator.migrate(rollup_config.storage.db_max_open_files)?; @@ -276,7 +277,7 @@ pub trait CitreaRollupBlueprint: RollupBlueprint { let ledger_db = self.create_ledger_db(&rocksdb_config); let prover_service = self - .create_prover_service( + .create_batch_prover_service( prover_config.clone(), &rollup_config, &da_service, @@ -335,7 +336,7 @@ pub trait CitreaRollupBlueprint: RollupBlueprint { } }; - let code_commitments_by_spec = self.get_code_commitments_by_spec(); + let code_commitments_by_spec = self.get_batch_prover_code_commitments_by_spec(); let current_l2_height = ledger_db .get_head_soft_confirmation() @@ -346,7 +347,7 @@ pub trait CitreaRollupBlueprint: RollupBlueprint { let mut fork_manager = ForkManager::new(FORKS.to_vec(), current_l2_height.0); fork_manager.register_handler(Box::new(ledger_db.clone())); - let runner = CitreaProver::new( + let runner = CitreaBatchProver::new( runner_config, rollup_config.public_keys, rollup_config.rpc, @@ -362,7 +363,82 @@ pub trait CitreaRollupBlueprint: RollupBlueprint { soft_confirmation_tx, )?; - Ok(Prover { + Ok(BatchProver { + runner, + rpc_methods, + }) + } + + /// Creates a new light client prover + #[instrument(level = "trace", skip_all)] + async fn create_new_light_client_prover( + &self, + rollup_config: FullNodeConfig, + prover_config: LightClientProverConfig, + ) -> Result, anyhow::Error> + where + ::Storage: NativeStorage, + { + let da_service = self.create_da_service(&rollup_config, true).await?; + + let rocksdb_config = RocksdbConfig::new( + rollup_config.storage.path.as_path(), + rollup_config.storage.db_max_open_files, + ); + let ledger_db = self.create_ledger_db(&rocksdb_config); + + let prover_service = self + .create_light_client_prover_service( + prover_config.clone(), + &rollup_config, + &da_service, + ledger_db.clone(), + ) + .await; + + // TODO: Double check what kind of storage needed here. + // Maybe whole "prev_root" can be initialized inside runner + // Getting block here, so prover_service doesn't have to be `Send` + + let mut storage_manager = self.create_storage_manager(&rollup_config)?; + let prover_storage = storage_manager.create_finalized_storage()?; + + let runner_config = rollup_config.runner.expect("Runner config is missing"); + // TODO(https://github.com/Sovereign-Labs/sovereign-sdk/issues/1218) + let rpc_methods = self.create_rpc_methods( + &prover_storage, + &ledger_db, + &da_service, + Some(runner_config.sequencer_client_url.clone()), + None, + )?; + + let batch_prover_code_commitments_by_spec = + self.get_batch_prover_code_commitments_by_spec(); + let light_client_prover_code_commitment = self.get_light_client_prover_code_commitment(); + + let current_l2_height = ledger_db + .get_head_soft_confirmation() + .map_err(|e| anyhow!("Failed to get head soft confirmation: {}", e))? + .map(|(l2_height, _)| l2_height) + .unwrap_or(BatchNumber(0)); + + let mut fork_manager = ForkManager::new(FORKS.to_vec(), current_l2_height.0); + fork_manager.register_handler(Box::new(ledger_db.clone())); + + let runner = CitreaLightClientProver::new( + runner_config, + rollup_config.public_keys, + rollup_config.rpc, + da_service, + ledger_db, + Arc::new(prover_service), + prover_config, + batch_prover_code_commitments_by_spec, + light_client_prover_code_commitment, + )?; + + Ok(LightClientProver { runner, rpc_methods, }) diff --git a/bin/citrea/tests/bitcoin_e2e/prover_test.rs b/bin/citrea/tests/bitcoin_e2e/batch_prover_test.rs similarity index 99% rename from bin/citrea/tests/bitcoin_e2e/prover_test.rs rename to bin/citrea/tests/bitcoin_e2e/batch_prover_test.rs index 5293a5d650..b2411fb719 100644 --- a/bin/citrea/tests/bitcoin_e2e/prover_test.rs +++ b/bin/citrea/tests/bitcoin_e2e/batch_prover_test.rs @@ -49,7 +49,7 @@ impl TestCase for BasicProverTest { }; let Some(batch_prover) = &f.batch_prover else { - bail!("Batch Prover not running. Set TestCaseConfig with_prover to true") + bail!("Batch Prover not running. Set TestCaseConfig with_batch_prover to true") }; let Some(full_node) = &f.full_node else { @@ -77,6 +77,7 @@ impl TestCase for BasicProverTest { da.generate(FINALITY_DEPTH, None).await?; let finalized_height = da.get_finalized_height().await?; + batch_prover .wait_for_l1_height(finalized_height, None) .await?; @@ -140,7 +141,7 @@ impl TestCase for SkipPreprovenCommitmentsTest { }; let Some(prover) = &f.batch_prover else { - bail!("Batch Prover not running. Set TestCaseConfig with_prover to true") + bail!("Batch Prover not running. Set TestCaseConfig with_batch_prover to true") }; let Some(full_node) = &f.full_node else { diff --git a/bin/citrea/tests/bitcoin_e2e/light_client_test.rs b/bin/citrea/tests/bitcoin_e2e/light_client_test.rs new file mode 100644 index 0000000000..0addb621d2 --- /dev/null +++ b/bin/citrea/tests/bitcoin_e2e/light_client_test.rs @@ -0,0 +1,110 @@ +use std::time::Duration; + +use async_trait::async_trait; +use bitcoin_da::service::FINALITY_DEPTH; +use bitcoincore_rpc::RpcApi; +use citrea_e2e::config::{ + BatchProverConfig, LightClientProverConfig, SequencerConfig, TestCaseConfig, +}; +use citrea_e2e::framework::TestFramework; +use citrea_e2e::test_case::{TestCase, TestCaseRunner}; +use citrea_e2e::Result; + +const TEN_MINS: Duration = Duration::from_secs(10 * 60); + +struct LightClientProvingTest; + +#[async_trait] +impl TestCase for LightClientProvingTest { + fn test_config() -> TestCaseConfig { + TestCaseConfig { + with_sequencer: true, + with_batch_prover: true, + with_light_client_prover: true, + ..Default::default() + } + } + fn sequencer_config() -> SequencerConfig { + SequencerConfig { + min_soft_confirmations_per_commitment: 5, + da_update_interval_ms: 500, + ..Default::default() + } + } + + fn batch_prover_config() -> BatchProverConfig { + BatchProverConfig { + enable_recovery: false, + ..Default::default() + } + } + + fn light_client_prover_config() -> LightClientProverConfig { + LightClientProverConfig { + enable_recovery: false, + ..Default::default() + } + } + + async fn run_test(&mut self, f: &mut TestFramework) -> Result<()> { + let da = f.bitcoin_nodes.get(0).unwrap(); + let sequencer = f.sequencer.as_ref().unwrap(); + let batch_prover = f.batch_prover.as_ref().unwrap(); + let light_client_prover = f.light_client_prover.as_ref().unwrap(); + + let min_soft_confirmations_per_commitment = + sequencer.min_soft_confirmations_per_commitment(); + + // publish min_soft_confirmations_per_commitment confirmations + for _ in 0..min_soft_confirmations_per_commitment { + sequencer.client.send_publish_batch_request().await?; + } + sequencer + .wait_for_l2_height(min_soft_confirmations_per_commitment, None) + .await?; + + // Wait for commitment tx to be submitted to DA + da.wait_mempool_len(1, Some(TEN_MINS)).await.unwrap(); + + // Finalize the DA block which contains the commitment tx + da.generate(FINALITY_DEPTH, None).await.unwrap(); + + let commitment_l1_height = da.get_finalized_height().await.unwrap(); + + // Wait for batch prover to generate proof for commitment + batch_prover + .wait_for_l1_height(commitment_l1_height, Some(TEN_MINS)) + .await + .unwrap(); + + // Assert that commitment is queryable + let commitments = batch_prover + .client + .ledger_get_sequencer_commitments_on_slot_by_number(commitment_l1_height) + .await + .unwrap() + .unwrap(); + assert_eq!(commitments.len(), 1); + + // Ensure that batch proof is submitted to DA + da.wait_mempool_len(1, Some(TEN_MINS)).await.unwrap(); + + // Finalize the DA block which contains the batch proof tx + da.generate(FINALITY_DEPTH, None).await.unwrap(); + + let batch_proof_l1_height = da.get_finalized_height().await.unwrap(); + + // Wait for light client prover to process batch proofs. + light_client_prover + .wait_for_l1_height(batch_proof_l1_height, Some(TEN_MINS)) + .await + .unwrap(); + + Ok(()) + } +} + +#[tokio::test] +async fn test_light_client_proving() -> Result<()> { + TestCaseRunner::new(LightClientProvingTest).run().await +} diff --git a/bin/citrea/tests/bitcoin_e2e/mod.rs b/bin/citrea/tests/bitcoin_e2e/mod.rs index bfff52b134..1543d444bd 100644 --- a/bin/citrea/tests/bitcoin_e2e/mod.rs +++ b/bin/citrea/tests/bitcoin_e2e/mod.rs @@ -1,8 +1,9 @@ use std::path::PathBuf; +pub mod batch_prover_test; pub mod bitcoin_test; +pub mod light_client_test; // pub mod mempool_accept; -pub mod prover_test; pub mod sequencer_commitments; pub mod sequencer_test; pub mod tx_chain; diff --git a/bin/citrea/tests/e2e/mod.rs b/bin/citrea/tests/e2e/mod.rs index 867aa4fb35..0f7d9bec8e 100644 --- a/bin/citrea/tests/e2e/mod.rs +++ b/bin/citrea/tests/e2e/mod.rs @@ -11,7 +11,7 @@ use std::path::{Path, PathBuf}; use std::str::FromStr; use std::time::Duration; -use citrea_common::{ProverConfig, SequencerConfig}; +use citrea_common::{BatchProverConfig, SequencerConfig}; use citrea_evm::smart_contracts::SimpleStorageContract; use citrea_stf::genesis_config::GenesisPaths; use reth_primitives::{Address, BlockNumberOrTag, U256}; @@ -71,6 +71,7 @@ async fn test_all_flow() { seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) @@ -89,11 +90,12 @@ async fn test_all_flow() { start_rollup( prover_node_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), - Some(ProverConfig { + Some(BatchProverConfig { proving_mode: sov_stf_runner::ProverGuestRunConfig::Execute, proof_sampling_number: 0, enable_recovery: true, }), + None, rollup_config, None, ) @@ -117,6 +119,7 @@ async fn test_all_flow() { full_node_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, None, ) @@ -381,6 +384,7 @@ async fn test_ledger_get_head_soft_confirmation() { seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) @@ -449,6 +453,7 @@ async fn initialize_test( seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) @@ -471,6 +476,7 @@ async fn initialize_test( full_node_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, None, ) diff --git a/bin/citrea/tests/e2e/proving.rs b/bin/citrea/tests/e2e/proving.rs index 4a16c40859..f935f9737f 100644 --- a/bin/citrea/tests/e2e/proving.rs +++ b/bin/citrea/tests/e2e/proving.rs @@ -1,7 +1,7 @@ /// Prover node, proving and full node proof verification related tests use std::time::Duration; -use citrea_common::{ProverConfig, SequencerConfig}; +use citrea_common::{BatchProverConfig, SequencerConfig}; use citrea_stf::genesis_config::GenesisPaths; use sov_mock_da::{MockAddress, MockDaService}; use sov_rollup_interface::rpc::SoftConfirmationStatus; @@ -38,6 +38,7 @@ async fn full_node_verify_proof_and_store() { seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) @@ -58,11 +59,12 @@ async fn full_node_verify_proof_and_store() { start_rollup( prover_node_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), - Some(ProverConfig { + Some(BatchProverConfig { proving_mode: sov_stf_runner::ProverGuestRunConfig::Execute, proof_sampling_number: 0, enable_recovery: true, }), + None, rollup_config, None, ) @@ -86,6 +88,7 @@ async fn full_node_verify_proof_and_store() { full_node_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, None, ) @@ -209,6 +212,7 @@ async fn test_prover_prove_rpc() { seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) @@ -229,12 +233,13 @@ async fn test_prover_prove_rpc() { start_rollup( prover_node_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), - Some(ProverConfig { + Some(BatchProverConfig { proving_mode: sov_stf_runner::ProverGuestRunConfig::Execute, // Make it impossible for proving to happen proof_sampling_number: 1_000_000, enable_recovery: true, }), + None, rollup_config, None, ) @@ -258,6 +263,7 @@ async fn test_prover_prove_rpc() { full_node_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, None, ) diff --git a/bin/citrea/tests/e2e/reopen.rs b/bin/citrea/tests/e2e/reopen.rs index a82cf6e83a..b95fd9f1dd 100644 --- a/bin/citrea/tests/e2e/reopen.rs +++ b/bin/citrea/tests/e2e/reopen.rs @@ -4,7 +4,7 @@ use std::str::FromStr; use std::time::Duration; -use citrea_common::{ProverConfig, SequencerConfig}; +use citrea_common::{BatchProverConfig, SequencerConfig}; use citrea_stf::genesis_config::GenesisPaths; use reth_primitives::{Address, BlockNumberOrTag}; use sov_db::ledger_db::migrations::copy_db_dir_recursive; @@ -37,6 +37,7 @@ async fn test_reopen_full_node() -> Result<(), anyhow::Error> { seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) @@ -59,6 +60,7 @@ async fn test_reopen_full_node() -> Result<(), anyhow::Error> { full_node_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, None, ) @@ -138,6 +140,7 @@ async fn test_reopen_full_node() -> Result<(), anyhow::Error> { full_node_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, None, ) @@ -192,6 +195,7 @@ async fn test_reopen_sequencer() -> Result<(), anyhow::Error> { seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) @@ -235,6 +239,7 @@ async fn test_reopen_sequencer() -> Result<(), anyhow::Error> { seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) @@ -298,6 +303,7 @@ async fn test_reopen_prover() -> Result<(), anyhow::Error> { seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) @@ -327,7 +333,8 @@ async fn test_reopen_prover() -> Result<(), anyhow::Error> { start_rollup( prover_node_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), - Some(ProverConfig::default()), + Some(BatchProverConfig::default()), + None, rollup_config, None, ) @@ -395,7 +402,8 @@ async fn test_reopen_prover() -> Result<(), anyhow::Error> { start_rollup( prover_node_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), - Some(ProverConfig::default()), + Some(BatchProverConfig::default()), + None, rollup_config, None, ) @@ -447,7 +455,8 @@ async fn test_reopen_prover() -> Result<(), anyhow::Error> { start_rollup( prover_node_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), - Some(ProverConfig::default()), + Some(BatchProverConfig::default()), + None, rollup_config, None, ) diff --git a/bin/citrea/tests/e2e/sequencer_behaviour.rs b/bin/citrea/tests/e2e/sequencer_behaviour.rs index 0f7e536b4a..51d80c88d3 100644 --- a/bin/citrea/tests/e2e/sequencer_behaviour.rs +++ b/bin/citrea/tests/e2e/sequencer_behaviour.rs @@ -48,6 +48,7 @@ async fn test_sequencer_fill_missing_da_blocks() -> Result<(), anyhow::Error> { seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) @@ -150,6 +151,7 @@ async fn test_sequencer_commitment_threshold() { seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) @@ -352,6 +354,7 @@ async fn test_gas_limit_too_high() { seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) @@ -374,6 +377,7 @@ async fn test_gas_limit_too_high() { full_node_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, None, ) @@ -483,6 +487,7 @@ async fn test_system_tx_effect_on_block_gas_limit() -> Result<(), anyhow::Error> "../../resources/test-data/integration-tests-low-block-gas-limit", ), None, + None, rollup_config, Some(sequencer_config), ) diff --git a/bin/citrea/tests/e2e/sequencer_replacement.rs b/bin/citrea/tests/e2e/sequencer_replacement.rs index 29d20d1c72..7fd5932f88 100644 --- a/bin/citrea/tests/e2e/sequencer_replacement.rs +++ b/bin/citrea/tests/e2e/sequencer_replacement.rs @@ -52,6 +52,7 @@ async fn test_sequencer_crash_and_replace_full_node() -> Result<(), anyhow::Erro seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(config1), ) @@ -75,6 +76,7 @@ async fn test_sequencer_crash_and_replace_full_node() -> Result<(), anyhow::Erro full_node_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, None, ) @@ -131,6 +133,7 @@ async fn test_sequencer_crash_and_replace_full_node() -> Result<(), anyhow::Erro seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(config1), ) @@ -197,6 +200,7 @@ async fn test_sequencer_crash_restore_mempool() -> Result<(), anyhow::Error> { seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(config1), ) @@ -274,6 +278,7 @@ async fn test_sequencer_crash_restore_mempool() -> Result<(), anyhow::Error> { seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(config1), ) @@ -370,6 +375,7 @@ async fn test_soft_confirmation_save() -> Result<(), anyhow::Error> { seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) @@ -392,6 +398,7 @@ async fn test_soft_confirmation_save() -> Result<(), anyhow::Error> { full_node_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, None, ) @@ -414,6 +421,7 @@ async fn test_soft_confirmation_save() -> Result<(), anyhow::Error> { full_node_port_tx_2, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, None, ) diff --git a/bin/citrea/tests/e2e/syncing.rs b/bin/citrea/tests/e2e/syncing.rs index 0a36535d77..e0cd08fe99 100644 --- a/bin/citrea/tests/e2e/syncing.rs +++ b/bin/citrea/tests/e2e/syncing.rs @@ -2,7 +2,7 @@ use std::str::FromStr; use std::time::Duration; -use citrea_common::{ProverConfig, SequencerConfig}; +use citrea_common::{BatchProverConfig, SequencerConfig}; use citrea_stf::genesis_config::GenesisPaths; use ethereum_rpc::LayerStatus; use reth_primitives::{Address, BlockNumberOrTag}; @@ -45,6 +45,7 @@ async fn test_delayed_sync_ten_blocks() -> Result<(), anyhow::Error> { seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) @@ -79,6 +80,7 @@ async fn test_delayed_sync_ten_blocks() -> Result<(), anyhow::Error> { full_node_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, None, ) @@ -274,6 +276,7 @@ async fn test_prover_sync_with_commitments() -> Result<(), anyhow::Error> { seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) @@ -291,11 +294,12 @@ async fn test_prover_sync_with_commitments() -> Result<(), anyhow::Error> { start_rollup( prover_node_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), - Some(ProverConfig { + Some(BatchProverConfig { proving_mode: sov_stf_runner::ProverGuestRunConfig::Execute, proof_sampling_number: 0, enable_recovery: true, }), + None, rollup_config, None, ) @@ -373,7 +377,11 @@ async fn test_prover_sync_with_commitments() -> Result<(), anyhow::Error> { let data: DaDataLightClient = borsh::BorshDeserialize::try_from_slice(da_data).unwrap(); // Test we got zkproof indeed - let DaDataLightClient::ZKProof(_proof) = data; + let DaDataLightClient::Complete(_proof) = data else { + return Err(anyhow::anyhow!( + "Expected completed zkproof, got chunks or aggregate" + )); + }; // TODO: Also test with multiple commitments in single Mock DA Block seq_task.abort(); @@ -405,6 +413,7 @@ async fn test_full_node_sync_status() { seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) @@ -439,6 +448,7 @@ async fn test_full_node_sync_status() { full_node_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, None, ) @@ -518,6 +528,7 @@ async fn test_healthcheck() { seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) @@ -540,6 +551,7 @@ async fn test_healthcheck() { full_node_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, None, ) diff --git a/bin/citrea/tests/e2e/tx_propagation.rs b/bin/citrea/tests/e2e/tx_propagation.rs index f6557e9d0d..537641899b 100644 --- a/bin/citrea/tests/e2e/tx_propagation.rs +++ b/bin/citrea/tests/e2e/tx_propagation.rs @@ -91,6 +91,7 @@ async fn test_get_transaction_by_hash() -> Result<(), anyhow::Error> { seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) @@ -112,6 +113,7 @@ async fn test_get_transaction_by_hash() -> Result<(), anyhow::Error> { full_node_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, None, ) diff --git a/bin/citrea/tests/evm/archival_state.rs b/bin/citrea/tests/evm/archival_state.rs index be76071e6f..d271050267 100644 --- a/bin/citrea/tests/evm/archival_state.rs +++ b/bin/citrea/tests/evm/archival_state.rs @@ -33,6 +33,7 @@ async fn test_archival_state() -> Result<(), anyhow::Error> { seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) diff --git a/bin/citrea/tests/evm/fee.rs b/bin/citrea/tests/evm/fee.rs index 94e7fdcba0..5dae7331a7 100644 --- a/bin/citrea/tests/evm/fee.rs +++ b/bin/citrea/tests/evm/fee.rs @@ -28,6 +28,7 @@ async fn test_minimum_base_fee() -> Result<(), anyhow::Error> { port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) diff --git a/bin/citrea/tests/evm/gas_price.rs b/bin/citrea/tests/evm/gas_price.rs index 83ecffb5bc..1ce08c39b1 100644 --- a/bin/citrea/tests/evm/gas_price.rs +++ b/bin/citrea/tests/evm/gas_price.rs @@ -35,6 +35,7 @@ async fn test_gas_price_increase() -> Result<(), anyhow::Error> { port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) diff --git a/bin/citrea/tests/evm/mod.rs b/bin/citrea/tests/evm/mod.rs index 309ee4905e..2c9dbcce1b 100644 --- a/bin/citrea/tests/evm/mod.rs +++ b/bin/citrea/tests/evm/mod.rs @@ -44,6 +44,7 @@ async fn web3_rpc_tests() -> Result<(), anyhow::Error> { port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequener_config), ) @@ -99,6 +100,7 @@ async fn evm_tx_tests() -> Result<(), anyhow::Error> { port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) @@ -134,6 +136,7 @@ async fn test_eth_get_logs() -> Result<(), anyhow::Error> { port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) @@ -170,6 +173,7 @@ async fn test_genesis_contract_call() -> Result<(), Box> seq_port_tx, GenesisPaths::from_dir("../../resources/genesis/mock-dockerized/"), None, + None, rollup_config, Some(sequencer_config), ) diff --git a/bin/citrea/tests/evm/subscription.rs b/bin/citrea/tests/evm/subscription.rs index 2a0b48e2b0..f586729724 100644 --- a/bin/citrea/tests/evm/subscription.rs +++ b/bin/citrea/tests/evm/subscription.rs @@ -42,6 +42,7 @@ async fn test_eth_subscriptions() -> Result<(), Box> { port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) diff --git a/bin/citrea/tests/evm/tracing.rs b/bin/citrea/tests/evm/tracing.rs index de08e14118..a632c81509 100644 --- a/bin/citrea/tests/evm/tracing.rs +++ b/bin/citrea/tests/evm/tracing.rs @@ -36,6 +36,7 @@ async fn tracing_tests() -> Result<(), Box> { port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) @@ -116,14 +117,14 @@ async fn tracing_tests() -> Result<(), Box> { // It was replaced with the gas limit in our trace. let reth_json = serde_json::from_value::(json![{ "from": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", - "gas": "0x6a7d", + "gas": "0x679c", "gasUsed": "0xba65", "to": "0xe7f1725e7734ce288f8367e1bb143e90bb3f0512", "input": "0xb7d5b6580000000000000000000000005fbdb2315678afecb367f032d93f642f64180aa30000000000000000000000000000000000000000000000000000000000000003", "calls": [ { "from": "0xe7f1725e7734ce288f8367e1bb143e90bb3f0512", - "gas": "0x5b09", + "gas": "0x5833", "gasUsed": "0x57f2", "to": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "input": "0x60fe47b10000000000000000000000000000000000000000000000000000000000000003", @@ -178,7 +179,7 @@ async fn tracing_tests() -> Result<(), Box> { .await; let expected_send_eth_trace = serde_json::from_value::( - json![{"from":"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266","gas":"0x1d1","gasUsed":"0x5208", + json![{"from":"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266","gas":"0x1","gasUsed":"0x5208", "to":"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92255","input":"0x","value":"0x4563918244f40000","type":"CALL"}], ).unwrap(); assert_eq!(send_eth_trace, CallTracer(expected_send_eth_trace.clone())); @@ -207,11 +208,11 @@ async fn tracing_tests() -> Result<(), Box> { ); let expected_call_get_trace = serde_json::from_value::( - json![{"from":"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266","gas":"0x19c7","gasUsed":"0x6b64","to":"0xe7f1725e7734ce288f8367e1bb143e90bb3f0512", + json![{"from":"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266","gas":"0x1886","gasUsed":"0x6b64","to":"0xe7f1725e7734ce288f8367e1bb143e90bb3f0512", "input":"0x35c152bd0000000000000000000000005fbdb2315678afecb367f032d93f642f64180aa3", "output":"0x0000000000000000000000000000000000000000000000000000000000000000", "calls":[{"from":"0xe7f1725e7734ce288f8367e1bb143e90bb3f0512", - "gas":"0xd7a","gasUsed":"0x996","to":"0x5fbdb2315678afecb367f032d93f642f64180aa3", + "gas":"0xc3e","gasUsed":"0x996","to":"0x5fbdb2315678afecb367f032d93f642f64180aa3", "input":"0x6d4ce63c","output":"0x0000000000000000000000000000000000000000000000000000000000000003","type":"STATICCALL"}], "value":"0x0","type":"CALL"}], ).unwrap(); @@ -291,7 +292,7 @@ async fn tracing_tests() -> Result<(), Box> { .await; let expected_top_call_only_call_get_trace = serde_json::from_value::( - json![{"from":"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266","gas":"0x19c7","gasUsed":"0x6b64","to":"0xe7f1725e7734ce288f8367e1bb143e90bb3f0512", + json![{"from":"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266","gas":"0x1886","gasUsed":"0x6b64","to":"0xe7f1725e7734ce288f8367e1bb143e90bb3f0512", "input":"0x35c152bd0000000000000000000000005fbdb2315678afecb367f032d93f642f64180aa3", "output":"0x0000000000000000000000000000000000000000000000000000000000000000", "calls":[], diff --git a/bin/citrea/tests/mempool/mod.rs b/bin/citrea/tests/mempool/mod.rs index 0fe91211bb..1c45b84fbf 100644 --- a/bin/citrea/tests/mempool/mod.rs +++ b/bin/citrea/tests/mempool/mod.rs @@ -30,6 +30,7 @@ async fn initialize_test( seq_port_tx, GenesisPaths::from_dir(TEST_DATA_GENESIS_PATH), None, + None, rollup_config, Some(sequencer_config), ) diff --git a/bin/citrea/tests/soft_confirmation_rule_enforcer/mod.rs b/bin/citrea/tests/soft_confirmation_rule_enforcer/mod.rs index 99827bf2ce..f3891a52b5 100644 --- a/bin/citrea/tests/soft_confirmation_rule_enforcer/mod.rs +++ b/bin/citrea/tests/soft_confirmation_rule_enforcer/mod.rs @@ -44,6 +44,7 @@ async fn too_many_l2_block_per_l1_block() { "../../resources/test-data/integration-tests-low-max-l2-blocks-per-l1", ), None, + None, rollup_config, Some(sequencer_config), ) diff --git a/bin/citrea/tests/test_helpers/mod.rs b/bin/citrea/tests/test_helpers/mod.rs index ee2fa729c0..b527f1ecd3 100644 --- a/bin/citrea/tests/test_helpers/mod.rs +++ b/bin/citrea/tests/test_helpers/mod.rs @@ -6,8 +6,8 @@ use anyhow::bail; use borsh::BorshDeserialize; use citrea::{CitreaRollupBlueprint, MockDemoRollup}; use citrea_common::{ - FullNodeConfig, ProverConfig, RollupPublicKeys, RpcConfig, RunnerConfig, SequencerConfig, - StorageConfig, + BatchProverConfig, FullNodeConfig, LightClientProverConfig, RollupPublicKeys, RpcConfig, + RunnerConfig, SequencerConfig, StorageConfig, }; use citrea_primitives::TEST_PRIVATE_KEY; use citrea_stf::genesis_config::GenesisPaths; @@ -29,14 +29,16 @@ use crate::DEFAULT_PROOF_WAIT_DURATION; pub enum NodeMode { FullNode(SocketAddr), SequencerNode, - #[allow(dead_code)] Prover(SocketAddr), + #[allow(unused)] + LightClientProver(SocketAddr), } pub async fn start_rollup( rpc_reporting_channel: oneshot::Sender, rt_genesis_paths: GenesisPaths, - rollup_prover_config: Option, + rollup_prover_config: Option, + light_client_prover_config: Option, rollup_config: FullNodeConfig, sequencer_config: Option, ) { @@ -45,7 +47,13 @@ pub async fn start_rollup( let mock_demo_rollup = MockDemoRollup {}; if sequencer_config.is_some() && rollup_prover_config.is_some() { - panic!("Both sequencer and prover config cannot be set at the same time"); + panic!("Both sequencer and batch prover config cannot be set at the same time"); + } + if sequencer_config.is_some() && light_client_prover_config.is_some() { + panic!("Both sequencer and light client prover config cannot be set at the same time"); + } + if rollup_prover_config.is_some() && light_client_prover_config.is_some() { + panic!("Both batch prover and light client prover config cannot be set at the same time"); } if let Some(sequencer_config) = sequencer_config { @@ -72,7 +80,7 @@ pub async fn start_rollup( .unwrap(); } else if let Some(rollup_prover_config) = rollup_prover_config { let span = info_span!("Prover"); - let rollup = CitreaRollupBlueprint::create_new_prover( + let rollup = CitreaRollupBlueprint::create_new_batch_prover( &mock_demo_rollup, &rt_genesis_paths, rollup_config, @@ -86,6 +94,21 @@ pub async fn start_rollup( .instrument(span) .await .unwrap(); + } else if let Some(light_client_prover_config) = light_client_prover_config { + let span = info_span!("LightClientProver"); + let rollup = CitreaRollupBlueprint::create_new_light_client_prover( + &mock_demo_rollup, + rollup_config.clone(), + light_client_prover_config, + ) + .instrument(span.clone()) + .await + .unwrap(); + rollup + .run_and_report_rpc_port(Some(rpc_reporting_channel)) + .instrument(span) + .await + .unwrap(); } else { let span = info_span!("FullNode"); let rollup = CitreaRollupBlueprint::create_new_rollup( @@ -134,7 +157,9 @@ pub fn create_default_rollup_config( max_subscriptions_per_connection: 100, }, runner: match node_mode { - NodeMode::FullNode(socket_addr) | NodeMode::Prover(socket_addr) => Some(RunnerConfig { + NodeMode::FullNode(socket_addr) + | NodeMode::Prover(socket_addr) + | NodeMode::LightClientProver(socket_addr) => Some(RunnerConfig { include_tx_body, sequencer_client_url: format!("http://localhost:{}", socket_addr.port()), accept_public_input_as_proven: Some(true), diff --git a/crates/prover/Cargo.toml b/crates/batch-prover/Cargo.toml similarity index 96% rename from crates/prover/Cargo.toml rename to crates/batch-prover/Cargo.toml index 0fa0936870..175f356b46 100644 --- a/crates/prover/Cargo.toml +++ b/crates/batch-prover/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "citrea-prover" +name = "citrea-batch-prover" version.workspace = true authors.workspace = true edition.workspace = true @@ -13,6 +13,7 @@ repository.workspace = true citrea-common = { path = "../common" } citrea-primitives = { path = "../primitives", features = ["native"] } citrea-stf = { path = "../citrea-stf" } +prover-services = { path = "../prover-services" } sequencer-client = { path = "../sequencer-client" } # Sov SDK deps diff --git a/crates/prover/src/da_block_handler.rs b/crates/batch-prover/src/da_block_handler.rs similarity index 96% rename from crates/prover/src/da_block_handler.rs rename to crates/batch-prover/src/da_block_handler.rs index 3385608dfc..9fb1a17aed 100644 --- a/crates/prover/src/da_block_handler.rs +++ b/crates/batch-prover/src/da_block_handler.rs @@ -9,13 +9,13 @@ use borsh::{BorshDeserialize, BorshSerialize}; use citrea_common::cache::L1BlockCache; use citrea_common::da::get_da_block_at_height; use citrea_common::utils::merge_state_diffs; -use citrea_common::ProverConfig; +use citrea_common::BatchProverConfig; use citrea_primitives::compression::compress_blob; use citrea_primitives::MAX_TXBODY_SIZE; use rand::Rng; use serde::de::DeserializeOwned; use serde::Serialize; -use sov_db::ledger_db::ProverLedgerOps; +use sov_db::ledger_db::BatchProverLedgerOps; use sov_db::schema::types::{BatchNumber, SlotNumber}; use sov_modules_api::{DaSpec, StateDiff, Zkvm}; use sov_rollup_interface::da::{BlockHeaderTrait, SequencerCommitment}; @@ -43,7 +43,7 @@ pub(crate) struct L1BlockHandler where Da: DaService, Vm: ZkvmHost + Zkvm, - DB: ProverLedgerOps, + DB: BatchProverLedgerOps, Ps: ProverService, StateRoot: BorshDeserialize + BorshSerialize @@ -52,9 +52,9 @@ where + Clone + AsRef<[u8]> + Debug, - Witness: Default + BorshDeserialize + Serialize + DeserializeOwned, + Witness: Default + BorshSerialize + BorshDeserialize + Serialize + DeserializeOwned, { - prover_config: ProverConfig, + prover_config: BatchProverConfig, prover_service: Arc, ledger_db: DB, da_service: Arc, @@ -72,8 +72,8 @@ impl L1BlockHandler, - DB: ProverLedgerOps + Clone + 'static, + Ps: ProverService, + DB: BatchProverLedgerOps + Clone + 'static, StateRoot: BorshDeserialize + BorshSerialize + Serialize @@ -81,11 +81,11 @@ where + Clone + AsRef<[u8]> + Debug, - Witness: Default + BorshDeserialize + Serialize + DeserializeOwned, + Witness: Default + BorshDeserialize + BorshSerialize + Serialize + DeserializeOwned, { #[allow(clippy::too_many_arguments)] pub fn new( - prover_config: ProverConfig, + prover_config: BatchProverConfig, prover_service: Arc, ledger_db: DB, da_service: Arc, @@ -170,7 +170,7 @@ where ) .unwrap(); - let data_to_prove = data_to_prove( + let data_to_prove = data_to_prove::( self.da_service.clone(), self.ledger_db.clone(), self.sequencer_pub_key.clone(), @@ -178,9 +178,10 @@ where self.l1_block_cache.clone(), l1_block.clone(), Some(true), - ); + ) + .await; - let (sequencer_commitments, state_transitions) = match data_to_prove.await { + let (sequencer_commitments, state_transitions) = match data_to_prove { Ok((commitments, transitions)) => (commitments, transitions), Err(e) => match e { L1ProcessingError::NoSeqCommitments { l1_height } => { @@ -338,7 +339,7 @@ async fn sync_l1( pub(crate) async fn get_state_transition_data_from_commitments< Da: DaService, - DB: ProverLedgerOps, + DB: BatchProverLedgerOps, Witness: DeserializeOwned, >( sequencer_commitments: &[SequencerCommitment], @@ -417,7 +418,7 @@ pub(crate) async fn get_state_transition_data_from_commitments< )) } -pub(crate) fn break_sequencer_commitments_into_groups( +pub(crate) fn break_sequencer_commitments_into_groups( ledger_db: &DB, sequencer_commitments: &[SequencerCommitment], ) -> anyhow::Result>> { diff --git a/crates/prover/src/db_migrations/mod.rs b/crates/batch-prover/src/db_migrations/mod.rs similarity index 100% rename from crates/prover/src/db_migrations/mod.rs rename to crates/batch-prover/src/db_migrations/mod.rs diff --git a/crates/prover/src/errors.rs b/crates/batch-prover/src/errors.rs similarity index 100% rename from crates/prover/src/errors.rs rename to crates/batch-prover/src/errors.rs diff --git a/crates/prover/src/lib.rs b/crates/batch-prover/src/lib.rs similarity index 92% rename from crates/prover/src/lib.rs rename to crates/batch-prover/src/lib.rs index 14f438be76..68d0723ffc 100644 --- a/crates/prover/src/lib.rs +++ b/crates/batch-prover/src/lib.rs @@ -9,17 +9,16 @@ use tracing::instrument; mod da_block_handler; pub mod db_migrations; mod errors; -pub mod prover_service; mod runner; pub use runner::*; mod proving; mod rpc; /// Dependencies needed to run the rollup. -pub struct Prover { +pub struct BatchProver { /// The State Transition Runner. #[allow(clippy::type_complexity)] - pub runner: CitreaProver< + pub runner: CitreaBatchProver< S::NativeContext, S::DaService, S::StorageManager, @@ -32,7 +31,7 @@ pub struct Prover { pub rpc_methods: jsonrpsee::RpcModule<()>, } -impl Prover { +impl BatchProver { /// Runs the rollup. #[instrument(level = "trace", skip_all, err, ret(level = "error"))] pub async fn run(self) -> Result<(), anyhow::Error> { diff --git a/crates/prover/src/proving.rs b/crates/batch-prover/src/proving.rs similarity index 96% rename from crates/prover/src/proving.rs rename to crates/batch-prover/src/proving.rs index 3268c2190a..70447388d2 100644 --- a/crates/prover/src/proving.rs +++ b/crates/batch-prover/src/proving.rs @@ -9,7 +9,7 @@ use citrea_common::da::extract_sequencer_commitments; use citrea_common::utils::{check_l2_range_exists, filter_out_proven_commitments}; use serde::de::DeserializeOwned; use serde::Serialize; -use sov_db::ledger_db::ProverLedgerOps; +use sov_db::ledger_db::BatchProverLedgerOps; use sov_db::schema::types::{BatchNumber, StoredProof, StoredStateTransition}; use sov_modules_api::{BlobReaderTrait, SlotData, SpecId, Zkvm}; use sov_rollup_interface::da::{BlockHeaderTrait, DaSpec, SequencerCommitment}; @@ -44,7 +44,7 @@ pub(crate) async fn data_to_prove( > where Da: DaService, - DB: ProverLedgerOps + Clone + Send + Sync + 'static, + DB: BatchProverLedgerOps + Clone + Send + Sync + 'static, StateRoot: BorshDeserialize + BorshSerialize + Serialize @@ -203,9 +203,9 @@ pub(crate) async fn prove_l1( ) -> anyhow::Result<()> where Da: DaService, - DB: ProverLedgerOps + Clone + Send + Sync + 'static, + DB: BatchProverLedgerOps + Clone + Send + Sync + 'static, Vm: ZkvmHost + Zkvm, - Ps: ProverService, + Ps: ProverService, StateRoot: BorshDeserialize + BorshSerialize + Serialize @@ -213,7 +213,7 @@ where + Clone + AsRef<[u8]> + Debug, - Witness: Default + BorshDeserialize + Serialize + DeserializeOwned, + Witness: Default + BorshSerialize + BorshDeserialize + Serialize + DeserializeOwned, { let submitted_proofs = ledger .get_proofs_by_l1_height(l1_block.header().height()) @@ -264,10 +264,14 @@ pub(crate) async fn generate_and_submit_proof( ) -> Result<(TxId, Proof), anyhow::Error> where Vm: ZkvmHost + Zkvm, - Ps: ProverService, + Ps: ProverService, Da: DaService, + StateRoot: BorshSerialize, + Witness: BorshSerialize, { - prover_service.submit_witness(transition_data).await; + prover_service + .submit_witness(borsh::to_vec(&transition_data)?, hash.clone()) + .await; prover_service.prove(hash.clone()).await?; @@ -312,7 +316,7 @@ pub(crate) async fn extract_and_store_proof( ) -> Result<(), anyhow::Error> where Da: DaService, - DB: ProverLedgerOps, + DB: BatchProverLedgerOps, Vm: ZkvmHost + Zkvm, StateRoot: BorshDeserialize + BorshSerialize @@ -378,7 +382,7 @@ pub(crate) fn save_commitments( sequencer_commitments: &[SequencerCommitment], l1_height: u64, ) where - DB: ProverLedgerOps, + DB: BatchProverLedgerOps, { for sequencer_commitment in sequencer_commitments.iter() { // Save commitments on prover ledger db diff --git a/crates/prover/src/rpc.rs b/crates/batch-prover/src/rpc.rs similarity index 84% rename from crates/prover/src/rpc.rs rename to crates/batch-prover/src/rpc.rs index 2c6dfb817b..a8871143e2 100644 --- a/crates/prover/src/rpc.rs +++ b/crates/batch-prover/src/rpc.rs @@ -11,7 +11,7 @@ use jsonrpsee::types::error::{INTERNAL_ERROR_CODE, INTERNAL_ERROR_MSG}; use jsonrpsee::types::ErrorObjectOwned; use serde::de::DeserializeOwned; use serde::{Deserialize, Serialize}; -use sov_db::ledger_db::ProverLedgerOps; +use sov_db::ledger_db::BatchProverLedgerOps; use sov_modules_api::{SpecId, Zkvm}; use sov_rollup_interface::services::da::DaService; use sov_rollup_interface::zk::ZkvmHost; @@ -31,9 +31,9 @@ pub(crate) struct RpcContext where C: sov_modules_api::Context, Da: DaService, - DB: ProverLedgerOps + Clone, + DB: BatchProverLedgerOps + Clone, Vm: ZkvmHost + Zkvm, - Ps: ProverService, + Ps: ProverService, StateRoot: BorshDeserialize + BorshSerialize + Serialize @@ -52,6 +52,8 @@ where pub code_commitments_by_spec: HashMap, pub(crate) phantom_c: PhantomData C>, pub(crate) phantom_vm: PhantomData Vm>, + pub(crate) phantom_sr: PhantomData StateRoot>, + pub(crate) phantom_w: PhantomData Witness>, } #[rpc(client, server)] @@ -73,9 +75,9 @@ pub struct ProverRpcServerImpl where C: sov_modules_api::Context, Da: DaService, - DB: ProverLedgerOps + Clone + Send + Sync + 'static, + DB: BatchProverLedgerOps + Clone + Send + Sync + 'static, Vm: ZkvmHost + Zkvm, - Ps: ProverService, + Ps: ProverService, StateRoot: BorshDeserialize + BorshSerialize + Serialize @@ -93,9 +95,9 @@ impl where C: sov_modules_api::Context, Da: DaService, - DB: ProverLedgerOps + Clone + Send + Sync + 'static, + DB: BatchProverLedgerOps + Clone + Send + Sync + 'static, Vm: ZkvmHost + Zkvm, - Ps: ProverService, + Ps: ProverService, StateRoot: BorshDeserialize + BorshSerialize + Serialize @@ -118,12 +120,9 @@ impl ProverRpcServer where C: sov_modules_api::Context, Da: DaService, - DB: ProverLedgerOps + Clone + Send + Sync + 'static, + DB: BatchProverLedgerOps + Clone + Send + Sync + 'static, Vm: ZkvmHost + Zkvm + 'static, - Ps: ProverService - + Send - + Sync - + 'static, + Ps: ProverService + Send + Sync + 'static, StateRoot: BorshDeserialize + BorshSerialize + Serialize @@ -205,23 +204,24 @@ where ) })?; - let (sequencer_commitments, state_transitions) = data_to_prove( - self.context.da_service.clone(), - self.context.ledger.clone(), - self.context.sequencer_pub_key.clone(), - self.context.sequencer_da_pub_key.clone(), - self.context.l1_block_cache.clone(), - l1_block.clone(), - group_commitments, - ) - .await - .map_err(|e| { - ErrorObjectOwned::owned( - INTERNAL_ERROR_CODE, - INTERNAL_ERROR_MSG, - Some(format!("{e}",)), + let (sequencer_commitments, state_transitions) = + data_to_prove::( + self.context.da_service.clone(), + self.context.ledger.clone(), + self.context.sequencer_pub_key.clone(), + self.context.sequencer_da_pub_key.clone(), + self.context.l1_block_cache.clone(), + l1_block.clone(), + group_commitments, ) - })?; + .await + .map_err(|e| { + ErrorObjectOwned::owned( + INTERNAL_ERROR_CODE, + INTERNAL_ERROR_MSG, + Some(format!("{e}",)), + ) + })?; prove_l1( self.context.da_service.clone(), @@ -255,12 +255,9 @@ pub fn create_rpc_module( where C: sov_modules_api::Context, Da: DaService, - DB: ProverLedgerOps + Clone + Send + Sync + 'static, + DB: BatchProverLedgerOps + Clone + Send + Sync + 'static, Vm: ZkvmHost + Zkvm + 'static, - Ps: ProverService - + Send - + Sync - + 'static, + Ps: ProverService + Send + Sync + 'static, StateRoot: BorshDeserialize + BorshSerialize + Serialize diff --git a/crates/prover/src/runner.rs b/crates/batch-prover/src/runner.rs similarity index 97% rename from crates/prover/src/runner.rs rename to crates/batch-prover/src/runner.rs index a9761969e8..e3a74f521e 100644 --- a/crates/prover/src/runner.rs +++ b/crates/batch-prover/src/runner.rs @@ -10,13 +10,13 @@ use backoff::future::retry as retry_backoff; use citrea_common::cache::L1BlockCache; use citrea_common::da::get_da_block_at_height; use citrea_common::tasks::manager::TaskManager; -use citrea_common::{ProverConfig, RollupPublicKeys, RpcConfig, RunnerConfig}; +use citrea_common::{BatchProverConfig, RollupPublicKeys, RpcConfig, RunnerConfig}; use citrea_primitives::types::SoftConfirmationHash; use jsonrpsee::core::client::Error as JsonrpseeError; use jsonrpsee::server::{BatchRequestConfig, ServerBuilder}; use jsonrpsee::RpcModule; use sequencer_client::{GetSoftConfirmationResponse, SequencerClient}; -use sov_db::ledger_db::ProverLedgerOps; +use sov_db::ledger_db::BatchProverLedgerOps; use sov_db::schema::types::{BatchNumber, SlotNumber}; use sov_modules_api::storage::HierarchicalStorageManager; use sov_modules_api::{Context, SlotData}; @@ -38,7 +38,7 @@ use crate::rpc::{create_rpc_module, RpcContext}; type StateRoot = >::StateRoot; -pub struct CitreaProver +pub struct CitreaBatchProver where C: Context, Da: DaService, @@ -48,7 +48,7 @@ where + StfBlueprintTrait, Ps: ProverService, - DB: ProverLedgerOps + Clone, + DB: BatchProverLedgerOps + Clone, { start_l2_height: u64, da_service: Arc, @@ -63,7 +63,7 @@ where sequencer_pub_key: Vec, sequencer_da_pub_key: Vec, phantom: std::marker::PhantomData, - prover_config: ProverConfig, + prover_config: BatchProverConfig, code_commitments_by_spec: HashMap, l1_block_cache: Arc>>, sync_blocks_count: u64, @@ -72,7 +72,7 @@ where task_manager: TaskManager<()>, } -impl CitreaProver +impl CitreaBatchProver where C: Context, Da: DaService + Send + Sync + 'static, @@ -85,11 +85,8 @@ where PreState = Sm::NativeStorage, ChangeSet = Sm::NativeChangeSet, > + StfBlueprintTrait, - Ps: ProverService - + Send - + Sync - + 'static, - DB: ProverLedgerOps + Clone + 'static, + Ps: ProverService + Send + Sync + 'static, + DB: BatchProverLedgerOps + Clone + 'static, { /// Creates a new `StateTransitionRunner`. /// @@ -107,7 +104,7 @@ where mut storage_manager: Sm, init_variant: InitVariant, prover_service: Arc, - prover_config: ProverConfig, + prover_config: BatchProverConfig, code_commitments_by_spec: HashMap, fork_manager: ForkManager, soft_confirmation_tx: broadcast::Sender, @@ -175,6 +172,8 @@ where code_commitments_by_spec: self.code_commitments_by_spec.clone(), phantom_c: std::marker::PhantomData, phantom_vm: std::marker::PhantomData, + phantom_sr: std::marker::PhantomData, + phantom_w: std::marker::PhantomData, } } diff --git a/crates/prover/tests/prover_tests.rs b/crates/batch-prover/tests/prover_tests.rs similarity index 85% rename from crates/prover/tests/prover_tests.rs rename to crates/batch-prover/tests/prover_tests.rs index fd1ec8fae3..9359c22389 100644 --- a/crates/prover/tests/prover_tests.rs +++ b/crates/batch-prover/tests/prover_tests.rs @@ -1,7 +1,7 @@ use std::collections::VecDeque; use std::sync::Arc; -use citrea_prover::prover_service::ParallelProverService; +use prover_services::ParallelProverService; use sov_db::ledger_db::LedgerDB; use sov_db::rocks_db_config::RocksdbConfig; use sov_mock_da::{ @@ -29,7 +29,10 @@ async fn test_successful_prover_execution() -> Result<(), ProverServiceError> { let header_hash = MockHash::from([0; 32]); prover_service - .submit_witness(make_transition_data(header_hash)) + .submit_witness( + borsh::to_vec(&make_transition_data(header_hash)).unwrap(), + header_hash, + ) .await; prover_service.prove(header_hash).await?; vm.make_proof(); @@ -67,7 +70,10 @@ async fn test_prover_status_busy() -> Result<(), anyhow::Error> { // Saturate the prover. for header_hash in header_hashes.clone() { prover_service - .submit_witness(make_transition_data(header_hash)) + .submit_witness( + borsh::to_vec(&make_transition_data(header_hash)).unwrap(), + header_hash, + ) .await; let poof_processing_status = prover_service.prove(header_hash).await?; @@ -81,7 +87,10 @@ async fn test_prover_status_busy() -> Result<(), anyhow::Error> { { let header_hash = MockHash::from([0; 32]); prover_service - .submit_witness(make_transition_data(header_hash)) + .submit_witness( + borsh::to_vec(&make_transition_data(header_hash)).unwrap(), + header_hash, + ) .await; let status = prover_service.prove(header_hash).await?; @@ -110,7 +119,10 @@ async fn test_prover_status_busy() -> Result<(), anyhow::Error> { { let header_hash = MockHash::from([(num_worker_threads + 1) as u8; 32]); prover_service - .submit_witness(make_transition_data(header_hash)) + .submit_witness( + borsh::to_vec(&make_transition_data(header_hash)).unwrap(), + header_hash, + ) .await; let status = prover_service.prove(header_hash).await?; @@ -139,7 +151,10 @@ async fn test_multiple_witness_submissions() -> Result<(), anyhow::Error> { let header_hash = MockHash::from([0; 32]); let submission_status = prover_service - .submit_witness(make_transition_data(header_hash)) + .submit_witness( + borsh::to_vec(&make_transition_data(header_hash)).unwrap(), + header_hash, + ) .await; assert_eq!( @@ -148,7 +163,10 @@ async fn test_multiple_witness_submissions() -> Result<(), anyhow::Error> { ); let submission_status = prover_service - .submit_witness(make_transition_data(header_hash)) + .submit_witness( + borsh::to_vec(&make_transition_data(header_hash)).unwrap(), + header_hash, + ) .await; assert_eq!(WitnessSubmissionStatus::WitnessExist, submission_status); @@ -162,7 +180,10 @@ async fn test_generate_multiple_proofs_for_the_same_witness() -> Result<(), anyh let header_hash = MockHash::from([0; 32]); prover_service - .submit_witness(make_transition_data(header_hash)) + .submit_witness( + borsh::to_vec(&make_transition_data(header_hash)).unwrap(), + header_hash, + ) .await; let status = prover_service.prove(header_hash).await?; @@ -174,13 +195,8 @@ async fn test_generate_multiple_proofs_for_the_same_witness() -> Result<(), anyh } struct TestProver { - prover_service: ParallelProverService< - [u8; 0], - Vec, - MockDaService, - MockZkvm, - MockStf, - >, + prover_service: + ParallelProverService, MockStf>, vm: MockZkvm, num_worker_threads: usize, } diff --git a/crates/bitcoin-da/Cargo.toml b/crates/bitcoin-da/Cargo.toml index 2719fcee52..8f2e1ed053 100644 --- a/crates/bitcoin-da/Cargo.toml +++ b/crates/bitcoin-da/Cargo.toml @@ -12,7 +12,7 @@ repository = { workspace = true } [dependencies] citrea-common = { path = "../common", optional = true } -citrea-primitives = { path = "../primitives", features = ["native"], optional = true } +citrea-primitives = { path = "../primitives" } sov-rollup-interface = { path = "../sovereign-sdk/rollup-interface" } tokio = { workspace = true, features = ["full"], optional = true } @@ -45,7 +45,6 @@ native = [ "dep:tracing", "sov-rollup-interface/native", "dep:citrea-common", - "dep:citrea-primitives", "dep:bitcoincore-rpc", "dep:reqwest", ] diff --git a/crates/bitcoin-da/src/helpers/builders/light_client_proof_namespace.rs b/crates/bitcoin-da/src/helpers/builders/light_client_proof_namespace.rs index 26d543c049..bd895b4d5a 100644 --- a/crates/bitcoin-da/src/helpers/builders/light_client_proof_namespace.rs +++ b/crates/bitcoin-da/src/helpers/builders/light_client_proof_namespace.rs @@ -15,8 +15,8 @@ use bitcoin::secp256k1::{self, Secp256k1, SecretKey, XOnlyPublicKey}; use bitcoin::sighash::{Prevouts, SighashCache}; use bitcoin::taproot::{LeafVersion, TapLeafHash, TaprootBuilder}; use bitcoin::{Address, Network, Transaction}; -use citrea_primitives::MAX_TXBODY_SIZE; use serde::Serialize; +use sov_rollup_interface::da::DaDataLightClient; use tracing::{instrument, trace, warn}; use super::{ @@ -25,6 +25,15 @@ use super::{ }; use crate::spec::utxo::UTXO; +pub(crate) enum RawLightClientData { + /// compress(borsh(DaDataLightClient::Complete(Proof))) + Complete(Vec), + /// let compressed = compress(borsh(Proof)) + /// let chunks = compressed.chunks(MAX_TXBODY_SIZE) + /// [borsh(DaDataLightClient::Chunk(chunk)) for chunk in chunks] + Chunks(Vec>), +} + /// This is a list of light client tx we need to send to DA #[derive(Serialize)] pub(crate) enum LightClientTxs { @@ -86,7 +95,7 @@ impl TxListWithReveal for LightClientTxs { #[allow(clippy::too_many_arguments)] #[instrument(level = "trace", skip_all, err)] pub fn create_zkproof_transactions( - body: Vec, + data: RawLightClientData, da_private_key: SecretKey, prev_utxo: Option, utxos: Vec, @@ -97,8 +106,8 @@ pub fn create_zkproof_transactions( network: Network, reveal_tx_prefix: Vec, ) -> Result { - if body.len() < MAX_TXBODY_SIZE { - create_inscription_type_0( + match data { + RawLightClientData::Complete(body) => create_inscription_type_0( body, &da_private_key, prev_utxo, @@ -109,9 +118,8 @@ pub fn create_zkproof_transactions( reveal_fee_rate, network, &reveal_tx_prefix, - ) - } else { - create_inscription_type_1( + ), + RawLightClientData::Chunks(body) => create_inscription_type_1( body, &da_private_key, prev_utxo, @@ -122,7 +130,7 @@ pub fn create_zkproof_transactions( reveal_fee_rate, network, &reveal_tx_prefix, - ) + ), } } @@ -313,7 +321,7 @@ pub fn create_inscription_type_0( #[allow(clippy::too_many_arguments)] #[instrument(level = "trace", skip_all, err)] pub fn create_inscription_type_1( - body: Vec, + chunks: Vec>, da_private_key: &SecretKey, mut prev_utxo: Option, mut utxos: Vec, @@ -332,7 +340,7 @@ pub fn create_inscription_type_1( let mut commit_chunks: Vec = vec![]; let mut reveal_chunks: Vec = vec![]; - for body in body.chunks(MAX_TXBODY_SIZE) { + for body in chunks { let kind = TransactionKindLightClient::ChunkedPart; let kind_bytes = kind.to_bytes(); @@ -485,8 +493,11 @@ pub fn create_inscription_type_1( .map(|tx| tx.compute_txid().to_byte_array()) .collect(); + let aggregate = DaDataLightClient::Aggregate(reveal_tx_ids); + // To sign the list of tx ids we assume they form a contigious list of bytes - let reveal_body: Vec = reveal_tx_ids.iter().copied().flatten().collect(); + let reveal_body: Vec = + borsh::to_vec(&aggregate).expect("Aggregate serialize must not fail"); // sign the body for authentication of the sequencer let (signature, signer_public_key) = sign_blob_with_private_key(&reveal_body, da_private_key); @@ -504,9 +515,10 @@ pub fn create_inscription_type_1( .push_slice( PushBytesBuf::try_from(signer_public_key).expect("Cannot push sequencer public key"), ); - // push txids - for id in reveal_tx_ids { - reveal_script_builder = reveal_script_builder.push_slice(id); + // push body in chunks of 520 bytes + for chunk in reveal_body.chunks(520) { + reveal_script_builder = reveal_script_builder + .push_slice(PushBytesBuf::try_from(chunk.to_vec()).expect("Cannot push body chunk")); } // push end if reveal_script_builder = reveal_script_builder.push_opcode(OP_ENDIF); diff --git a/crates/bitcoin-da/src/helpers/builders/tests.rs b/crates/bitcoin-da/src/helpers/builders/tests.rs index 96bf1ce49a..e2731e78c4 100644 --- a/crates/bitcoin-da/src/helpers/builders/tests.rs +++ b/crates/bitcoin-da/src/helpers/builders/tests.rs @@ -8,7 +8,7 @@ use bitcoin::taproot::ControlBlock; use bitcoin::{Address, Amount, ScriptBuf, TxOut, Txid}; use citrea_primitives::compression::{compress_blob, decompress_blob}; -use super::light_client_proof_namespace::LightClientTxs; +use super::light_client_proof_namespace::{LightClientTxs, RawLightClientData}; use crate::helpers::builders::sign_blob_with_private_key; use crate::helpers::parsers::{parse_light_client_transaction, ParsedLightClientTransaction}; use crate::spec::utxo::UTXO; @@ -465,7 +465,7 @@ fn create_inscription_transactions() { let tx_prefix = &[0u8]; let LightClientTxs::Complete { commit, reveal } = super::light_client_proof_namespace::create_zkproof_transactions( - body.clone(), + RawLightClientData::Complete(body.clone()), da_private_key, None, utxos.clone(), diff --git a/crates/bitcoin-da/src/helpers/mod.rs b/crates/bitcoin-da/src/helpers/mod.rs index df91f2e6e1..a5eb760b0f 100644 --- a/crates/bitcoin-da/src/helpers/mod.rs +++ b/crates/bitcoin-da/src/helpers/mod.rs @@ -9,7 +9,6 @@ pub mod parsers; #[cfg(test)] pub mod test_utils; -#[cfg(feature = "native")] /// Type represents a typed enum for LightClient kind #[repr(u16)] enum TransactionKindLightClient { @@ -22,8 +21,8 @@ enum TransactionKindLightClient { Unknown(NonZeroU16), } -#[cfg(feature = "native")] impl TransactionKindLightClient { + #[cfg(feature = "native")] fn to_bytes(&self) -> Vec { match self { TransactionKindLightClient::Complete => 0u16.to_le_bytes().to_vec(), diff --git a/crates/bitcoin-da/src/helpers/parsers.rs b/crates/bitcoin-da/src/helpers/parsers.rs index 319182a84f..636e263076 100644 --- a/crates/bitcoin-da/src/helpers/parsers.rs +++ b/crates/bitcoin-da/src/helpers/parsers.rs @@ -5,14 +5,11 @@ use bitcoin::opcodes::all::OP_CHECKSIGVERIFY; use bitcoin::script::Instruction::{Op, PushBytes}; use bitcoin::script::{Error as ScriptError, PushBytes as StructPushBytes}; use bitcoin::secp256k1::{ecdsa, Message, Secp256k1}; -#[cfg(feature = "native")] -use bitcoin::Txid; use bitcoin::{secp256k1, Opcode, Script, Transaction}; use thiserror::Error; use super::calculate_sha256; -#[cfg(feature = "native")] #[derive(Debug, Clone)] pub enum ParsedLightClientTransaction { /// Kind 0 @@ -31,7 +28,6 @@ pub enum ParsedBatchProofTransaction { // ForcedTransaction(ForcedTransaction), } -#[cfg(feature = "native")] #[derive(Debug, Clone)] pub struct ParsedComplete { pub body: Vec, @@ -39,7 +35,6 @@ pub struct ParsedComplete { pub public_key: Vec, } -#[cfg(feature = "native")] #[derive(Debug, Clone)] pub struct ParsedAggregate { pub body: Vec, @@ -47,15 +42,6 @@ pub struct ParsedAggregate { pub public_key: Vec, } -#[cfg(feature = "native")] -impl ParsedAggregate { - pub fn txids(&self) -> Result, bitcoin::hashes::FromSliceError> { - use bitcoin::hashes::Hash; - self.body.chunks_exact(32).map(Txid::from_slice).collect() - } -} - -#[cfg(feature = "native")] #[derive(Debug, Clone)] pub struct ParsedChunk { pub body: Vec, @@ -96,7 +82,6 @@ pub trait VerifyParsed { } } -#[cfg(feature = "native")] impl VerifyParsed for ParsedComplete { fn public_key(&self) -> &[u8] { &self.public_key @@ -109,7 +94,6 @@ impl VerifyParsed for ParsedComplete { } } -#[cfg(feature = "native")] impl VerifyParsed for ParsedAggregate { fn public_key(&self) -> &[u8] { &self.public_key @@ -156,7 +140,6 @@ impl From for ParserError { } } -#[cfg(feature = "native")] pub fn parse_light_client_transaction( tx: &Transaction, ) -> Result { @@ -187,7 +170,6 @@ fn get_script(tx: &Transaction) -> Result<&Script, ParserError> { .ok_or(ParserError::NonTapscriptWitness) } -#[cfg(feature = "native")] fn parse_relevant_lightclient( instructions: &mut dyn Iterator, ParserError>>, ) -> Result { @@ -274,7 +256,6 @@ fn read_opcode( Ok(op) } -#[cfg(feature = "native")] mod light_client { use bitcoin::opcodes::all::{OP_ENDIF, OP_IF, OP_NIP}; use bitcoin::script::Instruction; @@ -366,12 +347,7 @@ mod light_client { loop { let instr = read_instr(instructions)?; match instr { - PushBytes(chunk) => { - if chunk.len() != 32 { - return Err(ParserError::UnexpectedOpcode); - } - chunks.push(chunk) - } + PushBytes(chunk) => chunks.push(chunk), Op(OP_ENDIF) => break, Op(_) => return Err(ParserError::UnexpectedOpcode), } @@ -387,7 +363,7 @@ mod light_client { return Err(ParserError::UnexpectedOpcode); } - let body_size: usize = 32 * chunks.len(); + let body_size: usize = chunks.iter().map(|c| c.len()).sum(); let mut body = Vec::with_capacity(body_size); for chunk in chunks { body.extend_from_slice(chunk.as_bytes()); diff --git a/crates/bitcoin-da/src/service.rs b/crates/bitcoin-da/src/service.rs index 163bdfe8f6..e026d9910c 100644 --- a/crates/bitcoin-da/src/service.rs +++ b/crates/bitcoin-da/src/service.rs @@ -21,9 +21,11 @@ use bitcoincore_rpc::json::TestMempoolAcceptResult; use bitcoincore_rpc::{Auth, Client, Error, RpcApi, RpcError}; use borsh::BorshDeserialize; use citrea_primitives::compression::{compress_blob, decompress_blob}; +use citrea_primitives::MAX_TXBODY_SIZE; use serde::{Deserialize, Serialize}; use sov_rollup_interface::da::{DaData, DaDataBatchProof, DaDataLightClient, DaSpec}; use sov_rollup_interface::services::da::{DaService, SenderWithNotifier}; +use sov_rollup_interface::zk::Proof; use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender}; use tokio::sync::oneshot::channel as oneshot_channel; use tokio::{select, signal}; @@ -33,7 +35,7 @@ use crate::helpers::builders::batch_proof_namespace::{ create_seqcommitment_transactions, BatchProvingTxs, }; use crate::helpers::builders::light_client_proof_namespace::{ - create_zkproof_transactions, LightClientTxs, + create_zkproof_transactions, LightClientTxs, RawLightClientData, }; use crate::helpers::builders::{TxListWithReveal, TxWithId}; use crate::helpers::merkle_tree; @@ -59,14 +61,6 @@ const POLLING_INTERVAL: u64 = 10; // seconds const MEMPOOL_SPACE_URL: &str = "https://mempool.space/"; const MEMPOOL_SPACE_RECOMMENDED_FEE_ENDPOINT: &str = "api/v1/fees/recommended"; -#[derive(PartialEq, Eq, PartialOrd, Ord, core::hash::Hash)] -pub struct TxidWrapper(Txid); -impl From for [u8; 32] { - fn from(val: TxidWrapper) -> Self { - val.0.to_byte_array() - } -} - /// Runtime configuration for the DA service #[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] pub struct BitcoinServiceConfig { @@ -384,9 +378,7 @@ impl BitcoinService { match da_data { DaData::ZKProof(zkproof) => { - let data = DaDataLightClient::ZKProof(zkproof); - let blob = borsh::to_vec(&data).expect("DaDataLightClient serialize must not fail"); - let blob = compress_blob(&blob); + let data = split_proof(zkproof); let reveal_light_client_prefix = self.reveal_light_client_prefix.clone(); // create inscribe transactions @@ -394,7 +386,7 @@ impl BitcoinService { // Since this is CPU bound work, we use spawn_blocking // to release the tokio runtime execution create_zkproof_transactions( - blob, + data, da_private_key, prev_utxo, utxos, @@ -693,13 +685,28 @@ impl DaService for BitcoinService { get_relevant_blobs_from_txs(txs, &self.reveal_batch_prover_prefix) } + // Extract the blob transactions relevant to a particular rollup from a block. + #[instrument(level = "trace", skip_all)] + fn extract_relevant_blobs_light_client( + &self, + block: &Self::FilteredBlock, + ) -> Vec<::BlobTransaction> { + debug!( + "Extracting relevant light_client txs from block {:?}", + block.header.block_hash() + ); + + let txs = block.txdata.iter().map(|tx| tx.inner().clone()).collect(); + get_relevant_blobs_from_txs_light_client(txs, &self.reveal_light_client_prefix) + } + /// Return a list of LightClient transactions #[instrument(level = "trace", skip_all)] async fn extract_relevant_proofs( &self, block: &Self::FilteredBlock, prover_pk: &[u8], - ) -> anyhow::Result> { + ) -> anyhow::Result> { let mut completes = Vec::new(); let mut aggregate_idxs = Vec::new(); @@ -721,7 +728,14 @@ impl DaService for BitcoinService { && complete.get_sig_verified_hash().is_some() { // push only when signature is correct - completes.push((i, tx_id, complete.body)); + let body = decompress_blob(&complete.body); + let data = DaDataLightClient::try_from_slice(&body).map_err(|e| { + anyhow::anyhow!("{}: Failed to parse complete: {e}", tx_id) + })?; + let DaDataLightClient::Complete(zk_proof) = data else { + anyhow::bail!("{}: Complete: unexpected kind", tx_id); + }; + completes.push((i, zk_proof)); } } ParsedLightClientTransaction::Aggregate(aggregate) => { @@ -744,8 +758,10 @@ impl DaService for BitcoinService { let mut aggregates = Vec::new(); 'aggregate: for (i, tx_id, aggregate) in aggregate_idxs { let mut body = Vec::new(); - let Ok(chunk_ids) = aggregate.txids() else { - error!("{}: Failed to get txids from aggregate", tx_id); + let data = DaDataLightClient::try_from_slice(&aggregate.body) + .map_err(|e| anyhow::anyhow!("{}: Failed to parse aggregate: {e}", tx_id))?; + let DaDataLightClient::Aggregate(chunk_ids) = data else { + error!("{}: Aggregate: unexpected kind", tx_id); continue; }; if chunk_ids.is_empty() { @@ -753,6 +769,7 @@ impl DaService for BitcoinService { continue; } for chunk_id in chunk_ids { + let chunk_id = Txid::from_byte_array(chunk_id); let tx_raw = { let exponential_backoff = ExponentialBackoff::default(); let res = retry_backoff(exponential_backoff, || async move { @@ -786,7 +803,13 @@ impl DaService for BitcoinService { }; match parsed { ParsedLightClientTransaction::Chunk(part) => { - body.extend(part.body); + let data = DaDataLightClient::try_from_slice(&part.body).map_err(|e| { + anyhow::anyhow!("{}: Failed to parse chunk: {e}", tx_id) + })?; + let DaDataLightClient::Chunk(chunk) = data else { + anyhow::bail!("{}: Chunk: unexpected kind", tx_id); + }; + body.extend(chunk); } ParsedLightClientTransaction::Complete(_) | ParsedLightClientTransaction::Aggregate(_) => { @@ -795,19 +818,19 @@ impl DaService for BitcoinService { } } } - aggregates.push((i, tx_id, body)); + let zk_proof: Proof = borsh::from_slice(&body).map_err(|e| { + anyhow::anyhow!("{}: Failed to parse Proof from Aggregate: {e}", tx_id) + })?; + aggregates.push((i, zk_proof)); } - let mut bodies: Vec<_> = completes.into_iter().chain(aggregates).collect(); + let mut proofs: Vec<_> = completes.into_iter().chain(aggregates).collect(); // restore the order of tx they appear in the block - bodies.sort_by_key(|b| b.0); + proofs.sort_by_key(|b| b.0); let mut result = Vec::new(); - for (_i, tx_id, blob) in bodies { - let body = decompress_blob(&blob); - let data = DaDataLightClient::try_from_slice(&body) - .map_err(|e| anyhow::anyhow!("{}: Failed to parse body: {e}", tx_id))?; - result.push(data); + for (_i, proof) in proofs { + result.push(proof); } Ok(result) } @@ -890,6 +913,84 @@ impl DaService for BitcoinService { (txs, inclusion_proof, completeness_proof) } + #[instrument(level = "trace", skip_all)] + async fn get_extraction_proof_light_client( + &self, + block: &Self::FilteredBlock, + ) -> ( + ::InclusionMultiProof, + ::CompletenessProof, + ) { + info!( + "Getting extraction proof for block {:?}", + block.header.block_hash() + ); + + let mut completeness_proof = Vec::with_capacity(block.txdata.len()); + + let mut wtxids = Vec::with_capacity(block.txdata.len()); + wtxids.push([0u8; 32]); + + // coinbase starts with 0, so we skip it unless the prefix is all 0's + if self.reveal_light_client_prefix.iter().all(|&x| x == 0) { + completeness_proof.push(block.txdata[0].clone()); + } + + block.txdata[1..].iter().for_each(|tx| { + let wtxid = tx.compute_wtxid().to_raw_hash().to_byte_array(); + + // if tx_hash starts with the given prefix, it is in the completeness proof + if wtxid.starts_with(&self.reveal_light_client_prefix) { + completeness_proof.push(tx.clone()); + } + + wtxids.push(wtxid); + }); + + let txid_merkle_tree = merkle_tree::BitcoinMerkleTree::new( + block + .txdata + .iter() + .map(|tx| tx.compute_txid().as_raw_hash().to_byte_array()) + .collect(), + ); + + assert_eq!( + txid_merkle_tree.root(), + block.header.merkle_root(), + "Merkle root mismatch" + ); + + let coinbase_proof = txid_merkle_tree.get_idx_path(0); + + ( + InclusionMultiProof::new(wtxids, block.txdata[0].clone(), coinbase_proof), + completeness_proof, + ) + } + + // Extract the list blob transactions relevant to a particular rollup from a block, along with inclusion and + // completeness proofs for that set of transactions. The output of this method will be passed to the verifier. + async fn extract_relevant_blobs_with_proof_light_client( + &self, + block: &Self::FilteredBlock, + ) -> ( + Vec<::BlobTransaction>, + ::InclusionMultiProof, + ::CompletenessProof, + ) { + info!( + "Extracting relevant txs with proof from block {:?}", + block.header.block_hash() + ); + + let txs = self.extract_relevant_blobs_light_client(block); + let (inclusion_proof, completeness_proof) = + self.get_extraction_proof_light_client(block).await; + + (txs, inclusion_proof, completeness_proof) + } + #[instrument(level = "trace", skip_all)] async fn send_transaction( &self, @@ -1006,6 +1107,39 @@ pub fn get_relevant_blobs_from_txs( relevant_txs } +#[derive(PartialEq, Eq, PartialOrd, Ord, core::hash::Hash)] +pub struct TxidWrapper(Txid); +impl From for [u8; 32] { + fn from(val: TxidWrapper) -> Self { + val.0.to_byte_array() + } +} + +/// This function splits Proof based on its size. It is either: +/// 1: compress(borsh(DaDataLightClient::Complete(Proof))) +/// 2: +/// let compressed = compress(borsh(Proof)) +/// let chunks = compressed.chunks(MAX_TXBODY_SIZE) +/// [borsh(DaDataLightClient::Chunk(chunk)) for chunk in chunks] +fn split_proof(zk_proof: Proof) -> RawLightClientData { + let original_blob = borsh::to_vec(&zk_proof).expect("zk::Proof serialize must not fail"); + let original_compressed = compress_blob(&original_blob); + if original_compressed.len() < MAX_TXBODY_SIZE { + let data = DaDataLightClient::Complete(zk_proof); + let blob = borsh::to_vec(&data).expect("zk::Proof serialize must not fail"); + let blob = compress_blob(&blob); + RawLightClientData::Complete(blob) + } else { + let mut chunks = vec![]; + for chunk in original_compressed.chunks(MAX_TXBODY_SIZE) { + let data = DaDataLightClient::Chunk(chunk.to_vec()); + let blob = borsh::to_vec(&data).expect("zk::Proof Chunk serialize must not fail"); + chunks.push(blob) + } + RawLightClientData::Chunks(chunks) + } +} + fn calculate_witness_root(txdata: &[TransactionWrapper]) -> [u8; 32] { let hashes = txdata .iter() @@ -1051,6 +1185,49 @@ pub(crate) async fn get_fee_rate_from_mempool_space(network: bitcoin::Network) - Ok(fee_rate) } +pub fn get_relevant_blobs_from_txs_light_client( + txs: Vec, + reveal_wtxid_prefix: &[u8], +) -> Vec { + let mut relevant_txs = Vec::new(); + + for tx in txs { + if !tx + .compute_wtxid() + .to_byte_array() + .as_slice() + .starts_with(reveal_wtxid_prefix) + { + continue; + } + + if let Ok(tx) = parse_light_client_transaction(&tx) { + match tx { + ParsedLightClientTransaction::Complete(complete) => { + if let Some(hash) = complete.get_sig_verified_hash() { + let blob = decompress_blob(&complete.body); + let relevant_tx = BlobWithSender::new(blob, complete.public_key, hash); + + relevant_txs.push(relevant_tx); + } + } + ParsedLightClientTransaction::Aggregate(aggregate) => { + if let Some(hash) = aggregate.get_sig_verified_hash() { + let relevant_tx = + BlobWithSender::new(aggregate.body, aggregate.public_key, hash); + + relevant_txs.push(relevant_tx); + } + } + ParsedLightClientTransaction::Chunk(_) => { + // ignore + } + } + } + } + relevant_txs +} + #[cfg(test)] mod tests { use core::str::FromStr; diff --git a/crates/bitcoin-da/src/verifier.rs b/crates/bitcoin-da/src/verifier.rs index 35e3b9527a..27022adf56 100644 --- a/crates/bitcoin-da/src/verifier.rs +++ b/crates/bitcoin-da/src/verifier.rs @@ -2,6 +2,7 @@ use std::collections::BTreeSet; use bitcoin::hashes::Hash; use borsh::{BorshDeserialize, BorshSerialize}; +use citrea_primitives::compression::decompress_blob; use serde::{Deserialize, Serialize}; use sov_rollup_interface::da::{BlockHeaderTrait, DaSpec, DaVerifier}; use sov_rollup_interface::digest::Digest; @@ -9,7 +10,8 @@ use sov_rollup_interface::zk::ValidityCondition; use thiserror::Error; use crate::helpers::parsers::{ - parse_batch_proof_transaction, ParsedBatchProofTransaction, VerifyParsed, + parse_batch_proof_transaction, parse_light_client_transaction, ParsedBatchProofTransaction, + ParsedLightClientTransaction, VerifyParsed, }; use crate::helpers::{calculate_double_sha256, merkle_tree}; use crate::spec::BitcoinSpec; @@ -18,6 +20,7 @@ pub const WITNESS_COMMITMENT_PREFIX: &[u8] = &[0x6a, 0x24, 0xaa, 0x21, 0xa9, 0xe pub struct BitcoinVerifier { reveal_batch_prover_prefix: Vec, + reveal_light_client_prefix: Vec, } // TODO: custom errors based on our implementation @@ -79,6 +82,7 @@ impl DaVerifier for BitcoinVerifier { fn new(params: ::ChainParams) -> Self { Self { reveal_batch_prover_prefix: params.reveal_batch_prover_prefix, + reveal_light_client_prefix: params.reveal_light_client_prefix, } } @@ -237,8 +241,202 @@ impl DaVerifier for BitcoinVerifier { block_hash: block_header.block_hash().to_byte_array(), }) } + + fn verify_relevant_tx_list_light_client( + &self, + block_header: &::BlockHeader, + blobs: &[::BlobTransaction], + inclusion_proof: ::InclusionMultiProof, + completeness_proof: ::CompletenessProof, + ) -> Result<::ValidityCondition, Self::Error> { + // create hash set of blobs + let mut blobs_iter = blobs.iter(); + + let mut inclusion_iter = inclusion_proof.wtxids.iter(); + + let prefix = self.reveal_light_client_prefix.as_slice(); + // Check starting bytes tx that parsed correctly is in blobs + let mut completeness_tx_hashes = BTreeSet::new(); + + for tx in completeness_proof.iter() { + let wtxid = tx.compute_wtxid(); + // make sure it starts with the correct prefix + if !wtxid.as_byte_array().starts_with(prefix) { + return Err(ValidationError::NonRelevantTxInProof); + } + + // make sure completeness txs are ordered same in inclusion proof + // this logic always start seaching from the last found index + // ordering should be preserved naturally + let is_found_in_block = + inclusion_iter.any(|wtxid_inc| wtxid_inc == wtxid.as_byte_array()); + if !is_found_in_block { + return Err(ValidationError::RelevantTxNotFoundInBlock); + } + + // it must be parsed correctly + if let Ok(parsed_tx) = parse_light_client_transaction(tx) { + match parsed_tx { + ParsedLightClientTransaction::Complete(complete) => { + if let Some(blob_hash) = complete.get_sig_verified_hash() { + let blob = blobs_iter.next(); + + if blob.is_none() { + return Err(ValidationError::ValidBlobNotFoundInBlobs); + } + + let blob = blob.unwrap(); + if blob.hash != blob_hash { + return Err(ValidationError::BlobWasTamperedWith); + } + + if complete.public_key != blob.sender.0 { + return Err(ValidationError::IncorrectSenderInBlob); + } + + // read the supplied blob from txs + let mut blob_content = blob.blob.clone(); + blob_content.advance(blob_content.total_len()); + let blob_content = blob_content.accumulator(); + + // assert tx content is not modified + let body = decompress_blob(&complete.body); + if blob_content != body { + return Err(ValidationError::BlobContentWasModified); + } + } + } + ParsedLightClientTransaction::Aggregate(aggregate) => { + if let Some(blob_hash) = aggregate.get_sig_verified_hash() { + let blob = blobs_iter.next(); + + if blob.is_none() { + return Err(ValidationError::ValidBlobNotFoundInBlobs); + } + + let blob = blob.unwrap(); + if blob.hash != blob_hash { + return Err(ValidationError::BlobWasTamperedWith); + } + + if aggregate.public_key != blob.sender.0 { + return Err(ValidationError::IncorrectSenderInBlob); + } + + // read the supplied blob from txs + let mut blob_content = blob.blob.clone(); + blob_content.advance(blob_content.total_len()); + let blob_content = blob_content.accumulator(); + + // assert tx content is not modified + if blob_content != aggregate.body { + return Err(ValidationError::BlobContentWasModified); + } + } + } + ParsedLightClientTransaction::Chunk(_chunk) => { + // ignore + } + } + } + + completeness_tx_hashes.insert(wtxid.to_byte_array()); + } + + // assert no extra txs than the ones in the completeness proof are left + if blobs_iter.next().is_some() { + return Err(ValidationError::IncorrectCompletenessProof); + } + + // no prefix bytes left behind completeness proof + inclusion_proof.wtxids.iter().try_for_each(|wtxid| { + if wtxid.starts_with(prefix) { + // assert all prefixed transactions are included in completeness proof + if !completeness_tx_hashes.remove(wtxid) { + return Err(ValidationError::RelevantTxNotInProof); + } + } + Ok(()) + })?; + + // assert no other (irrelevant) tx is in completeness proof + if !completeness_tx_hashes.is_empty() { + return Err(ValidationError::NonRelevantTxInProof); + } + + // verify that one of the outputs of the coinbase transaction has script pub key starting with 0x6a24aa21a9ed, + // and the rest of the script pub key is the commitment of witness data. + let coinbase_tx = &inclusion_proof.coinbase_tx; + // If there are more than one scriptPubKey matching the pattern, + // the one with highest output index is assumed to be the commitment. + // That is why the iterator is reversed. + let commitment_idx = coinbase_tx.output.iter().rev().position(|output| { + output + .script_pubkey + .as_bytes() + .starts_with(WITNESS_COMMITMENT_PREFIX) + }); + match commitment_idx { + // If commitment does not exist + None => { + // Relevant txs should be empty if there is no witness data because data is inscribed in the witness + if !blobs.is_empty() { + return Err(ValidationError::InvalidBlock); + } + } + Some(mut commitment_idx) => { + let merkle_root = + merkle_tree::BitcoinMerkleTree::new(inclusion_proof.wtxids).root(); + + let input_witness_value = coinbase_tx.input[0].witness.iter().next().unwrap(); + + let mut vec_merkle = merkle_root.to_vec(); + + vec_merkle.extend_from_slice(input_witness_value); + + // check with sha256(sha256()) + let commitment = calculate_double_sha256(&vec_merkle); + + // check if the commitment is correct + // on signet there is an additional commitment after the segwit commitment + // so we check only the first 32 bytes after commitment header (bytes [2, 5]) + commitment_idx = coinbase_tx.output.len() - commitment_idx - 1; // The index is reversed + let script_pubkey = coinbase_tx.output[commitment_idx].script_pubkey.as_bytes(); + if script_pubkey[6..38] != commitment { + return Err(ValidationError::IncorrectInclusionProof); + } + } + } + + let claimed_root = merkle_tree::BitcoinMerkleTree::calculate_root_with_merkle_proof( + inclusion_proof + .coinbase_tx + .compute_txid() + .as_raw_hash() + .to_byte_array(), + 0, + inclusion_proof.coinbase_merkle_proof, + ); + + // Check that the tx root in the block header matches the tx root in the inclusion proof. + if block_header.merkle_root() != claimed_root { + return Err(ValidationError::IncorrectInclusionProof); + } + + Ok(ChainValidityCondition { + prev_hash: block_header.prev_hash().to_byte_array(), + block_hash: block_header.block_hash().to_byte_array(), + }) + } } +// impl BitcoinVerifier { +// fn verify_batch_proofs(&self, batch_proofs: &[ParsedLightClientTransaction]) -> bool { + +// return true; +// } +// } + #[cfg(test)] mod tests { diff --git a/crates/common/src/config.rs b/crates/common/src/config.rs index 7c1a91d131..153debc8dc 100644 --- a/crates/common/src/config.rs +++ b/crates/common/src/config.rs @@ -222,7 +222,7 @@ impl FromEnv for FullNodeConfig { } /// Prover configuration #[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] -pub struct ProverConfig { +pub struct BatchProverConfig { /// Prover run mode pub proving_mode: ProverGuestRunConfig, /// Average number of commitments to prove @@ -231,7 +231,21 @@ pub struct ProverConfig { pub enable_recovery: bool, } -impl Default for ProverConfig { +/// Prover configuration +/// +/// TODO: leaving as the same with batch prover config for now +/// but it will most probably have different fields in the future +#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] +pub struct LightClientProverConfig { + /// Prover run mode + pub proving_mode: ProverGuestRunConfig, + /// Average number of commitments to prove + pub proof_sampling_number: usize, + /// If true prover will try to recover ongoing proving sessions + pub enable_recovery: bool, +} + +impl Default for BatchProverConfig { fn default() -> Self { Self { proving_mode: ProverGuestRunConfig::Execute, @@ -241,9 +255,29 @@ impl Default for ProverConfig { } } -impl FromEnv for ProverConfig { +impl Default for LightClientProverConfig { + fn default() -> Self { + Self { + proving_mode: ProverGuestRunConfig::Execute, + proof_sampling_number: 0, + enable_recovery: true, + } + } +} + +impl FromEnv for BatchProverConfig { + fn from_env() -> anyhow::Result { + Ok(BatchProverConfig { + proving_mode: serde_json::from_str(&format!("\"{}\"", std::env::var("PROVING_MODE")?))?, + proof_sampling_number: std::env::var("PROOF_SAMPLING_NUMBER")?.parse()?, + enable_recovery: std::env::var("ENABLE_RECOVERY")?.parse()?, + }) + } +} + +impl FromEnv for LightClientProverConfig { fn from_env() -> anyhow::Result { - Ok(ProverConfig { + Ok(LightClientProverConfig { proving_mode: serde_json::from_str(&format!("\"{}\"", std::env::var("PROVING_MODE")?))?, proof_sampling_number: std::env::var("PROOF_SAMPLING_NUMBER")?.parse()?, enable_recovery: std::env::var("ENABLE_RECOVERY")?.parse()?, @@ -453,8 +487,8 @@ mod tests { let config_file = create_config_from(config); - let config: ProverConfig = from_toml_path(config_file.path()).unwrap(); - let expected = ProverConfig { + let config: BatchProverConfig = from_toml_path(config_file.path()).unwrap(); + let expected = BatchProverConfig { proving_mode: ProverGuestRunConfig::Skip, proof_sampling_number: 500, enable_recovery: true, @@ -511,9 +545,9 @@ mod tests { std::env::set_var("PROOF_SAMPLING_NUMBER", "500"); std::env::set_var("ENABLE_RECOVERY", "true"); - let prover_config = ProverConfig::from_env().unwrap(); + let prover_config = BatchProverConfig::from_env().unwrap(); - let expected = ProverConfig { + let expected = BatchProverConfig { proving_mode: ProverGuestRunConfig::Skip, proof_sampling_number: 500, enable_recovery: true, diff --git a/crates/common/src/da.rs b/crates/common/src/da.rs index c1c88d5480..d62384dbb2 100644 --- a/crates/common/src/da.rs +++ b/crates/common/src/da.rs @@ -6,8 +6,7 @@ use backoff::future::retry as retry_backoff; use backoff::ExponentialBackoffBuilder; use borsh::de::BorshDeserialize; use sov_rollup_interface::da::{ - BlobReaderTrait, BlockHeaderTrait, DaDataBatchProof, DaDataLightClient, DaSpec, - SequencerCommitment, + BlobReaderTrait, BlockHeaderTrait, DaDataBatchProof, DaSpec, SequencerCommitment, }; use sov_rollup_interface::services::da::{DaService, SlotData}; use sov_rollup_interface::zk::Proof; @@ -82,11 +81,7 @@ pub async fn extract_zk_proofs( .extract_relevant_proofs(&l1_block, prover_da_pub_key) .await? .into_iter() - .for_each(|data| match data { - DaDataLightClient::ZKProof(proof) => { - zk_proofs.push(proof); - } - }); + .for_each(|data| zk_proofs.push(data)); Ok(zk_proofs) } diff --git a/crates/light-client-prover/Cargo.toml b/crates/light-client-prover/Cargo.toml new file mode 100644 index 0000000000..ce6e474d8d --- /dev/null +++ b/crates/light-client-prover/Cargo.toml @@ -0,0 +1,48 @@ +[package] +name = "citrea-light-client-prover" +version.workspace = true +authors.workspace = true +edition.workspace = true +homepage.workspace = true +license.workspace = true +publish.workspace = true +repository.workspace = true + +[dependencies] +# Citrea Deps +citrea-common = { path = "../common", optional = true } +sequencer-client = { path = "../sequencer-client", optional = true } + +# Sov SDK deps +sov-db = { path = "../sovereign-sdk/full-node/db/sov-db", optional = true } +sov-modules-api = { path = "../sovereign-sdk/module-system/sov-modules-api", default-features = false } +sov-modules-rollup-blueprint = { path = "../sovereign-sdk/module-system/sov-modules-rollup-blueprint", optional = true } +sov-rollup-interface = { path = "../sovereign-sdk/rollup-interface" } +sov-stf-runner = { path = "../sovereign-sdk/full-node/sov-stf-runner", optional = true } + +# 3rd-party deps +anyhow = { workspace = true, optional = true } +borsh = { workspace = true } +hex = { workspace = true } +jsonrpsee = { workspace = true, optional = true } +tokio = { workspace = true, optional = true } +tokio-util = { workspace = true, optional = true } +tower = { workspace = true, optional = true } +tracing = { workspace = true, optional = true } + +[features] +default = [] +native = [ + "dep:citrea-common", + "dep:sequencer-client", + "dep:sov-db", + "dep:sov-modules-rollup-blueprint", + "dep:sov-stf-runner", + + "dep:anyhow", + "dep:jsonrpsee", + "dep:tokio", + "dep:tokio-util", + "dep:tower", + "dep:tracing", +] diff --git a/crates/light-client-prover/src/circuit.rs b/crates/light-client-prover/src/circuit.rs new file mode 100644 index 0000000000..8fc4d830d6 --- /dev/null +++ b/crates/light-client-prover/src/circuit.rs @@ -0,0 +1,55 @@ +use borsh::BorshDeserialize; +use sov_modules_api::BlobReaderTrait; +use sov_rollup_interface::da::{DaDataLightClient, DaVerifier}; + +use crate::input::LightClientCircuitInput; +use crate::output::LightClientCircuitOutput; + +#[derive(Debug)] +pub enum LightClientVerificationError { + DaTxsCouldntBeVerified, +} + +pub fn run_circuit( + input: LightClientCircuitInput, + da_verifier: DaV, +) -> Result { + // Veriy data from da + let _validity_condition = da_verifier + .verify_relevant_tx_list_light_client( + &input.da_block_header, + input.da_data.as_slice(), + input.inclusion_proof, + input.completeness_proof, + ) + .map_err(|_| LightClientVerificationError::DaTxsCouldntBeVerified)?; + + let mut complete_proofs = vec![]; + // Try parsing the data + for blob in input.da_data { + if blob.sender().as_ref() == input.batch_prover_da_pub_key { + let data = DaDataLightClient::try_from_slice(blob.verified_data()); + + if let Ok(data) = data { + match data { + DaDataLightClient::Complete(proof) => { + complete_proofs.push(proof); + } + DaDataLightClient::Aggregate(_) => todo!(), + DaDataLightClient::Chunk(_) => todo!(), + } + } + } + } + + // do what you want with proofs + // complete proof has raw bytes inside + // to extract *and* verift the proof you need to use the zkguest + // can be passed from the guest code to this function + + Ok(LightClientCircuitOutput { + state_root: [1; 32], + }) + + // First +} diff --git a/crates/light-client-prover/src/da_block_handler.rs b/crates/light-client-prover/src/da_block_handler.rs new file mode 100644 index 0000000000..d36b9f25b3 --- /dev/null +++ b/crates/light-client-prover/src/da_block_handler.rs @@ -0,0 +1,285 @@ +use std::collections::{HashMap, VecDeque}; +use std::sync::Arc; + +use borsh::BorshDeserialize; +use citrea_common::cache::L1BlockCache; +use citrea_common::da::get_da_block_at_height; +use citrea_common::LightClientProverConfig; +use sov_db::ledger_db::{LightClientProverLedgerOps, SharedLedgerOps}; +use sov_db::schema::types::SlotNumber; +use sov_modules_api::{BlobReaderTrait, DaSpec, Zkvm}; +use sov_rollup_interface::da::{BlockHeaderTrait, DaDataLightClient}; +use sov_rollup_interface::services::da::{DaService, SlotData}; +use sov_rollup_interface::spec::SpecId; +use sov_rollup_interface::zk::ZkvmHost; +use sov_stf_runner::ProverService; +use tokio::select; +use tokio::sync::{mpsc, Mutex}; +use tokio::time::{sleep, Duration}; +use tokio_util::sync::CancellationToken; +use tracing::{error, info}; + +use crate::input::LightClientCircuitInput; +use crate::output::LightClientCircuitOutput; + +pub(crate) struct L1BlockHandler +where + Da: DaService, + Vm: ZkvmHost + Zkvm, + DB: LightClientProverLedgerOps + SharedLedgerOps + Clone, + Ps: ProverService, +{ + _prover_config: LightClientProverConfig, + prover_service: Arc, + ledger_db: DB, + da_service: Arc, + batch_prover_da_pub_key: Vec, + _batch_proof_code_commitments_by_spec: HashMap, + _light_client_proof_code_commitment: Vm::CodeCommitment, + l1_block_cache: Arc>>, + queued_l1_blocks: VecDeque<::FilteredBlock>, +} + +impl L1BlockHandler +where + Da: DaService, + Vm: ZkvmHost + Zkvm, + Ps: ProverService, + DB: LightClientProverLedgerOps + SharedLedgerOps + Clone, +{ + #[allow(clippy::too_many_arguments)] + pub fn new( + prover_config: LightClientProverConfig, + prover_service: Arc, + ledger_db: DB, + da_service: Arc, + batch_prover_da_pub_key: Vec, + batch_proof_code_commitments_by_spec: HashMap, + light_client_proof_code_commitment: Vm::CodeCommitment, + ) -> Self { + Self { + _prover_config: prover_config, + prover_service, + ledger_db, + da_service, + batch_prover_da_pub_key, + _batch_proof_code_commitments_by_spec: batch_proof_code_commitments_by_spec, + _light_client_proof_code_commitment: light_client_proof_code_commitment, + l1_block_cache: Arc::new(Mutex::new(L1BlockCache::new())), + queued_l1_blocks: VecDeque::new(), + } + } + + pub async fn run(mut self, start_l1_height: u64, cancellation_token: CancellationToken) { + // if self.prover_config.enable_recovery { + // if let Err(e) = self.check_and_recover_ongoing_proving_sessions().await { + // error!("Failed to recover ongoing proving sessions: {:?}", e); + // } + // } else { + // // If recovery is disabled, clear pending proving sessions + // self.ledger_db + // .clear_pending_proving_sessions() + // .expect("Failed to clear pending proving sessions"); + // } + + let (l1_tx, mut l1_rx) = mpsc::channel(1); + let l1_sync_worker = sync_l1( + start_l1_height, + self.da_service.clone(), + l1_tx, + self.l1_block_cache.clone(), + ); + tokio::pin!(l1_sync_worker); + + let mut interval = tokio::time::interval(Duration::from_secs(2)); + interval.tick().await; + loop { + select! { + biased; + _ = cancellation_token.cancelled() => { + return; + } + _ = &mut l1_sync_worker => {}, + Some(l1_block) = l1_rx.recv() => { + self.queued_l1_blocks.push_back(l1_block); + }, + _ = interval.tick() => { + if let Err(e) = self.process_queued_l1_blocks().await { + error!("Could not process queued L1 blocks and generate proof: {:?}", e); + } + }, + } + } + } + + async fn process_queued_l1_blocks(&mut self) -> Result<(), anyhow::Error> { + while !self.queued_l1_blocks.is_empty() { + let l1_block = self + .queued_l1_blocks + .front() + .expect("Pending l1 blocks cannot be empty"); + + self.process_l1_block(l1_block).await?; + + self.queued_l1_blocks.pop_front(); + } + + Ok(()) + } + + async fn process_l1_block(&self, l1_block: &Da::FilteredBlock) -> anyhow::Result<()> { + let l1_hash = l1_block.header().hash().into(); + let l1_height = l1_block.header().height(); + + // Set the l1 height of the l1 hash + self.ledger_db + .set_l1_height_of_l1_hash(l1_hash, l1_height) + .expect("Setting l1 height of l1 hash in ledger db"); + + let mut da_data: Vec<<::Spec as DaSpec>::BlobTransaction> = self + .da_service + .extract_relevant_blobs_light_client(l1_block); + + let batch_proofs = self.extract_batch_proofs(&mut da_data, l1_hash).await; + tracing::info!( + "Block {} has {} batch proofs", + l1_height, + batch_proofs.len() + ); + + // Do any kind of ordering etc. on batch proofs here + // If you do so, don't forget to do the same inside zk + + let circuit_input = self.create_circuit_input(da_data, l1_block).await; + + let circuit_output = self.prove(circuit_input).await?; + + tracing::info!( + "Generated proof for L1 block: {l1_height} output={:?}", + circuit_output + ); + + self.ledger_db + .set_last_scanned_l1_height(SlotNumber(l1_block.header().height())) + .expect("Saving last scanned l1 height to ledger db"); + + Ok(()) + } + + async fn extract_batch_proofs( + &self, + da_data: &mut [<::Spec as DaSpec>::BlobTransaction], + da_slot_hash: [u8; 32], // passing this as an argument is not clever + ) -> Vec { + let mut batch_proofs = Vec::new(); + + da_data.iter_mut().for_each(|tx| { + // Check for commitment + if tx.sender().as_ref() == self.batch_prover_da_pub_key.as_slice() { + let data = DaDataLightClient::try_from_slice(tx.full_data()); + + if let Ok(proof) = data { + batch_proofs.push(proof); + } else { + tracing::warn!( + "Found broken DA data in block 0x{}: {:?}", + hex::encode(da_slot_hash), + data + ); + } + } + }); + + batch_proofs + } + + async fn create_circuit_input( + &self, + da_data: Vec<<::Spec as DaSpec>::BlobTransaction>, + l1_block: &Da::FilteredBlock, + ) -> LightClientCircuitInput { + let (inclusion_proof, completeness_proof) = self + .da_service + .get_extraction_proof_light_client(l1_block) + .await; + + LightClientCircuitInput { + da_data, + inclusion_proof, + completeness_proof, + da_block_header: l1_block.header().clone(), + batch_prover_da_pub_key: self.batch_prover_da_pub_key.clone(), + } + } + + async fn prove( + &self, + circuit_input: LightClientCircuitInput<::Spec>, + ) -> Result { + let da_slot_hash = circuit_input.da_block_header.hash(); + let prover_service = self.prover_service.as_ref(); + + prover_service + .submit_witness(borsh::to_vec(&circuit_input)?, da_slot_hash.clone()) + .await; + + prover_service.prove(da_slot_hash.clone()).await?; + + let output: LightClientCircuitOutput = prover_service + .wait_for_proving_and_extract_output(da_slot_hash) + .await?; + + Ok(output) + } +} + +async fn sync_l1( + start_l1_height: u64, + da_service: Arc, + sender: mpsc::Sender, + l1_block_cache: Arc>>, +) where + Da: DaService, +{ + let mut l1_height = start_l1_height; + info!("Starting to sync from L1 height {}", l1_height); + + 'block_sync: loop { + // TODO: for a node, the da block at slot_height might not have been finalized yet + // should wait for it to be finalized + let last_finalized_l1_block_header = + match da_service.get_last_finalized_block_header().await { + Ok(header) => header, + Err(e) => { + error!("Could not fetch last finalized L1 block header: {}", e); + sleep(Duration::from_secs(2)).await; + continue; + } + }; + + let new_l1_height = last_finalized_l1_block_header.height(); + + for block_number in l1_height + 1..=new_l1_height { + let l1_block = + match get_da_block_at_height(&da_service, block_number, l1_block_cache.clone()) + .await + { + Ok(block) => block, + Err(e) => { + error!("Could not fetch last finalized L1 block: {}", e); + sleep(Duration::from_secs(2)).await; + continue 'block_sync; + } + }; + if block_number > l1_height { + l1_height = block_number; + if let Err(e) = sender.send(l1_block).await { + error!("Could not notify about L1 block: {}", e); + continue 'block_sync; + } + } + } + + sleep(Duration::from_secs(2)).await; + } +} diff --git a/crates/light-client-prover/src/input.rs b/crates/light-client-prover/src/input.rs new file mode 100644 index 0000000000..491236ef65 --- /dev/null +++ b/crates/light-client-prover/src/input.rs @@ -0,0 +1,12 @@ +use borsh::{BorshDeserialize, BorshSerialize}; +use sov_rollup_interface::da::DaSpec; + +#[derive(BorshDeserialize, BorshSerialize)] +pub struct LightClientCircuitInput { + pub da_data: Vec, + pub inclusion_proof: Da::InclusionMultiProof, + pub completeness_proof: Da::CompletenessProof, + pub da_block_header: Da::BlockHeader, + + pub batch_prover_da_pub_key: Vec, +} diff --git a/crates/light-client-prover/src/lib.rs b/crates/light-client-prover/src/lib.rs new file mode 100644 index 0000000000..5a88f394d6 --- /dev/null +++ b/crates/light-client-prover/src/lib.rs @@ -0,0 +1,8 @@ +pub mod circuit; +pub mod input; +pub mod output; + +#[cfg(feature = "native")] +pub mod da_block_handler; +#[cfg(feature = "native")] +pub mod runner; diff --git a/crates/light-client-prover/src/output.rs b/crates/light-client-prover/src/output.rs new file mode 100644 index 0000000000..8b5e353d00 --- /dev/null +++ b/crates/light-client-prover/src/output.rs @@ -0,0 +1,6 @@ +use borsh::{BorshDeserialize, BorshSerialize}; + +#[derive(Debug, Clone, BorshDeserialize, BorshSerialize)] +pub struct LightClientCircuitOutput { + pub state_root: [u8; 32], +} diff --git a/crates/light-client-prover/src/runner.rs b/crates/light-client-prover/src/runner.rs new file mode 100644 index 0000000000..757b7bd4f7 --- /dev/null +++ b/crates/light-client-prover/src/runner.rs @@ -0,0 +1,236 @@ +use std::collections::HashMap; +use std::net::SocketAddr; +use std::sync::Arc; + +use citrea_common::tasks::manager::TaskManager; +use citrea_common::{LightClientProverConfig, RollupPublicKeys, RpcConfig, RunnerConfig}; +use jsonrpsee::server::{BatchRequestConfig, ServerBuilder}; +use jsonrpsee::RpcModule; +use sequencer_client::SequencerClient; +use sov_db::ledger_db::{LedgerDB, LightClientProverLedgerOps, SharedLedgerOps}; +use sov_db::schema::types::SlotNumber; +use sov_modules_api::DaSpec; +use sov_modules_rollup_blueprint::RollupBlueprint; +use sov_rollup_interface::services::da::DaService; +use sov_rollup_interface::spec::SpecId; +use sov_rollup_interface::zk::ZkvmHost; +use sov_stf_runner::ProverService; +use tokio::signal; +use tokio::sync::oneshot; +use tracing::{error, info, instrument}; + +use crate::da_block_handler::L1BlockHandler; + +/// Dependencies needed to run the rollup. +pub struct LightClientProver { + /// The State Transition Runner. + #[allow(clippy::type_complexity)] + pub runner: CitreaLightClientProver, + /// Rpc methods for the rollup. + pub rpc_methods: jsonrpsee::RpcModule<()>, +} + +impl LightClientProver { + /// Runs the rollup. + #[instrument(level = "trace", skip_all, err, ret(level = "error"))] + pub async fn run(self) -> Result<(), anyhow::Error> { + self.run_and_report_rpc_port(None).await + } + + /// Only run the rpc. + pub async fn run_rpc(mut self) -> Result<(), anyhow::Error> { + self.runner.start_rpc_server(self.rpc_methods, None).await; + Ok(()) + } + + /// Runs the rollup. Reports rpc port to the caller using the provided channel. + pub async fn run_and_report_rpc_port( + self, + channel: Option>, + ) -> Result<(), anyhow::Error> { + let mut runner = self.runner; + runner.start_rpc_server(self.rpc_methods, channel).await; + + runner.run().await?; + Ok(()) + } +} + +pub struct CitreaLightClientProver +where + Da: DaService + Send + Sync, + Vm: ZkvmHost, + Ps: ProverService, + DB: LightClientProverLedgerOps + SharedLedgerOps + Clone, +{ + _runner_config: RunnerConfig, + public_keys: RollupPublicKeys, + rpc_config: RpcConfig, + da_service: Arc, + ledger_db: DB, + sequencer_client: SequencerClient, + prover_service: Arc, + prover_config: LightClientProverConfig, + task_manager: TaskManager<()>, + batch_proof_commitments_by_spec: HashMap, + light_client_proof_commitment: Vm::CodeCommitment, +} + +impl CitreaLightClientProver +where + Da: DaService + Send + Sync + 'static, + Vm: ZkvmHost, + Ps: ProverService + Send + Sync + 'static, + DB: LightClientProverLedgerOps + SharedLedgerOps + Clone + 'static, +{ + #[allow(clippy::too_many_arguments)] + pub fn new( + runner_config: RunnerConfig, + public_keys: RollupPublicKeys, + rpc_config: RpcConfig, + da_service: Arc, + ledger_db: DB, + prover_service: Arc, + prover_config: LightClientProverConfig, + batch_proof_commitments_by_spec: HashMap, + light_client_proof_commitment: Vm::CodeCommitment, + ) -> Result { + let sequencer_client_url = runner_config.sequencer_client_url.clone(); + Ok(Self { + _runner_config: runner_config, + public_keys, + rpc_config, + da_service, + ledger_db, + sequencer_client: SequencerClient::new(sequencer_client_url), + prover_service, + prover_config, + task_manager: TaskManager::default(), + batch_proof_commitments_by_spec, + light_client_proof_commitment, + }) + } + + /// Starts a RPC server with provided rpc methods. + pub async fn start_rpc_server( + &mut self, + methods: RpcModule<()>, + channel: Option>, + ) { + let bind_host = match self.rpc_config.bind_host.parse() { + Ok(bind_host) => bind_host, + Err(e) => { + error!("Failed to parse bind host: {}", e); + return; + } + }; + let listen_address = SocketAddr::new(bind_host, self.rpc_config.bind_port); + + let max_connections = self.rpc_config.max_connections; + let max_subscriptions_per_connection = self.rpc_config.max_subscriptions_per_connection; + let max_request_body_size = self.rpc_config.max_request_body_size; + let max_response_body_size = self.rpc_config.max_response_body_size; + let batch_requests_limit = self.rpc_config.batch_requests_limit; + + let middleware = tower::ServiceBuilder::new().layer(citrea_common::rpc::get_cors_layer()); + // .layer(citrea_common::rpc::get_healthcheck_proxy_layer()); + + self.task_manager.spawn(|cancellation_token| async move { + let server = ServerBuilder::default() + .max_connections(max_connections) + .max_subscriptions_per_connection(max_subscriptions_per_connection) + .max_request_body_size(max_request_body_size) + .max_response_body_size(max_response_body_size) + .set_batch_request_config(BatchRequestConfig::Limit(batch_requests_limit)) + .set_http_middleware(middleware) + .build([listen_address].as_ref()) + .await; + + match server { + Ok(server) => { + let bound_address = match server.local_addr() { + Ok(address) => address, + Err(e) => { + error!("{}", e); + return; + } + }; + if let Some(channel) = channel { + if let Err(e) = channel.send(bound_address) { + error!("Could not send bound_address {}: {}", bound_address, e); + return; + } + } + info!("Starting RPC server at {} ", &bound_address); + + let _server_handle = server.start(methods); + cancellation_token.cancelled().await; + } + Err(e) => { + error!("Could not start RPC server: {}", e); + } + } + }); + } + + /// Runs the rollup. + #[instrument(level = "trace", skip_all, err)] + pub async fn run(&mut self) -> Result<(), anyhow::Error> { + let last_l1_height_scanned = match self.ledger_db.get_last_scanned_l1_height()? { + Some(l1_height) => l1_height, + // If not found, start from the first L2 block's L1 height + None => SlotNumber(get_initial_da_height::(&self.sequencer_client).await), + }; + + let prover_config = self.prover_config.clone(); + let prover_service = self.prover_service.clone(); + let ledger_db = self.ledger_db.clone(); + let da_service = self.da_service.clone(); + let batch_prover_da_pub_key = self.public_keys.prover_da_pub_key.clone(); + let batch_proof_commitments_by_spec = self.batch_proof_commitments_by_spec.clone(); + let light_client_proof_commitment = self.light_client_proof_commitment.clone(); + + self.task_manager.spawn(|cancellation_token| async move { + let l1_block_handler = L1BlockHandler::::new( + prover_config, + prover_service, + ledger_db, + da_service, + batch_prover_da_pub_key, + batch_proof_commitments_by_spec, + light_client_proof_commitment, + ); + l1_block_handler + .run(last_l1_height_scanned.0, cancellation_token) + .await + }); + + // Temporary fix + signal::ctrl_c().await.expect("Failed to listen ctrl+c"); + Ok(()) + + // TODO: update this once l2 sync is implemented + // loop { + // select! { + // _ = signal::ctrl_c() => { + // info!("Shutting down"); + // self.task_manager.abort().await; + // return Ok(()); + // } + // } + // } + } +} + +async fn get_initial_da_height(client: &SequencerClient) -> u64 { + loop { + match client.get_soft_confirmation::(1).await { + Ok(Some(batch)) => return batch.da_slot_height, + _ => { + // sleep 1 + tokio::time::sleep(std::time::Duration::from_secs(1)).await; + continue; + } + } + } +} diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index bfff6c3059..01d181921e 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -13,7 +13,7 @@ sov-rollup-interface = { path = "../sovereign-sdk/rollup-interface" } # 3rd-party deps alloy-eips = { workspace = true } anyhow = { workspace = true } -brotli = { workspace = true, optional = true } +brotli = { workspace = true } reth-primitives = { workspace = true } serde = { workspace = true, optional = true } tokio = { workspace = true, optional = true } @@ -26,7 +26,6 @@ sov-rollup-interface = { path = "../sovereign-sdk/rollup-interface", features = [features] native = [ "dep:serde", - "dep:brotli", "dep:tokio", "dep:tracing", "sov-rollup-interface/native", diff --git a/crates/primitives/src/lib.rs b/crates/primitives/src/lib.rs index e8e90e5358..d46c26629e 100644 --- a/crates/primitives/src/lib.rs +++ b/crates/primitives/src/lib.rs @@ -1,5 +1,4 @@ pub mod basefee; -#[cfg(feature = "native")] pub mod compression; mod constants; pub mod forks; diff --git a/crates/prover-services/Cargo.toml b/crates/prover-services/Cargo.toml new file mode 100644 index 0000000000..9c3b35dd57 --- /dev/null +++ b/crates/prover-services/Cargo.toml @@ -0,0 +1,48 @@ +[package] +name = "prover-services" +version.workspace = true +authors.workspace = true +edition.workspace = true +homepage.workspace = true +license.workspace = true +publish.workspace = true +repository.workspace = true + +[dependencies] +# Citrea Deps +citrea-primitives = { path = "../primitives", features = ["native"] } +citrea-stf = { path = "../citrea-stf" } + +# Sov SDK deps +sov-db = { path = "../sovereign-sdk/full-node/db/sov-db" } +sov-modules-api = { path = "../sovereign-sdk/module-system/sov-modules-api", default-features = false } +sov-rollup-interface = { path = "../sovereign-sdk/rollup-interface" } +sov-stf-runner = { path = "../sovereign-sdk/full-node/sov-stf-runner" } + +# 3rd-party deps +anyhow = { workspace = true } +async-trait = { workspace = true } +bincode = { workspace = true } +borsh = { workspace = true } +futures = { workspace = true } +hex = { workspace = true } +jsonrpsee = { workspace = true } +num_cpus = { workspace = true } +parking_lot = { workspace = true } +rand = { workspace = true } +rayon = { workspace = true } +risc0-zkvm = { workspace = true } +rs_merkle = { workspace = true } +serde = { workspace = true } +tokio = { workspace = true } +tokio-util = { workspace = true } +tower = { workspace = true } +tracing = { workspace = true } + +[dev-dependencies] +sha2 = { workspace = true } +tempfile = { workspace = true } + +sov-stf-runner = { path = "../sovereign-sdk/full-node/sov-stf-runner", features = ["mock"] } + +citrea-stf = { path = "../citrea-stf", features = ["native"] } diff --git a/crates/prover/src/prover_service/mod.rs b/crates/prover-services/src/lib.rs similarity index 100% rename from crates/prover/src/prover_service/mod.rs rename to crates/prover-services/src/lib.rs diff --git a/crates/prover/src/prover_service/parallel/mod.rs b/crates/prover-services/src/parallel/mod.rs similarity index 71% rename from crates/prover/src/prover_service/parallel/mod.rs rename to crates/prover-services/src/parallel/mod.rs index 8b61796b98..fc9dd12fd5 100644 --- a/crates/prover/src/prover_service/parallel/mod.rs +++ b/crates/prover-services/src/parallel/mod.rs @@ -2,31 +2,27 @@ mod prover; use std::sync::Arc; use async_trait::async_trait; -use borsh::{BorshDeserialize, BorshSerialize}; -use citrea_common::config::ProverConfig; +use borsh::BorshDeserialize; use citrea_stf::verifier::StateTransitionVerifier; use parking_lot::Mutex; use prover::Prover; -use serde::de::DeserializeOwned; -use serde::Serialize; +use risc0_zkvm::{Journal, Receipt}; use sov_db::ledger_db::{LedgerDB, ProvingServiceLedgerOps}; use sov_rollup_interface::da::{DaData, DaSpec}; use sov_rollup_interface::services::da::DaService; use sov_rollup_interface::stf::StateTransitionFunction; -use sov_rollup_interface::zk::{Proof, StateTransitionData, ZkvmHost}; +use sov_rollup_interface::zk::{Proof, ZkvmHost}; use sov_stf_runner::{ ProofProcessingStatus, ProverGuestRunConfig, ProverService, ProverServiceError, WitnessSubmissionStatus, }; use self::prover::ProverStatus; -use crate::prover_service::ProofGenConfig; +use crate::ProofGenConfig; /// Prover service that generates proofs in parallel. -pub struct ParallelProverService +pub struct ParallelProverService where - StateRoot: Serialize + DeserializeOwned + Clone + AsRef<[u8]>, - Witness: Serialize + DeserializeOwned, Da: DaService, Vm: ZkvmHost, V: StateTransitionFunction + Send + Sync, @@ -35,23 +31,12 @@ where prover_config: Arc>>, zk_storage: V::PreState, - prover_state: Prover, + prover_state: Prover, ledger_db: LedgerDB, } -impl ParallelProverService +impl ParallelProverService where - StateRoot: BorshSerialize - + BorshDeserialize - + Serialize - + DeserializeOwned - + Clone - + AsRef<[u8]> - + Send - + Sync - + 'static, - Witness: - BorshSerialize + BorshDeserialize + Serialize + DeserializeOwned + Send + Sync + 'static, Da: DaService, Vm: ZkvmHost, V: StateTransitionFunction + Send + Sync, @@ -109,7 +94,7 @@ where vm: Vm, zk_stf: V, da_verifier: Da::Verifier, - prover_config: ProverConfig, + proving_mode: ProverGuestRunConfig, zk_storage: V::PreState, ledger_db: LedgerDB, ) -> anyhow::Result { @@ -120,7 +105,7 @@ where vm, zk_stf, da_verifier, - prover_config.proving_mode, + proving_mode, zk_storage, num_cpus - 1, ledger_db, @@ -129,40 +114,21 @@ where } #[async_trait] -impl ProverService - for ParallelProverService +impl ProverService for ParallelProverService where - StateRoot: BorshSerialize - + BorshDeserialize - + Serialize - + DeserializeOwned - + Clone - + AsRef<[u8]> - + Send - + Sync - + 'static, - Witness: - BorshSerialize + BorshDeserialize + Serialize + DeserializeOwned + Send + Sync + 'static, Da: DaService, Vm: ZkvmHost + 'static, V: StateTransitionFunction + Send + Sync + 'static, V::PreState: Clone + Send + Sync, { - type StateRoot = StateRoot; - - type Witness = Witness; - type DaService = Da; async fn submit_witness( &self, - state_transition_data: StateTransitionData< - Self::StateRoot, - Self::Witness, - ::Spec, - >, + input: Vec, + da_slot_hash: ::SlotHash, ) -> WitnessSubmissionStatus { - self.prover_state.submit_witness(state_transition_data) + self.prover_state.submit_witness(input, da_slot_hash) } async fn prove( @@ -181,35 +147,46 @@ where ) } + async fn wait_for_proving_and_extract_output( + &self, + block_header_hash: ::SlotHash, + ) -> Result { + let proof = self.wait_for_proof(block_header_hash).await?; + + // TODO: maybe extract this to Vm? + // Extract journal + let journal = match proof { + Proof::PublicInput(journal) => { + let journal: Journal = bincode::deserialize(&journal)?; + journal + } + Proof::Full(data) => { + let receipt: Receipt = bincode::deserialize(&data)?; + receipt.journal + } + }; + + self.ledger_db.clear_pending_proving_sessions()?; + + Ok(T::try_from_slice(&journal.bytes)?) + } + async fn wait_for_proving_and_send_to_da( &self, block_header_hash: ::SlotHash, da_service: &Arc, ) -> Result<(::TransactionId, Proof), anyhow::Error> { - loop { - let status = self - .prover_state - .get_prover_status_for_da_submission(block_header_hash.clone())?; + let proof = self.wait_for_proof(block_header_hash).await?; + let da_data = DaData::ZKProof(proof.clone()); - match status { - ProverStatus::Proved(proof) => { - let da_data = DaData::ZKProof(proof.clone()); - - let tx_id = da_service - .send_transaction(da_data) - .await - .map_err(|e| anyhow::anyhow!(e))?; - self.ledger_db.clear_pending_proving_sessions()?; - break Ok((tx_id, proof)); - } - ProverStatus::ProvingInProgress => { - tokio::time::sleep(std::time::Duration::from_secs(5)).await; - } - _ => { - // function will not return any other type of status - } - } - } + let tx_id = da_service + .send_transaction(da_data) + .await + .map_err(|e| anyhow::anyhow!(e))?; + + self.ledger_db.clear_pending_proving_sessions()?; + + Ok((tx_id, proof)) } async fn recover_proving_sessions_and_send_to_da( @@ -235,3 +212,32 @@ where Ok(results) } } + +impl ParallelProverService +where + Da: DaService, + Vm: ZkvmHost + 'static, + V: StateTransitionFunction + Send + Sync + 'static, + V::PreState: Clone + Send + Sync, +{ + async fn wait_for_proof( + &self, + block_header_hash: ::SlotHash, + ) -> anyhow::Result { + loop { + let status = self + .prover_state + .get_prover_status_for_da_submission(block_header_hash.clone())?; + + match status { + ProverStatus::Proved(proof) => break Ok(proof), + ProverStatus::ProvingInProgress => { + tokio::time::sleep(std::time::Duration::from_secs(5)).await; + } + _ => { + // function will not return any other type of status + } + } + } + } +} diff --git a/crates/prover/src/prover_service/parallel/prover.rs b/crates/prover-services/src/parallel/prover.rs similarity index 79% rename from crates/prover/src/prover_service/parallel/prover.rs rename to crates/prover-services/src/parallel/prover.rs index 07802c0add..4a74ceca48 100644 --- a/crates/prover/src/prover_service/parallel/prover.rs +++ b/crates/prover-services/src/parallel/prover.rs @@ -4,40 +4,34 @@ use std::ops::DerefMut; use std::sync::Arc; use anyhow::anyhow; -use borsh::{BorshDeserialize, BorshSerialize}; use parking_lot::Mutex; -use serde::de::DeserializeOwned; -use serde::Serialize; -use sov_rollup_interface::da::{BlockHeaderTrait, DaSpec}; +use sov_rollup_interface::da::DaSpec; use sov_rollup_interface::services::da::DaService; use sov_rollup_interface::stf::StateTransitionFunction; -use sov_rollup_interface::zk::{Proof, StateTransitionData, ZkvmHost}; +use sov_rollup_interface::zk::{Proof, ZkvmHost}; use sov_stf_runner::{ProofProcessingStatus, ProverServiceError, WitnessSubmissionStatus}; -use crate::prover_service::ProofGenConfig; +use crate::ProofGenConfig; -pub(crate) enum ProverStatus { - WitnessSubmitted(StateTransitionData), +pub(crate) enum ProverStatus { + WitnessSubmitted(Vec), ProvingInProgress, #[allow(dead_code)] Proved(Proof), Err(anyhow::Error), } -struct ProverState { - prover_status: HashMap>, +struct ProverState { + prover_status: HashMap, pending_tasks_count: usize, } -impl ProverState { - fn remove(&mut self, hash: &Da::SlotHash) -> Option> { +impl ProverState { + fn remove(&mut self, hash: &Da::SlotHash) -> Option { self.prover_status.remove(hash) } - fn set_to_proving( - &mut self, - hash: Da::SlotHash, - ) -> Option> { + fn set_to_proving(&mut self, hash: Da::SlotHash) -> Option { self.prover_status .insert(hash, ProverStatus::ProvingInProgress) } @@ -46,17 +40,14 @@ impl ProverState { &mut self, hash: Da::SlotHash, proof: Result, - ) -> Option> { + ) -> Option { match proof { Ok(p) => self.prover_status.insert(hash, ProverStatus::Proved(p)), Err(e) => self.prover_status.insert(hash, ProverStatus::Err(e)), } } - fn get_prover_status( - &self, - hash: Da::SlotHash, - ) -> Option<&ProverStatus> { + fn get_prover_status(&self, hash: Da::SlotHash) -> Option<&ProverStatus> { self.prover_status.get(&hash) } @@ -77,26 +68,15 @@ impl ProverState { // A prover that generates proofs in parallel using a thread pool. If the pool is saturated, // the prover will reject new jobs. -pub(crate) struct Prover { - prover_state: Arc>>, +pub(crate) struct Prover { + prover_state: Arc>>, num_threads: usize, pool: rayon::ThreadPool, } -impl Prover +impl Prover where Da: DaService, - StateRoot: BorshSerialize - + BorshDeserialize - + Serialize - + DeserializeOwned - + Clone - + AsRef<[u8]> - + Send - + Sync - + 'static, - Witness: - BorshSerialize + BorshDeserialize + Serialize + DeserializeOwned + Send + Sync + 'static, { pub(crate) fn new(num_threads: usize) -> anyhow::Result { Ok(Self { @@ -115,10 +95,11 @@ where pub(crate) fn submit_witness( &self, - state_transition_data: StateTransitionData, + input: Vec, + da_slot_hash: ::SlotHash, ) -> WitnessSubmissionStatus { - let header_hash = state_transition_data.da_block_header_of_commitments.hash(); - let data = ProverStatus::WitnessSubmitted(state_transition_data); + let header_hash = da_slot_hash; + let data = ProverStatus::WitnessSubmitted(input); let mut prover_state = self.prover_state.lock(); let entry = prover_state.prover_status.entry(header_hash); @@ -192,7 +173,7 @@ where pub(crate) fn get_prover_status_for_da_submission( &self, block_header_hash: ::SlotHash, - ) -> Result, anyhow::Error> { + ) -> Result { let mut prover_state = self.prover_state.lock(); let status = prover_state.get_prover_status(block_header_hash.clone()); diff --git a/crates/risc0-bonsai/src/host.rs b/crates/risc0-bonsai/src/host.rs index 50fad19e8b..b6dc45a038 100644 --- a/crates/risc0-bonsai/src/host.rs +++ b/crates/risc0-bonsai/src/host.rs @@ -281,14 +281,11 @@ impl<'a> Risc0BonsaiHost<'a> { impl<'a> ZkvmHost for Risc0BonsaiHost<'a> { type Guest = Risc0Guest; - fn add_hint(&mut self, item: T) { - // For running in "execute" mode. - - let buf = borsh::to_vec(&item).expect("Risc0 hint serialization is infallible"); - info!("Added hint to guest with size {}", buf.len()); + fn add_hint(&mut self, item: Vec) { + info!("Added hint to guest with size {}", item.len()); // write buf - self.env.extend_from_slice(&buf); + self.env.extend_from_slice(&item); } /// Guest simulation (execute mode) is run inside the Risc0 VM locally diff --git a/crates/sovereign-sdk/adapters/mock-da/src/service.rs b/crates/sovereign-sdk/adapters/mock-da/src/service.rs index d14e74a0e1..21f1e4cd62 100644 --- a/crates/sovereign-sdk/adapters/mock-da/src/service.rs +++ b/crates/sovereign-sdk/adapters/mock-da/src/service.rs @@ -12,11 +12,11 @@ use sov_rollup_interface::da::{ BlobReaderTrait, BlockHeaderTrait, DaData, DaDataBatchProof, DaDataLightClient, DaSpec, Time, }; use sov_rollup_interface::services::da::{DaService, SenderWithNotifier, SlotData}; -use tokio::sync::broadcast::Receiver; -use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender}; +use sov_rollup_interface::zk::Proof; +use tokio::sync::mpsc::{unbounded_channel, UnboundedSender}; use tokio::sync::{broadcast, Mutex as AsyncMutex, MutexGuard as AsyncMutexGuard}; -use tokio::{select, time}; -use tokio_util::sync::CancellationToken; +use tokio::time; +use tracing::instrument::Instrument; use crate::db_connector::DbConnector; use crate::types::{MockAddress, MockBlob, MockBlock, MockDaVerifier}; @@ -63,38 +63,11 @@ impl PlannedFork { } } -#[pin_project] -/// Stream of finalized headers -pub struct MockDaBlockHeaderStream { - #[pin] - inner: tokio_stream::wrappers::BroadcastStream, -} - -impl MockDaBlockHeaderStream { - /// Create new stream of finalized headers - pub fn new(receiver: broadcast::Receiver) -> Self { - Self { - inner: tokio_stream::wrappers::BroadcastStream::new(receiver), - } - } -} - -impl futures::Stream for MockDaBlockHeaderStream { - type Item = Result; - - fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - let this = self.project(); // Requires the pin-project crate or similar functionality - this.inner - .poll_next(cx) - .map(|opt| opt.map(|res| res.map_err(Into::into))) - } -} - +#[derive(Clone)] /// DaService used in tests. /// Currently only supports single blob per block. /// Height of the first submitted block is 1. /// Submitted blocks are kept indefinitely in memory. -#[derive(Clone)] pub struct MockDaService { sequencer_da_address: MockAddress, // don't need a mutex, but DaService trait requires it by Sync trait @@ -103,12 +76,8 @@ pub struct MockDaService { blocks_to_finality: u32, /// Used for calculating correct finality from state of `blocks` finalized_header_sender: broadcast::Sender, - /// Used for sending transactions - transaction_queue_sender: - UnboundedSender::TransactionId>>>, wait_attempts: usize, planned_fork: Arc>>, - worker_handle: CancellationToken, } impl MockDaService { @@ -124,60 +93,21 @@ impl MockDaService { blocks_to_finality: u32, db_path: &Path, ) -> Self { - let (transaction_queue_sender, transaction_queue_receiver) = - unbounded_channel::::TransactionId>>>(); - let (finalized_header_sender, finalized_header_receiver) = broadcast::channel(16); - - let da_service = Self { + let (tx, rx1) = broadcast::channel(16); + // Spawn a task, so channel is never closed + tokio::spawn(async move { + let mut rx = rx1; + while let Ok(header) = rx.recv().instrument(tracing::Span::current()).await { + tracing::debug!("Finalized MockHeader: {}", header); + } + }); + Self { sequencer_da_address, blocks: Arc::new(AsyncMutex::new(DbConnector::new(db_path))), blocks_to_finality, - finalized_header_sender, - transaction_queue_sender, + finalized_header_sender: tx, wait_attempts: 100_0000, planned_fork: Arc::new(Mutex::new(None)), - worker_handle: CancellationToken::new(), - }; - - // Spawn the DA service worker task with a cancellation token - // so that when the DA service instance is dropped, the tasks are cancelled. - let cancellation_token = da_service.worker_handle.clone(); - let this = da_service.clone(); - tokio::spawn(this.da_service_worker( - transaction_queue_receiver, - finalized_header_receiver, - cancellation_token, - )); - - da_service - } - - async fn da_service_worker( - self, - mut transaction_queue_receiver: UnboundedReceiver< - Option::TransactionId>>, - >, - mut finalized_header_receiver: Receiver, - cancellation_token: CancellationToken, - ) { - loop { - select! { - biased; - _ = cancellation_token.cancelled() => { - return; - } - req = transaction_queue_receiver.recv() => { - if let Some(Some(req)) = req { - let res = self.send_transaction(req.da_data).await; - let _ = req.notify.send(res); - } - }, - header = finalized_header_receiver.recv() => { - if let Ok(header) = header { - tracing::debug!("Finalized MockHeader: {}", header); - } - }, - } } } @@ -345,6 +275,33 @@ impl MockDaService { } } +#[pin_project] +/// Stream of finalized headers +pub struct MockDaBlockHeaderStream { + #[pin] + inner: tokio_stream::wrappers::BroadcastStream, +} + +impl MockDaBlockHeaderStream { + /// Create new stream of finalized headers + pub fn new(receiver: broadcast::Receiver) -> Self { + Self { + inner: tokio_stream::wrappers::BroadcastStream::new(receiver), + } + } +} + +impl futures::Stream for MockDaBlockHeaderStream { + type Item = Result; + + fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + let this = self.project(); // Requires the pin-project crate or similar functionality + this.inner + .poll_next(cx) + .map(|opt| opt.map(|res| res.map_err(Into::into))) + } +} + #[async_trait] impl DaService for MockDaService { type Spec = MockDaSpec; @@ -444,16 +401,60 @@ impl DaService for MockDaService { &self, block: &Self::FilteredBlock, _prover_pk: &[u8], - ) -> anyhow::Result> { + ) -> anyhow::Result> { let mut res = vec![]; for mut b in block.blobs.clone() { if let Ok(r) = DaDataLightClient::try_from_slice(b.full_data()) { - res.push(r) + if let DaDataLightClient::Complete(proof) = r { + res.push(proof); + } else { + panic!("Unexpected proof Aggregate/Chunk in MockDa"); + } } } Ok(res) } + fn extract_relevant_blobs_light_client( + &self, + block: &Self::FilteredBlock, + ) -> Vec<::BlobTransaction> { + let mut res = vec![]; + for b in block.blobs.clone() { + let mut clone_for_full_data = b.clone(); + let full_data = clone_for_full_data.full_data(); + if DaDataLightClient::try_from_slice(full_data).is_ok() { + res.push(b) + } + } + res + } + + async fn get_extraction_proof_light_client( + &self, + _block: &Self::FilteredBlock, + ) -> ( + ::InclusionMultiProof, + ::CompletenessProof, + ) { + ([0u8; 32], ()) + } + + async fn extract_relevant_blobs_with_proof_light_client( + &self, + block: &Self::FilteredBlock, + ) -> ( + Vec<::BlobTransaction>, + ::InclusionMultiProof, + ::CompletenessProof, + ) { + let relevant_txs = self.extract_relevant_blobs_light_client(block); + + let (etx_proofs, rollup_row_proofs) = self.get_extraction_proof_light_client(block).await; + + (relevant_txs, etx_proofs, rollup_row_proofs) + } + async fn get_extraction_proof( &self, _block: &Self::FilteredBlock, @@ -470,7 +471,7 @@ impl DaService for MockDaService { let blob = match da_data { DaData::ZKProof(proof) => { tracing::debug!("Adding a zkproof"); - let data = DaDataLightClient::ZKProof(proof); + let data = DaDataLightClient::Complete(proof); borsh::to_vec(&data).unwrap() } DaData::SequencerCommitment(seq_comm) => { @@ -487,7 +488,15 @@ impl DaService for MockDaService { fn get_send_transaction_queue( &self, ) -> UnboundedSender>> { - self.transaction_queue_sender.clone() + let (tx, mut rx) = unbounded_channel::>>(); + let this = self.clone(); + tokio::spawn(async move { + while let Some(Some(req)) = rx.recv().await { + let res = this.send_transaction(req.da_data).await; + let _ = req.notify.send(res); + } + }); + tx } async fn send_aggregated_zk_proof(&self, proof: &[u8]) -> Result { @@ -502,8 +511,8 @@ impl DaService for MockDaService { } async fn get_fee_rate(&self) -> Result { - // Mock constant, use min possible in bitcoin - Ok(2500000000_u128) + // Mock constant + Ok(10_u128) } async fn get_block_by_hash( @@ -524,12 +533,6 @@ impl DaService for MockDaService { } } -impl Drop for MockDaService { - fn drop(&mut self) { - self.worker_handle.cancel(); - } -} - fn hash_to_array(bytes: &[u8]) -> [u8; 32] { let mut hasher = sha2::Sha256::new(); hasher.update(bytes); @@ -597,9 +600,6 @@ mod tests { // This prevents test for freezing in case of a bug // But we need to wait longer, as `MockDa let timeout_duration = Duration::from_millis(1000); - - // This task runs for as long as we are still expecting blocks and will stop eventually. - // Therefore, this is not considered to be an escaping task. tokio::spawn(async move { let mut received = Vec::with_capacity(expected_num_headers); for _ in 0..expected_num_headers { @@ -653,7 +653,9 @@ mod tests { let blob = &mut block.blobs[0]; let retrieved_data = blob.full_data().to_vec(); let retrieved_data = DaDataLightClient::try_from_slice(&retrieved_data).unwrap(); - let DaDataLightClient::ZKProof(retrieved_proof) = retrieved_data; + let DaDataLightClient::Complete(retrieved_proof) = retrieved_data else { + panic!("unexpected type"); + }; assert_eq!(proof, retrieved_proof); let last_finalized_block_response = da.get_last_finalized_block_header().await; @@ -721,7 +723,9 @@ mod tests { let proof = Proof::Full(blob); let retrieved_data = fetched_block.blobs[0].full_data(); let retrieved_data = DaDataLightClient::try_from_slice(retrieved_data).unwrap(); - let DaDataLightClient::ZKProof(retrieved_proof) = retrieved_data; + let DaDataLightClient::Complete(retrieved_proof) = retrieved_data else { + panic!("unexpected type"); + }; assert_eq!(proof, retrieved_proof); let head_block_header = da.get_head_block_header().await.unwrap(); diff --git a/crates/sovereign-sdk/adapters/mock-da/src/verifier.rs b/crates/sovereign-sdk/adapters/mock-da/src/verifier.rs index 94fcef53aa..77d53798b2 100644 --- a/crates/sovereign-sdk/adapters/mock-da/src/verifier.rs +++ b/crates/sovereign-sdk/adapters/mock-da/src/verifier.rs @@ -63,4 +63,14 @@ impl DaVerifier for MockDaVerifier { ) -> Result<::ValidityCondition, Self::Error> { Ok(Default::default()) } + + fn verify_relevant_tx_list_light_client( + &self, + _block_header: &::BlockHeader, + _txs: &[::BlobTransaction], + _inclusion_proof: ::InclusionMultiProof, + _completeness_proof: ::CompletenessProof, + ) -> Result<::ValidityCondition, Self::Error> { + Ok(Default::default()) + } } diff --git a/crates/sovereign-sdk/adapters/mock-zkvm/src/lib.rs b/crates/sovereign-sdk/adapters/mock-zkvm/src/lib.rs index 2c5202cd11..ede043078e 100644 --- a/crates/sovereign-sdk/adapters/mock-zkvm/src/lib.rs +++ b/crates/sovereign-sdk/adapters/mock-zkvm/src/lib.rs @@ -150,10 +150,9 @@ impl sov_rollup_interface::zk::ZkvmHost { type Guest = MockZkGuest; - fn add_hint(&mut self, item: T) { - let hint = borsh::to_vec(&item).unwrap(); + fn add_hint(&mut self, item: Vec) { let proof_info = ProofInfo { - hint, + hint: item, validity_condition: self.validity_condition, }; diff --git a/crates/sovereign-sdk/full-node/db/sov-db/src/ledger_db/mod.rs b/crates/sovereign-sdk/full-node/db/sov-db/src/ledger_db/mod.rs index bcc2265164..e07a8f2d14 100644 --- a/crates/sovereign-sdk/full-node/db/sov-db/src/ledger_db/mod.rs +++ b/crates/sovereign-sdk/full-node/db/sov-db/src/ledger_db/mod.rs @@ -500,7 +500,7 @@ impl SharedLedgerOps for LedgerDB { } } -impl ProverLedgerOps for LedgerDB { +impl BatchProverLedgerOps for LedgerDB { /// Get the witness by L2 height #[instrument(level = "trace", skip_all, err)] fn get_l2_witness( @@ -598,6 +598,8 @@ impl ProverLedgerOps for LedgerDB { } } +impl LightClientProverLedgerOps for LedgerDB {} + impl ProvingServiceLedgerOps for LedgerDB { /// Gets all pending sessions and step numbers #[instrument(level = "trace", skip(self), err)] diff --git a/crates/sovereign-sdk/full-node/db/sov-db/src/ledger_db/traits.rs b/crates/sovereign-sdk/full-node/db/sov-db/src/ledger_db/traits.rs index 469863175f..e72c7083cc 100644 --- a/crates/sovereign-sdk/full-node/db/sov-db/src/ledger_db/traits.rs +++ b/crates/sovereign-sdk/full-node/db/sov-db/src/ledger_db/traits.rs @@ -156,7 +156,7 @@ pub trait NodeLedgerOps: SharedLedgerOps { } /// Prover ledger operations -pub trait ProverLedgerOps: SharedLedgerOps + Send + Sync { +pub trait BatchProverLedgerOps: SharedLedgerOps + Send + Sync { /// Get the witness by L2 height fn get_l2_witness(&self, l2_height: u64) -> Result>; @@ -186,8 +186,11 @@ pub trait ProverLedgerOps: SharedLedgerOps + Send + Sync { fn clear_pending_proving_sessions(&self) -> Result<()>; } +/// Light client prover ledger operations +pub trait LightClientProverLedgerOps: SharedLedgerOps + Send + Sync {} + /// Ledger operations for the prover service -pub trait ProvingServiceLedgerOps: ProverLedgerOps + SharedLedgerOps + Send + Sync { +pub trait ProvingServiceLedgerOps: BatchProverLedgerOps + SharedLedgerOps + Send + Sync { /// Gets all pending sessions and step numbers fn get_pending_proving_sessions(&self) -> Result>>; diff --git a/crates/sovereign-sdk/full-node/sov-stf-runner/src/prover_service/mod.rs b/crates/sovereign-sdk/full-node/sov-stf-runner/src/prover_service/mod.rs index 42b8d58d0e..e64525a56c 100644 --- a/crates/sovereign-sdk/full-node/sov-stf-runner/src/prover_service/mod.rs +++ b/crates/sovereign-sdk/full-node/sov-stf-runner/src/prover_service/mod.rs @@ -1,11 +1,12 @@ use std::sync::Arc; use async_trait::async_trait; +use borsh::BorshDeserialize; use serde::{Deserialize, Serialize}; use sov_modules_api::Zkvm; use sov_rollup_interface::da::DaSpec; use sov_rollup_interface::services::da::DaService; -use sov_rollup_interface::zk::{Proof, StateTransitionData}; +use sov_rollup_interface::zk::Proof; use thiserror::Error; /// The possible configurations of the prover. @@ -27,7 +28,7 @@ impl<'de> Deserialize<'de> for ProverGuestRunConfig { where D: serde::Deserializer<'de>, { - let s = String::deserialize(deserializer)?; + let s = ::deserialize(deserializer)?; match s.as_str() { "skip" => Ok(ProverGuestRunConfig::Skip), "simulate" => Ok(ProverGuestRunConfig::Simulate), @@ -85,21 +86,14 @@ pub enum ProverServiceError { /// but this functionality will be added in the future (#1185). #[async_trait] pub trait ProverService { - /// Ths root hash of state merkle tree. - type StateRoot: Serialize + Clone + AsRef<[u8]>; - /// Data that is produced during batch execution. - type Witness: Serialize; /// Data Availability service. type DaService: DaService; /// Submit a witness for proving. async fn submit_witness( &self, - state_transition_data: StateTransitionData< - Self::StateRoot, - Self::Witness, - ::Spec, - >, + input: Vec, + da_slot_hash: <::Spec as DaSpec>::SlotHash, ) -> WitnessSubmissionStatus; /// Creates ZKP prove for a block corresponding to `block_header_hash`. @@ -108,6 +102,13 @@ pub trait ProverService { block_header_hash: <::Spec as DaSpec>::SlotHash, ) -> Result; + /// Wait for proving to be complete and extract the output + /// from the prover service. + async fn wait_for_proving_and_extract_output( + &self, + block_header_hash: <::Spec as DaSpec>::SlotHash, + ) -> Result; + /// Sends the ZK proof to the DA. async fn wait_for_proving_and_send_to_da( &self, diff --git a/crates/sovereign-sdk/fuzz/Cargo.lock b/crates/sovereign-sdk/fuzz/Cargo.lock index 7b2a767da0..7562661107 100644 --- a/crates/sovereign-sdk/fuzz/Cargo.lock +++ b/crates/sovereign-sdk/fuzz/Cargo.lock @@ -1229,7 +1229,6 @@ dependencies = [ "libc", "libz-sys", "lz4-sys", - "zstd-sys", ] [[package]] @@ -2134,6 +2133,7 @@ dependencies = [ "serde", "sov-rollup-interface", "sov-schema-db", + "tempfile", "tokio", "tracing", ] @@ -2801,13 +2801,3 @@ name = "zeroize" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" - -[[package]] -name = "zstd-sys" -version = "2.0.13+zstd.1.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" -dependencies = [ - "cc", - "pkg-config", -] diff --git a/crates/sovereign-sdk/module-system/sov-modules-rollup-blueprint/src/lib.rs b/crates/sovereign-sdk/module-system/sov-modules-rollup-blueprint/src/lib.rs index 479fd51349..89d4ca8eac 100644 --- a/crates/sovereign-sdk/module-system/sov-modules-rollup-blueprint/src/lib.rs +++ b/crates/sovereign-sdk/module-system/sov-modules-rollup-blueprint/src/lib.rs @@ -8,7 +8,7 @@ use std::collections::HashMap; use std::sync::Arc; use async_trait::async_trait; -use citrea_common::{FullNodeConfig, ProverConfig}; +use citrea_common::{BatchProverConfig, FullNodeConfig, LightClientProverConfig}; pub use runtime_rpc::*; use sov_db::ledger_db::LedgerDB; use sov_db::rocks_db_config::RocksdbConfig; @@ -18,7 +18,6 @@ use sov_rollup_interface::services::da::DaService; use sov_rollup_interface::spec::SpecId; use sov_rollup_interface::storage::HierarchicalStorageManager; use sov_rollup_interface::zk::{Zkvm, ZkvmHost}; -use sov_state::Storage; use sov_stf_runner::ProverService; use tokio::sync::broadcast; pub use wallet::*; @@ -57,20 +56,18 @@ pub trait RollupBlueprint: Sized + Send + Sync { type NativeRuntime: RuntimeTrait + Default + Send + Sync; /// Prover service. - type ProverService: ProverService< - Self::Vm, - StateRoot = <::Storage as Storage>::Root, - Witness = <::Storage as Storage>::Witness, - DaService = Self::DaService, - > + Send - + Sync - + 'static; + type ProverService: ProverService + Send + Sync + 'static; /// Creates a new instance of the blueprint. fn new() -> Self; - /// Get code commitments by fork. - fn get_code_commitments_by_spec(&self) -> HashMap::CodeCommitment>; + /// Get batch prover code commitments by fork. + fn get_batch_prover_code_commitments_by_spec( + &self, + ) -> HashMap::CodeCommitment>; + + /// Get light client prover code commitment. + fn get_light_client_prover_code_commitment(&self) -> ::CodeCommitment; /// Creates RPC methods for the rollup. fn create_rpc_methods( @@ -114,9 +111,18 @@ pub trait RollupBlueprint: Sized + Send + Sync { ) -> Result, anyhow::Error>; /// Creates instance of [`ProverService`]. - async fn create_prover_service( + async fn create_batch_prover_service( + &self, + prover_config: BatchProverConfig, + rollup_config: &FullNodeConfig, + da_service: &Arc, + ledger_db: LedgerDB, + ) -> Self::ProverService; + + /// Creates instance of [`ProverService`]. + async fn create_light_client_prover_service( &self, - prover_config: ProverConfig, + prover_config: LightClientProverConfig, rollup_config: &FullNodeConfig, da_service: &Arc, ledger_db: LedgerDB, diff --git a/crates/sovereign-sdk/rollup-interface/src/node/services/da.rs b/crates/sovereign-sdk/rollup-interface/src/node/services/da.rs index 9a1052e36d..4ef5d091dc 100644 --- a/crates/sovereign-sdk/rollup-interface/src/node/services/da.rs +++ b/crates/sovereign-sdk/rollup-interface/src/node/services/da.rs @@ -9,7 +9,9 @@ use tokio::sync::oneshot::Sender as OneshotSender; use crate::da::BlockHeaderTrait; #[cfg(feature = "native")] -use crate::da::{DaData, DaDataLightClient, DaSpec, DaVerifier}; +use crate::da::{DaData, DaSpec, DaVerifier}; +#[cfg(feature = "native")] +use crate::zk::Proof; use crate::zk::ValidityCondition; /// This type represents a queued request to send_transaction @@ -92,12 +94,18 @@ pub trait DaService: Send + Sync + 'static { block: &Self::FilteredBlock, ) -> Vec<::BlobTransaction>; + /// Extract the relevant LightClient transactions from a block. + fn extract_relevant_blobs_light_client( + &self, + block: &Self::FilteredBlock, + ) -> Vec<::BlobTransaction>; + /// Extract the relevant proofs from a block. async fn extract_relevant_proofs( &self, block: &Self::FilteredBlock, prover_pk: &[u8], - ) -> anyhow::Result>; + ) -> anyhow::Result>; /// Generate a proof that the relevant blob transactions have been extracted correctly from the DA layer /// block. @@ -110,6 +118,16 @@ pub trait DaService: Send + Sync + 'static { ::CompletenessProof, ); + /// Generate a proof that the relevant LightClient blob transactions have been extracted correctly from the DA layer + /// block. + async fn get_extraction_proof_light_client( + &self, + block: &Self::FilteredBlock, + ) -> ( + ::InclusionMultiProof, + ::CompletenessProof, + ); + /// Extract the relevant transactions from a block, along with a proof that the extraction has been done correctly. /// For example, this method might return all of the blob transactions in rollup's namespace on Celestia, /// together with a range proof against the root of the namespaced-merkle-tree, demonstrating that the entire @@ -132,6 +150,17 @@ pub trait DaService: Send + Sync + 'static { (relevant_txs, etx_proofs, rollup_row_proofs) } + /// TODO doc + #[allow(clippy::type_complexity)] + async fn extract_relevant_blobs_with_proof_light_client( + &self, + block: &Self::FilteredBlock, + ) -> ( + Vec<::BlobTransaction>, + ::InclusionMultiProof, + ::CompletenessProof, + ); + /// Send a transaction directly to the DA layer. /// blob is the serialized and signed transaction. /// Returns nothing if the transaction was successfully sent. diff --git a/crates/sovereign-sdk/rollup-interface/src/state_machine/da.rs b/crates/sovereign-sdk/rollup-interface/src/state_machine/da.rs index 48fdb02cf4..ba324fd907 100644 --- a/crates/sovereign-sdk/rollup-interface/src/state_machine/da.rs +++ b/crates/sovereign-sdk/rollup-interface/src/state_machine/da.rs @@ -1,5 +1,6 @@ //! Defines traits and types used by the rollup to verify claims about the //! DA layer. +use alloc::vec::Vec; use core::fmt::Debug; use borsh::{BorshDeserialize, BorshSerialize}; @@ -47,7 +48,11 @@ pub enum DaData { #[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, BorshDeserialize, BorshSerialize)] pub enum DaDataLightClient { /// A zk proof and state diff - ZKProof(Proof), + Complete(Proof), + /// A list of tx ids + Aggregate(Vec<[u8; 32]>), + /// A chunk of an aggregate + Chunk(Vec), } /// Data written to DA and read from DA must be the borsh serialization of this enum @@ -119,7 +124,7 @@ pub trait DaVerifier: Send + Sync { /// Create a new da verifier with the given chain parameters fn new(params: ::ChainParams) -> Self; - /// Verify a claimed set of transactions against a block header. + /// Verify a claimed set of BatchProof transactions against a block header. fn verify_relevant_tx_list( &self, block_header: &::BlockHeader, @@ -127,6 +132,15 @@ pub trait DaVerifier: Send + Sync { inclusion_proof: ::InclusionMultiProof, completeness_proof: ::CompletenessProof, ) -> Result<::ValidityCondition, Self::Error>; + + /// Verify a claimed set of LightClient transactions against a block header + fn verify_relevant_tx_list_light_client( + &self, + block_header: &::BlockHeader, + txs: &[::BlobTransaction], + inclusion_proof: ::InclusionMultiProof, + completeness_proof: ::CompletenessProof, + ) -> Result<::ValidityCondition, Self::Error>; } #[cfg(feature = "std")] diff --git a/crates/sovereign-sdk/rollup-interface/src/state_machine/zk/mod.rs b/crates/sovereign-sdk/rollup-interface/src/state_machine/zk/mod.rs index f2b61a22bd..de7a94872e 100644 --- a/crates/sovereign-sdk/rollup-interface/src/state_machine/zk/mod.rs +++ b/crates/sovereign-sdk/rollup-interface/src/state_machine/zk/mod.rs @@ -37,7 +37,8 @@ pub trait ZkvmHost: Zkvm + Clone { /// The associated guest type type Guest: ZkvmGuest; /// Give the guest a piece of advice non-deterministically - fn add_hint(&mut self, item: T); + /// `item` is a borsh serialized input to the guest + fn add_hint(&mut self, item: Vec); /// Simulate running the guest using the provided hints. /// diff --git a/crates/sovereign-sdk/utils/rng-da-service/src/lib.rs b/crates/sovereign-sdk/utils/rng-da-service/src/lib.rs index 9587d5e629..f925450cef 100644 --- a/crates/sovereign-sdk/utils/rng-da-service/src/lib.rs +++ b/crates/sovereign-sdk/utils/rng-da-service/src/lib.rs @@ -13,10 +13,9 @@ use sov_modules_api::default_context::DefaultContext; use sov_modules_api::default_signature::private_key::DefaultPrivateKey; use sov_modules_api::transaction::Transaction; use sov_modules_api::{Address, AddressBech32, EncodeCall, PrivateKey, PublicKey, Spec}; -use sov_rollup_interface::da::{ - BlockHeaderTrait, DaData, DaDataLightClient, DaSpec, DaVerifier, Time, -}; +use sov_rollup_interface::da::{BlockHeaderTrait, DaData, DaSpec, DaVerifier, Time}; use sov_rollup_interface::services::da::{DaService, SlotData}; +use sov_rollup_interface::zk::Proof; const DEFAULT_CHAIN_ID: u64 = 0; @@ -174,7 +173,7 @@ impl DaService for RngDaService { &self, _block: &Self::FilteredBlock, _prover_pk: &[u8], - ) -> anyhow::Result> { + ) -> anyhow::Result> { unimplemented!() } @@ -210,6 +209,34 @@ impl DaService for RngDaService { ) -> Vec<::BlobTransaction> { vec![] } + + fn extract_relevant_blobs_light_client( + &self, + _block: &Self::FilteredBlock, + ) -> Vec<::BlobTransaction> { + unimplemented!() + } + + async fn get_extraction_proof_light_client( + &self, + _block: &Self::FilteredBlock, + ) -> ( + ::InclusionMultiProof, + ::CompletenessProof, + ) { + unimplemented!() + } + + async fn extract_relevant_blobs_with_proof_light_client( + &self, + _block: &Self::FilteredBlock, + ) -> ( + Vec<::BlobTransaction>, + ::InclusionMultiProof, + ::CompletenessProof, + ) { + todo!() + } } pub struct RngDaVerifier; @@ -231,6 +258,16 @@ impl DaVerifier for RngDaVerifier { ) -> Result<::ValidityCondition, Self::Error> { Ok(MockValidityCond { is_valid: true }) } + + fn verify_relevant_tx_list_light_client( + &self, + _block_header: &::BlockHeader, + _txs: &[::BlobTransaction], + _inclusion_proof: ::InclusionMultiProof, + _completeness_proof: ::CompletenessProof, + ) -> Result<::ValidityCondition, Self::Error> { + todo!() + } } pub fn generate_transfers(n: usize, start_nonce: u64) -> Vec { diff --git a/docs/run-dev.md b/docs/run-dev.md index 1f0141e5a7..8d8e988e24 100644 --- a/docs/run-dev.md +++ b/docs/run-dev.md @@ -99,16 +99,22 @@ Run full node: Full node RPC is accessible at `127.0.0.1:12346` -_Optional_: Run prover: +_Optional_: Run batch prover: ```sh -./target/debug/citrea --da-layer bitcoin --rollup-config-path resources/configs/bitcoin-regtest/prover_rollup_config.toml --prover resources/configs/bitcoin-regtest/prover_config.toml --genesis-paths resources/genesis/bitcoin-regtest +./target/debug/citrea --da-layer bitcoin --rollup-config-path resources/configs/bitcoin-regtest/prover_rollup_config.toml --batch-prover resources/configs/bitcoin-regtest/prover_config.toml --genesis-paths resources/genesis/bitcoin-regtest ``` -If you want to test proofs, make sure to set `proof_sampling_number` in `resources/configs/bitcion-regtest/prover_config.toml` to 0, and you can lower the `min_soft_confirmations_per_commitment` to a number between 5-50, as higher numbers than that takes too long even if you run the prover in execute mode. +If you want to test proofs, make sure to set `proof_sampling_number` in `resources/configs/bitcion-regtest/batch_prover_config.toml` to 0, and you can lower the `min_soft_confirmations_per_commitment` to a number between 5-50, as higher numbers than that takes too long even if you run the prover in execute mode. To publish blocks on Bitcoin Regtest, run the sequencer with `test_mode` in sequencer config set to false and blocks will be published every two seconds. +_Optional_: Run light client prover: + +```sh +./target/debug/citrea --da-layer bitcoin --rollup-config-path resources/configs/bitcoin-regtest/light_client_prover_rollup_config.toml --light-client-prover-config-path resources/configs/bitcoin-regtest/light_client_prover_config.toml --genesis-paths resources/genesis/bitcoin-regtest +``` + To delete sequencer or full nodes databases run: ```sh diff --git a/resources/configs/bitcoin-regtest/prover_config.toml b/resources/configs/bitcoin-regtest/batch_prover_config.toml similarity index 100% rename from resources/configs/bitcoin-regtest/prover_config.toml rename to resources/configs/bitcoin-regtest/batch_prover_config.toml diff --git a/resources/configs/bitcoin-regtest/batch_prover_rollup_config.toml b/resources/configs/bitcoin-regtest/batch_prover_rollup_config.toml new file mode 100644 index 0000000000..3fb9b2619d --- /dev/null +++ b/resources/configs/bitcoin-regtest/batch_prover_rollup_config.toml @@ -0,0 +1,30 @@ +[public_keys] +sequencer_public_key = "204040e364c10f2bec9c1fe500a1cd4c247c89d650a01ed7e82caba867877c21" +sequencer_da_pub_key = "02588d202afcc1ee4ab5254c7847ec25b9a135bbda0f2bc69ee1a714749fd77dc9" +prover_da_pub_key = "" + +[da] +# fill here +node_url = "" +# fill here +node_username = "" +# fill here +node_password = "" +network = "regtest" +tx_backup_dir = "resources/bitcoin/inscription_txs" +da_private_key = "56D08C2DDE7F412F80EC99A0A328F76688C904BD4D1435281EFC9270EC8C8707" + +[storage] +# The path to the rollup's data directory. Paths that do not begin with `/` are interpreted as relative paths. +path = "resources/dbs/batch-prover-db" +db_max_open_files = 5000 + +[rpc] +# the host and port to bind the rpc server for +bind_host = "127.0.0.1" +bind_port = 12346 +enable_subscriptions = false + +[runner] +sequencer_client_url = "http://0.0.0.0:12345" +include_tx_body = false diff --git a/resources/configs/mock/prover_config.toml b/resources/configs/bitcoin-regtest/light_client_prover_config.toml similarity index 100% rename from resources/configs/mock/prover_config.toml rename to resources/configs/bitcoin-regtest/light_client_prover_config.toml diff --git a/resources/configs/bitcoin-regtest/prover_rollup_config.toml b/resources/configs/bitcoin-regtest/light_client_prover_rollup_config.toml similarity index 94% rename from resources/configs/bitcoin-regtest/prover_rollup_config.toml rename to resources/configs/bitcoin-regtest/light_client_prover_rollup_config.toml index d00d3855f7..2844d258ad 100644 --- a/resources/configs/bitcoin-regtest/prover_rollup_config.toml +++ b/resources/configs/bitcoin-regtest/light_client_prover_rollup_config.toml @@ -15,7 +15,7 @@ tx_backup_dir = "resources/bitcoin/inscription_txs" [storage] # The path to the rollup's data directory. Paths that do not begin with `/` are interpreted as relative paths. -path = "resources/dbs/prover-db" +path = "resources/dbs/light-client-prover-db" db_max_open_files = 5000 [rpc] diff --git a/resources/configs/mock/batch_prover_config.toml b/resources/configs/mock/batch_prover_config.toml new file mode 100644 index 0000000000..3428aac35d --- /dev/null +++ b/resources/configs/mock/batch_prover_config.toml @@ -0,0 +1,3 @@ +proving_mode = "execute" +proof_sampling_number = 500 +enable_recovery = true diff --git a/resources/configs/mock/light_client_prover_config.toml b/resources/configs/mock/light_client_prover_config.toml new file mode 100644 index 0000000000..3428aac35d --- /dev/null +++ b/resources/configs/mock/light_client_prover_config.toml @@ -0,0 +1,3 @@ +proving_mode = "execute" +proof_sampling_number = 500 +enable_recovery = true