diff --git a/zkvm-host/bin/cost_estimator.rs b/zkvm-host/bin/cost_estimator.rs index e36aace4..2761502e 100644 --- a/zkvm-host/bin/cost_estimator.rs +++ b/zkvm-host/bin/cost_estimator.rs @@ -56,6 +56,8 @@ async fn main() -> Result<()> { run_native_host(&native_execution_data).await?; } + println!("Ran native host for block {}", block_num); + // Execute the Kona program. let report = execute_kona_program(&block_data.into()); diff --git a/zkvm-host/src/helpers.rs b/zkvm-host/src/helpers.rs index c2bb4efb..cda88837 100644 --- a/zkvm-host/src/helpers.rs +++ b/zkvm-host/src/helpers.rs @@ -35,7 +35,10 @@ pub fn load_kv_store(data_dir: &PathBuf) -> HashMap<[u8; 32], Vec, BytesHash fn get_file_count(data_dir: &PathBuf) -> usize { let mut file_count = 0; - for entry in fs::read_dir(data_dir).expect("failed to read data dir") { + for entry in fs::read_dir(data_dir).expect(&format!( + "failed to read data dir {}", + data_dir.to_str().unwrap() + )) { let entry = entry.unwrap(); if entry.metadata().unwrap().is_file() { file_count += 1; diff --git a/zkvm-host/src/lib.rs b/zkvm-host/src/lib.rs index ac7474f4..0702ca9c 100644 --- a/zkvm-host/src/lib.rs +++ b/zkvm-host/src/lib.rs @@ -2,6 +2,7 @@ pub mod fetcher; pub mod helpers; use alloy_primitives::B256; +use cargo_metadata::MetadataCommand; use fetcher::NativeExecutionBlockData; use sp1_core::runtime::ExecutionReport; use sp1_sdk::{PlonkBn254Proof, ProverClient, SP1ProofWithPublicValues, SP1Stdin}; @@ -71,7 +72,11 @@ fn get_kona_program_input(boot_info: &BootInfoWithoutRollupConfig) -> SP1Stdin { stdin.write(&boot_info); // Read KV store into raw bytes and pass to stdin. - let kv_store = load_kv_store(&format!("../data/{}", boot_info.l2_claim_block).into()); + let metadata = MetadataCommand::new().exec().unwrap(); + let workspace_root = metadata.workspace_root; + let data_directory = format!("{}/data/{}", workspace_root, boot_info.l2_claim_block); + + let kv_store = load_kv_store(&data_directory.into()); let mut serializer = CompositeSerializer::new( AlignedSerializer::new(AlignedVec::new()),