From 8377f57ff49b1b91edff9976661bd354993a6892 Mon Sep 17 00:00:00 2001 From: ocdbytes Date: Thu, 29 May 2025 12:27:08 +0530 Subject: [PATCH 1/2] feat : proving fix --- examples/zksync_adapter/host/src/main.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/zksync_adapter/host/src/main.rs b/examples/zksync_adapter/host/src/main.rs index 560450b8..915ef729 100644 --- a/examples/zksync_adapter/host/src/main.rs +++ b/examples/zksync_adapter/host/src/main.rs @@ -101,6 +101,9 @@ async fn main() -> Result<(), Error> { #[cfg(feature = "sp1")] let ZKSYNC_ADAPTER_ID = Prover::new(ZKSYNC_ADAPTER_ELF.to_vec(), prover_mode.clone()).vk(); // since sp1 doesn't implements verify method on proof object + // Initiating prover temporariliy to get the ada[ter id based on prover mode : + let verification_key = Prover::new(ZKSYNC_ADAPTER_ELF.to_vec(), prover_mode.clone()).vk(ZKSYNC_ADAPTER_ID); + // Retrieve or initialize the adapter state data from the database let adapter_state_data = if let Some(data) = db.get::(b"adapter_state_data")? { data @@ -266,7 +269,7 @@ async fn main() -> Result<(), Error> { let rollup_hash = recursive_proof.clone().public_inputs::().unwrap().rollup_hash.unwrap(); #[cfg(feature = "risc0")] - match recursive_proof.0.verify(ZKSYNC_ADAPTER_ID) { + match recursive_proof.0.verify(verification_key) { Ok(()) => { println!("Proof verification successful"); () @@ -291,7 +294,7 @@ async fn main() -> Result<(), Error> { height: current_height, start_nexus_hash: start_nexus_hash.unwrap_or_else(|| H256::from(account_with_proof.account.start_nexus_hash)), app_id: app_account_id.clone(), - img_id: StatementDigest(ZKSYNC_ADAPTER_ID), + img_id: StatementDigest(verification_key), rollup_hash: Some(rollup_hash), }; From 84c64089656a51d21932ea39d8372e0fbc4da9e5 Mon Sep 17 00:00:00 2001 From: ocdbytes Date: Fri, 30 May 2025 18:25:35 +0530 Subject: [PATCH 2/2] feat : updated zksync adapter --- examples/zksync_adapter/host/src/main.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/examples/zksync_adapter/host/src/main.rs b/examples/zksync_adapter/host/src/main.rs index 915ef729..e5609647 100644 --- a/examples/zksync_adapter/host/src/main.rs +++ b/examples/zksync_adapter/host/src/main.rs @@ -54,19 +54,20 @@ async fn main() -> Result<(), Error> { // Retrieve Ethereum node URL and command-line arguments let args: Vec = args().collect(); - if args.len() <= 2 { - if args.len() == 2 && args[1] == "--dev" { - eprintln!("Usage: cargo run -- [--dev] [--app_id ]"); + if args.len() <= 3 { + if args.len() == 3 && args[1] == "--dev" { + eprintln!("Usage: cargo run -- [--dev] [--app_id ]"); return Ok(()); } - if args.len() < 2 { - eprintln!("Usage: cargo run -- [--dev] [--app_id ]"); + if args.len() < 3 { + eprintln!("Usage: cargo run -- [--dev] [--app_id ]"); return Ok(()); } } let zksync_proof_api_url = &args[1]; + let nexus_api_url = &args[2]; let dev_flag = args.iter().any(|arg| arg == "--dev"); let prover_mode = if dev_flag { ProverMode::MockProof } else { ProverMode::Compressed }; @@ -84,12 +85,12 @@ async fn main() -> Result<(), Error> { } } } else { - eprintln!("Usage: cargo run -- [--dev] [--app_id ]"); + eprintln!("Usage: cargo run -- [--dev] [--app_id ]"); return Ok(()); } } - let nexus_api = NexusAPI::new(&"http://dev.nexus.avail.tools"); + let nexus_api = NexusAPI::new(nexus_api_url); // Create or open the database let db_path = format!("db/{:?}", app_id);