diff --git a/host/config/chain_spec_list_default.json b/host/config/chain_spec_list_default.json index b4712b961..79f99c678 100644 --- a/host/config/chain_spec_list_default.json +++ b/host/config/chain_spec_list_default.json @@ -92,7 +92,7 @@ "beacon_rpc": null, "verifier_address":{ "SGX":"0x532efbf6d62720d0b2a2bb9d11066e8588cae6d9", - "SP1":"0x13C845C4D4dc4c16d95Fc3B53F732e231245ae56", + "SP1":"0xFbE49f777E0078b3Fa0bae6de4794c88d6EA6DDD", "RISC0":"0x4fEd801C5a876D4289e869cbEfA1E1A448b10714" }, "genesis_time": 0, @@ -121,7 +121,7 @@ "beacon_rpc": null, "verifier_address": { "SGX":"0xb0f3186FC1963f774f52ff455DC86aEdD0b31F81", - "SP1":"0x13C845C4D4dc4c16d95Fc3B53F732e231245ae56", + "SP1":"0x0000000000000000000000000000000000000000", "RISC0":"0x0000000000000000000000000000000000000000" }, "genesis_time": 0, diff --git a/lib/src/protocol_instance.rs b/lib/src/protocol_instance.rs index ba120555b..cf9b59422 100644 --- a/lib/src/protocol_instance.rs +++ b/lib/src/protocol_instance.rs @@ -14,6 +14,7 @@ use crate::{ }, CycleTracker, }; +use log::info; use reth_evm_ethereum::taiko::ANCHOR_GAS_LIMIT; #[derive(Debug, Clone)] @@ -44,7 +45,7 @@ impl ProtocolInstance { let blob_proof_type = get_blob_proof_type(proof_type, input.taiko.blob_proof_type.clone()); - println!("blob proof type: {:?}", &blob_proof_type); + info!("blob proof type: {:?}", &blob_proof_type); match blob_proof_type { crate::input::BlobProofType::ProofOfEquivalence => { let ct = CycleTracker::start("proof_of_equivalence"); diff --git a/provers/risc0/driver/src/methods/risc0_guest.rs b/provers/risc0/driver/src/methods/risc0_guest.rs index c8e736116..82432997a 100644 --- a/provers/risc0/driver/src/methods/risc0_guest.rs +++ b/provers/risc0/driver/src/methods/risc0_guest.rs @@ -1,5 +1,5 @@ pub const RISC0_GUEST_ELF: &[u8] = include_bytes!("../../../guest/target/riscv32im-risc0-zkvm-elf/release/risc0-guest"); pub const RISC0_GUEST_ID: [u32; 8] = [ - 2273192126, 3371600541, 2393149482, 649684540, 896534796, 3888705079, 1226654129, 1785271921, + 3154357135, 4157790813, 123789652, 116361652, 829137687, 2314522156, 1964429423, 2989684539, ]; diff --git a/provers/sp1/driver/src/lib.rs b/provers/sp1/driver/src/lib.rs index 37af627da..175ce76cd 100644 --- a/provers/sp1/driver/src/lib.rs +++ b/provers/sp1/driver/src/lib.rs @@ -15,7 +15,7 @@ use sp1_sdk::{ network::client::NetworkClient, proto::network::{ProofMode, UnclaimReason}, }; -use sp1_sdk::{HashableKey, ProverClient, SP1Stdin, SP1VerifyingKey}; +use sp1_sdk::{HashableKey, ProverClient, SP1Stdin}; use std::{ borrow::BorrowMut, env, fs, @@ -163,24 +163,34 @@ impl Prover for Sp1Prover { .borrow_mut() .public_values .read::<[u8; 32]>(); - verify_sol(&vk, &proof_bytes, &pi_hash)?; + let fixture = RaikoProofFixture { + vkey: vk.bytes32().to_string(), + public_values: B256::from_slice(&pi_hash).to_string(), + proof: reth_primitives::hex::encode_prefixed(&proof_bytes), + }; + + verify_sol(&fixture)?; time.stop_with("==> Verification complete"); } + let proof_string = if proof_bytes.is_empty() { + None + } else { + // 0x + 64 bytes of the vkey + the proof + // vkey itself contains 0x prefix + Some(format!( + "{}{}", + vk.bytes32(), + reth_primitives::hex::encode(proof_bytes) + )) + }; + + info!( + "Sp1 Prover: block {:?} completed! proof: {:?}", + output.header.number, proof_string + ); Ok::<_, ProverError>(Proof { - proof: { - if proof_bytes.is_empty() { - None - } else { - // 0x + 64 bytes of the vkey + the proof - // vkey itself contains 0x prefix - Some(format!( - "{}{}", - vk.bytes32(), - reth_primitives::hex::encode(proof_bytes) - )) - } - }, + proof: proof_string, quote: None, }) } @@ -248,28 +258,14 @@ fn init_verifier() -> Result { /// A fixture that can be used to test the verification of SP1 zkVM proofs inside Solidity. #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -struct RaikoProofFixture { +pub(crate) struct RaikoProofFixture { vkey: String, public_values: String, proof: String, } -pub fn verify_sol( - vk: &SP1VerifyingKey, - proof_bytes: &[u8], - pi_hash: &[u8; 32], -) -> ProverResult<()> { +fn verify_sol(fixture: &RaikoProofFixture) -> ProverResult<()> { assert!(VERIFIER.is_ok()); - - // Deserialize the public values. - // let pi_hash = proof.public_values.read::<[u8; 32]>(); - - // Create the testing fixture so we can test things end-to-end. - let fixture = RaikoProofFixture { - vkey: vk.bytes32().to_string(), - public_values: B256::from_slice(pi_hash).to_string(), - proof: format!("0x{}", reth_primitives::hex::encode(proof_bytes)), - }; debug!("===> Fixture: {:#?}", fixture); // Save the fixture to a file. diff --git a/provers/sp1/guest/elf/sp1-guest b/provers/sp1/guest/elf/sp1-guest index 77850dd70..61c1da8eb 100755 Binary files a/provers/sp1/guest/elf/sp1-guest and b/provers/sp1/guest/elf/sp1-guest differ diff --git a/script/prove-block.sh b/script/prove-block.sh index b5791de76..7b0d387e7 100755 --- a/script/prove-block.sh +++ b/script/prove-block.sh @@ -53,8 +53,8 @@ elif [ "$proof" == "sp1" ]; then "proof_type": "sp1", "blob_proof_type": "proof_of_equivalence", "sp1": { - "recursion": "core", - "prover": "mock", + "recursion": "plonk", + "prover": "network", "verify": false } ' @@ -147,5 +147,5 @@ for block in $(eval echo {$rangeStart..$rangeEnd}); do }" echo "" - sleep 25.0 + sleep 1.0 done