diff --git a/Cargo.lock b/Cargo.lock index ee0ea366e..a71a1aae0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -866,7 +866,7 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "bashtestmd" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "clap", "indoc", @@ -1568,7 +1568,7 @@ dependencies = [ [[package]] name = "citrea" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "async-trait", @@ -1630,7 +1630,7 @@ dependencies = [ [[package]] name = "citrea-evm" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -1676,7 +1676,7 @@ dependencies = [ [[package]] name = "citrea-risc0-bonsai-adapter" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "bincode", @@ -1697,7 +1697,7 @@ dependencies = [ [[package]] name = "citrea-sequencer" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "alloy-rlp", "anyhow", @@ -1743,7 +1743,7 @@ dependencies = [ [[package]] name = "citrea-stf" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -1903,7 +1903,7 @@ checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "const-rollup-config" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" [[package]] name = "constant_time_eq" @@ -2343,7 +2343,7 @@ dependencies = [ [[package]] name = "demo-simple-stf" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "hex", @@ -2356,7 +2356,7 @@ dependencies = [ [[package]] name = "demo-stf" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -2904,7 +2904,7 @@ dependencies = [ [[package]] name = "ethereum-rpc" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -4368,7 +4368,7 @@ dependencies = [ [[package]] name = "integration-tests" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -5281,7 +5281,7 @@ dependencies = [ [[package]] name = "module-template" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "arbitrary", @@ -7688,7 +7688,7 @@ dependencies = [ [[package]] name = "risc0" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "risc0-build", ] @@ -7971,7 +7971,7 @@ dependencies = [ [[package]] name = "rollup-constants" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" [[package]] name = "route-recognizer" @@ -8471,7 +8471,7 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "sequencer-client" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "ethers", @@ -8679,7 +8679,7 @@ dependencies = [ [[package]] name = "shared-backup-db" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "deadpool-postgres", "postgres-types", @@ -8721,7 +8721,7 @@ dependencies = [ [[package]] name = "simple-nft-module" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -8803,7 +8803,7 @@ dependencies = [ [[package]] name = "soft-confirmation-rule-enforcer" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -8851,7 +8851,7 @@ dependencies = [ [[package]] name = "sov-accessory-state" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "borsh", "jsonrpsee", @@ -8864,7 +8864,7 @@ dependencies = [ [[package]] name = "sov-accounts" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "arbitrary", @@ -8885,7 +8885,7 @@ dependencies = [ [[package]] name = "sov-bank" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -8904,7 +8904,7 @@ dependencies = [ [[package]] name = "sov-cli" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -8923,7 +8923,7 @@ dependencies = [ [[package]] name = "sov-data-generators" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "borsh", "proptest", @@ -8937,7 +8937,7 @@ dependencies = [ [[package]] name = "sov-db" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "arbitrary", @@ -8962,7 +8962,7 @@ dependencies = [ [[package]] name = "sov-ledger-rpc" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "futures", @@ -8979,7 +8979,7 @@ dependencies = [ [[package]] name = "sov-mock-da" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "async-trait", @@ -9001,7 +9001,7 @@ dependencies = [ [[package]] name = "sov-mock-zkvm" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "bincode", @@ -9012,7 +9012,7 @@ dependencies = [ [[package]] name = "sov-module-schemas" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "sov-accounts", "sov-bank", @@ -9026,7 +9026,7 @@ dependencies = [ [[package]] name = "sov-modules-api" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "arbitrary", @@ -9060,7 +9060,7 @@ dependencies = [ [[package]] name = "sov-modules-core" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "arbitrary", @@ -9088,7 +9088,7 @@ dependencies = [ [[package]] name = "sov-modules-macros" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -9107,7 +9107,7 @@ dependencies = [ [[package]] name = "sov-modules-rollup-blueprint" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "async-trait", @@ -9131,7 +9131,7 @@ dependencies = [ [[package]] name = "sov-modules-stf-blueprint" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -9153,7 +9153,7 @@ dependencies = [ [[package]] name = "sov-nft-module" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -9174,7 +9174,7 @@ dependencies = [ [[package]] name = "sov-prover-incentives" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "bincode", @@ -9193,7 +9193,7 @@ dependencies = [ [[package]] name = "sov-prover-storage-manager" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "criterion", @@ -9210,7 +9210,7 @@ dependencies = [ [[package]] name = "sov-risc0-adapter" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "bincode", @@ -9228,7 +9228,7 @@ dependencies = [ [[package]] name = "sov-rng-da-service" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "async-trait", @@ -9246,7 +9246,7 @@ dependencies = [ [[package]] name = "sov-rollup-interface" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "async-trait", @@ -9266,7 +9266,7 @@ dependencies = [ [[package]] name = "sov-schema-db" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "byteorder", @@ -9283,7 +9283,7 @@ dependencies = [ [[package]] name = "sov-sequencer" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "async-trait", @@ -9307,7 +9307,7 @@ dependencies = [ [[package]] name = "sov-sequencer-registry" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "arbitrary", @@ -9334,7 +9334,7 @@ dependencies = [ [[package]] name = "sov-state" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "arbitrary", @@ -9359,7 +9359,7 @@ dependencies = [ [[package]] name = "sov-stf-runner" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "async-trait", @@ -9393,7 +9393,7 @@ dependencies = [ [[package]] name = "sov-value-setter" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -9411,7 +9411,7 @@ dependencies = [ [[package]] name = "sov-vec-setter" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -9429,7 +9429,7 @@ dependencies = [ [[package]] name = "sov-zk-cycle-macros" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", @@ -9442,7 +9442,7 @@ dependencies = [ [[package]] name = "sov-zk-cycle-utils" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "bytes", "risc0-zkvm", diff --git a/Cargo.toml b/Cargo.toml index 12be45f76..eca3a602d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,7 +57,7 @@ members = [ ] [workspace.package] -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" edition = "2021" license = "GPL-3.0" authors = ["Chainway Labs "] diff --git a/bin/citrea/provers/risc0/Cargo.toml b/bin/citrea/provers/risc0/Cargo.toml index cc7b51c46..50b27f364 100644 --- a/bin/citrea/provers/risc0/Cargo.toml +++ b/bin/citrea/provers/risc0/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "risc0" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" edition = "2021" resolver = "2" license = "MIT OR Apache-2.0" diff --git a/bin/citrea/provers/risc0/build.rs b/bin/citrea/provers/risc0/build.rs index 3d3812d47..ee7f8f91f 100644 --- a/bin/citrea/provers/risc0/build.rs +++ b/bin/citrea/provers/risc0/build.rs @@ -13,8 +13,8 @@ fn main() { let elf = r#" pub const BITCOIN_DA_ELF: &[u8] = &[]; pub const MOCK_DA_ELF: &[u8] = &[]; - pub const BITCOIN_DA_ID: [u32; 8] = [2170772617, 2185219863, 3147817613, 3435562326, 2028413396, 832797378, 3678042619, 791033588]; - pub const MOCK_DA_ID: [u32; 8] = [2202882101, 946233124, 3137625650, 569444048, 4171135506, 773422281, 1045487828, 881699474]; + pub const BITCOIN_DA_ID: [u32; 8] = [0u32; 8]; + pub const MOCK_DA_ID: [u32; 8] = [0u32; 8]; "#; std::fs::write(methods_path, elf).expect("Failed to write mock rollup elf"); diff --git a/bin/citrea/provers/risc0/guest-bitcoin/Cargo.lock b/bin/citrea/provers/risc0/guest-bitcoin/Cargo.lock index b15bac3ef..949b4b0dc 100644 --- a/bin/citrea/provers/risc0/guest-bitcoin/Cargo.lock +++ b/bin/citrea/provers/risc0/guest-bitcoin/Cargo.lock @@ -882,7 +882,7 @@ dependencies = [ [[package]] name = "citrea-evm" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "alloy-primitives", "anyhow", @@ -899,7 +899,7 @@ dependencies = [ [[package]] name = "citrea-stf" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -2566,7 +2566,7 @@ dependencies = [ [[package]] name = "rollup-constants" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" [[package]] name = "rrs-lib" @@ -2908,7 +2908,7 @@ dependencies = [ [[package]] name = "soft-confirmation-rule-enforcer" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -2920,7 +2920,7 @@ dependencies = [ [[package]] name = "sov-accounts" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -2932,7 +2932,7 @@ dependencies = [ [[package]] name = "sov-modules-api" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "bech32 0.9.1", @@ -2952,7 +2952,7 @@ dependencies = [ [[package]] name = "sov-modules-core" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "bech32 0.9.1", @@ -2970,7 +2970,7 @@ dependencies = [ [[package]] name = "sov-modules-macros" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -2982,7 +2982,7 @@ dependencies = [ [[package]] name = "sov-modules-stf-blueprint" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -3002,7 +3002,7 @@ dependencies = [ [[package]] name = "sov-risc0-adapter" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "bincode", @@ -3015,7 +3015,7 @@ dependencies = [ [[package]] name = "sov-rollup-interface" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "async-trait", @@ -3031,7 +3031,7 @@ dependencies = [ [[package]] name = "sov-state" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "bcs", @@ -3051,7 +3051,7 @@ dependencies = [ [[package]] name = "sov-stf-runner" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -3067,7 +3067,7 @@ dependencies = [ [[package]] name = "sov-zk-cycle-macros" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "proc-macro2", "quote", diff --git a/bin/citrea/provers/risc0/guest-mock/Cargo.lock b/bin/citrea/provers/risc0/guest-mock/Cargo.lock index cca36652a..766328906 100644 --- a/bin/citrea/provers/risc0/guest-mock/Cargo.lock +++ b/bin/citrea/provers/risc0/guest-mock/Cargo.lock @@ -760,7 +760,7 @@ dependencies = [ [[package]] name = "citrea-evm" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "alloy-primitives", "anyhow", @@ -777,7 +777,7 @@ dependencies = [ [[package]] name = "citrea-stf" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -2664,7 +2664,7 @@ dependencies = [ [[package]] name = "soft-confirmation-rule-enforcer" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -2676,7 +2676,7 @@ dependencies = [ [[package]] name = "sov-accounts" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -2705,7 +2705,7 @@ dependencies = [ [[package]] name = "sov-mock-da" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "async-trait", @@ -2720,7 +2720,7 @@ dependencies = [ [[package]] name = "sov-modules-api" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "bech32", @@ -2740,7 +2740,7 @@ dependencies = [ [[package]] name = "sov-modules-core" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "bech32", @@ -2758,7 +2758,7 @@ dependencies = [ [[package]] name = "sov-modules-macros" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -2770,7 +2770,7 @@ dependencies = [ [[package]] name = "sov-modules-stf-blueprint" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -2790,7 +2790,7 @@ dependencies = [ [[package]] name = "sov-risc0-adapter" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "bincode", @@ -2803,7 +2803,7 @@ dependencies = [ [[package]] name = "sov-rollup-interface" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "async-trait", @@ -2819,7 +2819,7 @@ dependencies = [ [[package]] name = "sov-state" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "bcs", @@ -2839,7 +2839,7 @@ dependencies = [ [[package]] name = "sov-stf-runner" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -2855,7 +2855,7 @@ dependencies = [ [[package]] name = "sov-zk-cycle-macros" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" dependencies = [ "proc-macro2", "quote", diff --git a/bin/citrea/src/bitcoin_rollup.rs b/bin/citrea/src/bitcoin_rollup.rs index 7be9e17da..54e46cd84 100644 --- a/bin/citrea/src/bitcoin_rollup.rs +++ b/bin/citrea/src/bitcoin_rollup.rs @@ -76,7 +76,10 @@ impl RollupBlueprint for BitcoinRollup { } fn get_code_commitment(&self) -> ::CodeCommitment { - Digest::new(risc0::BITCOIN_DA_ID) + Digest::from([ + 1860130309, 3212374340, 1571693462, 196802355, 3242449784, 3924610482, 1760955211, + 1058326957, + ]) } fn create_storage_manager( diff --git a/crates/sovereign-sdk/adapters/risc0-bonsai/src/host.rs b/crates/sovereign-sdk/adapters/risc0-bonsai/src/host.rs index bdcff09a9..84539c8b8 100644 --- a/crates/sovereign-sdk/adapters/risc0-bonsai/src/host.rs +++ b/crates/sovereign-sdk/adapters/risc0-bonsai/src/host.rs @@ -300,6 +300,8 @@ impl<'a> Risc0BonsaiHost<'a> { // handle error let image_id = compute_image_id(elf).unwrap(); + tracing::info!("Calculated image id: {:?}", image_id.as_words()); + // handle error let client = if !api_url.is_empty() && !api_key.is_empty() { let client = BonsaiClient::from_parts(api_url, api_key, risc0_zkvm::VERSION); diff --git a/crates/sovereign-sdk/adapters/solana/da_client/Cargo.toml b/crates/sovereign-sdk/adapters/solana/da_client/Cargo.toml index 5b3f616c5..ba51fdcfa 100644 --- a/crates/sovereign-sdk/adapters/solana/da_client/Cargo.toml +++ b/crates/sovereign-sdk/adapters/solana/da_client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "da_client" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/sovereign-sdk/adapters/solana/solana_da_programs/programs/blockroot/Cargo.toml b/crates/sovereign-sdk/adapters/solana/solana_da_programs/programs/blockroot/Cargo.toml index 76c2a6e7d..742821f59 100644 --- a/crates/sovereign-sdk/adapters/solana/solana_da_programs/programs/blockroot/Cargo.toml +++ b/crates/sovereign-sdk/adapters/solana/solana_da_programs/programs/blockroot/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "blockroot" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" description = "Created with Anchor" edition = "2021" diff --git a/crates/sovereign-sdk/full-node/sov-stf-runner/src/runner.rs b/crates/sovereign-sdk/full-node/sov-stf-runner/src/runner.rs index 691d676d4..aecea2f22 100644 --- a/crates/sovereign-sdk/full-node/sov-stf-runner/src/runner.rs +++ b/crates/sovereign-sdk/full-node/sov-stf-runner/src/runner.rs @@ -237,6 +237,9 @@ where /// Runs the prover process. #[instrument(level = "trace", skip_all, err)] pub async fn run_prover_process(&mut self) -> Result<(), anyhow::Error> { + let skip_submission_until_l1 = std::env::var("SKIP_PROOF_SUBMISSION_UNTIL_L1") + .map_or(0u64, |v| v.parse().unwrap_or(0)); + // Prover node should sync when a new sequencer commitment arrives // Check da block get and sync up to the latest block in the latest commitment let last_scanned_l1_height = self @@ -403,7 +406,7 @@ where "Running soft confirmation batch #{} with hash: 0x{} on DA block #{}", l2_height, hex::encode(soft_batch.hash), - filtered_block.header().height() + soft_batch.da_slot_height ); let mut signed_soft_confirmation: SignedSoftConfirmationBatch = @@ -518,79 +521,94 @@ where sequencer_da_public_key: self.sequencer_da_pub_key.clone(), }; - let prover_service = self - .prover_service - .as_ref() - .ok_or_else(|| anyhow::anyhow!("Prover service is not initialized"))?; + // Skip submission until l1 height + // hotfix for devnet deployment + // TODO: make a better way to skip submission, and fixing deployed bugs + if l1_height >= skip_submission_until_l1 { + let prover_service = self + .prover_service + .as_ref() + .ok_or_else(|| anyhow::anyhow!("Prover service is not initialized"))?; - prover_service.submit_witness(transition_data).await; + prover_service.submit_witness(transition_data).await; - prover_service.prove(hash.clone()).await?; + prover_service.prove(hash.clone()).await?; - let (tx_id, proof) = prover_service - .wait_for_proving_and_send_to_da(hash.clone(), &self.da_service) - .await?; + let (tx_id, proof) = prover_service + .wait_for_proving_and_send_to_da(hash.clone(), &self.da_service) + .await?; - let tx_id_u8 = tx_id.into(); + let tx_id_u8 = tx_id.into(); - // l1_height => (tx_id, proof, transition_data) - // save proof along with tx id to db, should be queriable by slot number or slot hash - let transition_data: sov_modules_api::StateTransition< - ::Spec, - Stf::StateRoot, - > = Vm::extract_output(&proof).expect("Proof should be deserializable"); + // l1_height => (tx_id, proof, transition_data) + // save proof along with tx id to db, should be queriable by slot number or slot hash + let transition_data: sov_modules_api::StateTransition< + ::Spec, + Stf::StateRoot, + > = Vm::extract_output(&proof).expect("Proof should be deserializable"); - match proof { - Proof::PublicInput(_) => { - tracing::warn!("Proof is public input, skipping"); - } - Proof::Full(ref proof) => { - tracing::info!("Verifying proof!"); - let transition_data_from_proof = - Vm::verify_and_extract_output::<::Spec, Stf::StateRoot>( - &proof.clone(), - &self.code_commitment, + match proof { + Proof::PublicInput(_) => { + tracing::warn!("Proof is public input, skipping"); + } + Proof::Full(ref proof) => { + tracing::info!("Verifying proof!"); + let transition_data_from_proof = Vm::verify_and_extract_output::< + ::Spec, + Stf::StateRoot, + >( + &proof.clone(), &self.code_commitment ) .expect("Proof should be verifiable"); - tracing::info!( - "transition data from proof: {:?}", - transition_data_from_proof - ); + tracing::info!( + "transition data from proof: {:?}", + transition_data_from_proof + ); + } } - } - tracing::info!("transition data: {:?}", transition_data); + tracing::info!("transition data: {:?}", transition_data); - let stored_state_transition = StoredStateTransition { - initial_state_root: transition_data.initial_state_root.as_ref().to_vec(), - final_state_root: transition_data.final_state_root.as_ref().to_vec(), - state_diff: transition_data.state_diff, - da_slot_hash: transition_data.da_slot_hash.into(), - sequencer_public_key: transition_data.sequencer_public_key, - sequencer_da_public_key: transition_data.sequencer_da_public_key, - validity_condition: transition_data.validity_condition.try_to_vec().unwrap(), - }; + let stored_state_transition = StoredStateTransition { + initial_state_root: transition_data.initial_state_root.as_ref().to_vec(), + final_state_root: transition_data.final_state_root.as_ref().to_vec(), + state_diff: transition_data.state_diff, + da_slot_hash: transition_data.da_slot_hash.into(), + sequencer_public_key: transition_data.sequencer_public_key, + sequencer_da_public_key: transition_data.sequencer_da_public_key, + validity_condition: transition_data.validity_condition.try_to_vec().unwrap(), + }; - match pg_client.as_ref() { - Some(Ok(pool)) => { - tracing::info!("Inserting proof data into postgres"); - let (proof_data, proof_type) = match proof.clone() { - Proof::Full(full_proof) => (full_proof, ProofType::Full), - Proof::PublicInput(public_input) => (public_input, ProofType::PublicInput), - }; - pool.insert_proof_data( - tx_id_u8.to_vec(), - proof_data, - stored_state_transition.clone().into(), - proof_type, - ) - .await - .unwrap(); - } - _ => { - tracing::warn!("No postgres client found"); + match pg_client.as_ref() { + Some(Ok(pool)) => { + tracing::info!("Inserting proof data into postgres"); + let (proof_data, proof_type) = match proof.clone() { + Proof::Full(full_proof) => (full_proof, ProofType::Full), + Proof::PublicInput(public_input) => { + (public_input, ProofType::PublicInput) + } + }; + pool.insert_proof_data( + tx_id_u8.to_vec(), + proof_data, + stored_state_transition.clone().into(), + proof_type, + ) + .await + .unwrap(); + } + _ => { + tracing::warn!("No postgres client found"); + } } + + self.ledger_db.put_proof_data( + l1_height, + tx_id_u8, + proof, + stored_state_transition, + )?; } for (sequencer_commitment, l1_heights) in @@ -616,9 +634,6 @@ where } } - self.ledger_db - .put_proof_data(l1_height, tx_id_u8, proof, stored_state_transition)?; - self.ledger_db .set_prover_last_scanned_l1_height(SlotNumber(l1_height))?; l1_height += 1; @@ -743,11 +758,25 @@ where tracing::warn!("Processing zk proof: {:?}", proof); let state_transition = match proof.clone() { Proof::Full(proof) => { + // hotfix for devnet deployment + // TODO: handle these deployed bug fixes better + let code_commitment = if serde_json::to_string(&self.code_commitment)? == "[1860130309,3212374340,1571693462,196802355,3242449784,3924610482,1760955211,1058326957]" && soft_batch.da_slot_height <= 6787 + { + serde_json::from_str("[3565622432,3167720487,554880044,1689168947,3495902722,3638273228,1798052366,4175296332]").unwrap() + } else { + self.code_commitment.clone() + }; + + tracing::warn!( + "using code commitment: {:?}", + serde_json::to_string(&code_commitment).unwrap() + ); + if let Ok(proof_data) = Vm::verify_and_extract_output::< ::Spec, Stf::StateRoot, - >(&proof, &self.code_commitment) + >(&proof, &code_commitment) { if proof_data.sequencer_da_public_key != self.sequencer_da_pub_key || proof_data.sequencer_public_key != self.sequencer_pub_key diff --git a/crates/sovereign-sdk/full-node/sov-stf-runner/src/verifier.rs b/crates/sovereign-sdk/full-node/sov-stf-runner/src/verifier.rs index dd573b7dd..778d7a2db 100644 --- a/crates/sovereign-sdk/full-node/sov-stf-runner/src/verifier.rs +++ b/crates/sovereign-sdk/full-node/sov-stf-runner/src/verifier.rs @@ -48,7 +48,18 @@ where data.completeness_proof, )?; - // tracing::info!("going into apply_soft_confirmations_from_sequencer_commitments"); + assert_eq!( + data.initial_state_root.as_ref(), + data.soft_confirmations + .front() + .expect("At least one set of soft confirmations") + .first() + .expect("At least one soft confirmation") + .pre_state_root() + .as_slice(), + "Invalid initial state root" + ); + println!("going into apply_soft_confirmations_from_sequencer_commitments"); let (final_state_root, state_diff) = self .app diff --git a/crates/sovereign-sdk/fuzz/Cargo.lock b/crates/sovereign-sdk/fuzz/Cargo.lock index 2b1fd90e3..b1ae6a7cd 100644 --- a/crates/sovereign-sdk/fuzz/Cargo.lock +++ b/crates/sovereign-sdk/fuzz/Cargo.lock @@ -2877,7 +2877,7 @@ dependencies = [ [[package]] name = "sov-accounts" -version = "0.3.0" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "arbitrary", @@ -2896,7 +2896,7 @@ dependencies = [ [[package]] name = "sov-bank" -version = "0.3.0" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -2912,7 +2912,7 @@ dependencies = [ [[package]] name = "sov-celestia-adapter" -version = "0.3.0" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "async-trait", @@ -2941,7 +2941,7 @@ dependencies = [ [[package]] name = "sov-db" -version = "0.3.0" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "bincode", @@ -2958,7 +2958,7 @@ dependencies = [ [[package]] name = "sov-modules-api" -version = "0.3.0" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "arbitrary", @@ -2987,7 +2987,7 @@ dependencies = [ [[package]] name = "sov-modules-core" -version = "0.3.0" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "arbitrary", @@ -3008,7 +3008,7 @@ dependencies = [ [[package]] name = "sov-modules-macros" -version = "0.3.0" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", @@ -3021,7 +3021,7 @@ dependencies = [ [[package]] name = "sov-prover-storage-manager" -version = "0.3.0" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "sov-db", @@ -3033,7 +3033,7 @@ dependencies = [ [[package]] name = "sov-rollup-interface" -version = "0.3.0" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "async-trait", @@ -3051,7 +3051,7 @@ dependencies = [ [[package]] name = "sov-schema-db" -version = "0.3.0" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "once_cell", @@ -3063,7 +3063,7 @@ dependencies = [ [[package]] name = "sov-state" -version = "0.3.0" +version = "0.4.0-rc.3" dependencies = [ "anyhow", "arbitrary", @@ -3084,7 +3084,7 @@ dependencies = [ [[package]] name = "sovereign-sdk-fuzz" -version = "0.3.0" +version = "0.4.0-rc.3" dependencies = [ "libfuzzer-sys", "rand", diff --git a/crates/sovereign-sdk/fuzz/Cargo.toml b/crates/sovereign-sdk/fuzz/Cargo.toml index eaf6afe47..7b259cb68 100644 --- a/crates/sovereign-sdk/fuzz/Cargo.toml +++ b/crates/sovereign-sdk/fuzz/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sovereign-sdk-fuzz" -version = "0.4.0-rc.2" +version = "0.4.0-rc.3" publish = false edition = "2021" diff --git a/crates/sovereign-sdk/module-system/sov-modules-stf-blueprint/src/lib.rs b/crates/sovereign-sdk/module-system/sov-modules-stf-blueprint/src/lib.rs index 7fa856fd0..aaffdcfa0 100644 --- a/crates/sovereign-sdk/module-system/sov-modules-stf-blueprint/src/lib.rs +++ b/crates/sovereign-sdk/module-system/sov-modules-stf-blueprint/src/lib.rs @@ -515,21 +515,16 @@ where let mut index_soft_confirmation = 0; let mut current_da_height = da_block_headers[index_headers].height(); - assert_eq!( - soft_confirmations[index_soft_confirmation] - .pre_state_root() - .as_slice(), - initial_state_root.as_ref() - ); - assert_eq!( soft_confirmations[index_soft_confirmation].da_slot_hash(), - da_block_headers[index_headers].hash().into() + da_block_headers[index_headers].hash().into(), + "Soft confirmation DA slot hash must match DA block header hash" ); assert_eq!( soft_confirmations[index_soft_confirmation].da_slot_height(), - da_block_headers[index_headers].height() + da_block_headers[index_headers].height(), + "Soft confirmation DA slot height must match DA block header height" ); index_soft_confirmation += 1; @@ -543,7 +538,8 @@ where { assert_eq!( soft_confirmations[index_soft_confirmation].da_slot_height(), - da_block_headers[index_headers].height() + da_block_headers[index_headers].height(), + "Soft confirmation DA slot height must match DA block header height" ); index_soft_confirmation += 1; @@ -553,12 +549,14 @@ where // this can also be done in soft confirmation rule enforcer? assert_eq!( da_block_headers[index_headers].height(), - current_da_height + 1 + current_da_height + 1, + "DA block headers must be in order" ); assert_eq!( da_block_headers[index_headers - 1].hash(), - da_block_headers[index_headers].prev_hash() + da_block_headers[index_headers].prev_hash(), + "DA block headers must be in order" ); current_da_height += 1; @@ -566,12 +564,14 @@ where // if the next one is not matching, then the state transition is invalid. assert_eq!( soft_confirmations[index_soft_confirmation].da_slot_hash(), - da_block_headers[index_headers].hash().into() + da_block_headers[index_headers].hash().into(), + "Soft confirmation DA slot hash must match DA block header hash" ); assert_eq!( soft_confirmations[index_soft_confirmation].da_slot_height(), - da_block_headers[index_headers].height() + da_block_headers[index_headers].height(), + "Soft confirmation DA slot height must match DA block header height" ); index_soft_confirmation += 1; @@ -579,7 +579,11 @@ where } // final da header was checked against - assert_eq!(index_headers, da_block_headers.len() - 1); + assert_eq!( + index_headers, + da_block_headers.len() - 1, + "All DA headers must be checked" + ); // now verify the claimed merkle root of soft confirmation hashes let mut soft_confirmation_hashes = vec![]; @@ -593,7 +597,11 @@ where let calculated_root = MerkleTree::::from_leaves(soft_confirmation_hashes.as_slice()).root(); - assert_eq!(calculated_root, Some(sequencer_commitment.merkle_root)); + assert_eq!( + calculated_root, + Some(sequencer_commitment.merkle_root), + "Invalid merkle root" + ); let mut witness_iter = witnesses.into_iter(); let mut da_block_headers_iter = da_block_headers.into_iter().peekable();