From e42cdcbbf5e7af0e98744d3eb3de2ef535dac6d6 Mon Sep 17 00:00:00 2001 From: Stephen <81497928+eigmax@users.noreply.github.com> Date: Fri, 3 May 2024 18:21:41 +0800 Subject: [PATCH] chore: bump powdr (#253) * chore: bump up powdr * chore: bump up powdr --- recursion/Cargo.toml | 7 +++---- zkvm/Cargo.toml | 2 +- zkvm/src/lib.rs | 28 +++++++++++++++++++++------- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/recursion/Cargo.toml b/recursion/Cargo.toml index 701e11b9..c104f943 100644 --- a/recursion/Cargo.toml +++ b/recursion/Cargo.toml @@ -33,10 +33,9 @@ starky = { path = "../starky", default-features = false } plonky = { path = "../plonky", default-features = false } algebraic = { path = "../algebraic", default-features = false } -powdr = { git = "https://github.com/powdr-labs/powdr.git", branch = "avx", default-features = false } -powdr-ast = { git = "https://github.com/powdr-labs/powdr.git", branch = "avx", default-features = false } -powdr-pil-analyzer = { git = "https://github.com/powdr-labs/powdr.git", branch = "avx", default-features = false } - +powdr = { git = "https://github.com/eigmax/powdr", branch = "feature-starky-avx512", default-features = false } +powdr-ast = { git = "https://github.com/eigmax/powdr", branch = "feature-starky-avx512", default-features = false } +powdr-pil-analyzer = { git = "https://github.com/eigmax/powdr", branch = "feature-starky-avx512", default-features = false } [dev-dependencies] env_logger = "0.10" diff --git a/zkvm/Cargo.toml b/zkvm/Cargo.toml index 334866c9..16848282 100644 --- a/zkvm/Cargo.toml +++ b/zkvm/Cargo.toml @@ -10,7 +10,7 @@ itertools = "0.12.0" # serialization log = "0.4.0" -powdr = { git = "https://github.com/powdr-labs/powdr", branch = "avx", default-features = false } +powdr = { git = "https://github.com/eigmax/powdr", branch = "feature-starky-avx512", default-features = false } starky = { path = "../starky" } recursion = { path = "../recursion" } diff --git a/zkvm/src/lib.rs b/zkvm/src/lib.rs index cac123c5..a1a08422 100644 --- a/zkvm/src/lib.rs +++ b/zkvm/src/lib.rs @@ -11,7 +11,7 @@ use starky::{ stark_setup::StarkSetup, types::{StarkStruct, Step}, }; -use std::fs; +use std::fs::{self, create_dir_all /*, remove_dir_all*/}; use std::io::BufWriter; use std::path::Path; use std::time::Instant; @@ -30,7 +30,7 @@ fn generate_witness_and_prove( let start = Instant::now(); log::debug!("Proving ..."); - pipeline = pipeline.with_backend(BackendType::EStark); + pipeline = pipeline.with_backend(BackendType::EStarkStarky); pipeline.compute_proof().unwrap(); let duration = start.elapsed(); log::debug!("Proving took: {:?}", duration); @@ -43,7 +43,7 @@ fn generate_verifier( ) -> Result<()> { let buf = Vec::new(); let mut vw = BufWriter::new(buf); - pipeline = pipeline.with_backend(BackendType::EStark); + pipeline = pipeline.with_backend(BackendType::EStarkStarky); pipeline.export_verification_key(&mut vw).unwrap(); log::debug!("Export verification key done"); let mut setup: StarkSetup = serde_json::from_slice(&vw.into_inner()?)?; @@ -230,6 +230,7 @@ pub fn zkvm_prove_only( //TODO: if we clone it, we lost the information gained from this function rust_continuation( + task, pipeline.clone(), generate_witness_and_prove, bootloader_input, @@ -256,6 +257,7 @@ pub fn zkvm_prove_only( } pub fn rust_continuation( + task: &str, mut pipeline: Pipeline, pipeline_callback: PipelineCallback, bootloader_inputs: Vec, @@ -272,16 +274,28 @@ where // we can assume optimized_pil has been computed let length = pipeline.compute_optimized_pil().unwrap().degree(); - log::info!("\nRunning chunk {}...", i + 1); - let name = format!("{}_chunk_{}", pipeline.name(), i); - let pipeline = pipeline.with_name(name); + let name = format!("{}_chunk_{}", task, i); + log::debug!("\nRunning chunk {} in {}...", i + 1, name); + + // we used to do + //let pipeline = pipeline.with_name(name); + + // now we should do + let parent_path = pipeline.output_dir().unwrap(); + let chunk_dir = parent_path.join(name); + //remove_dir_all(&chunk_dir).unwrap(); + create_dir_all(&chunk_dir).unwrap(); + let pipeline = pipeline.with_output(chunk_dir, true); let jump_to_shutdown_routine = (0..length) .map(|i| (i == start_of_shutdown_routine - 1).into()) .collect(); let pipeline = pipeline.add_external_witness_values(vec![ - ("main.bootloader_input_value".to_string(), bootloader_inputs), + ( + "main_bootloader_inputs.value".to_string(), + bootloader_inputs, + ), ( "main.jump_to_shutdown_routine".to_string(), jump_to_shutdown_routine,