Skip to content

Commit

Permalink
chore: bump powdr (#253)
Browse files Browse the repository at this point in the history
* chore: bump up powdr

* chore: bump up powdr
  • Loading branch information
eigmax authored May 3, 2024
1 parent 87b5fe3 commit e42cdcb
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
7 changes: 3 additions & 4 deletions recursion/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion zkvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }

Expand Down
28 changes: 21 additions & 7 deletions zkvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -30,7 +30,7 @@ fn generate_witness_and_prove<F: FieldElement>(
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);
Expand All @@ -43,7 +43,7 @@ fn generate_verifier<F: FieldElement, W: std::io::Write>(
) -> 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<MerkleTreeGL> = serde_json::from_slice(&vw.into_inner()?)?;
Expand Down Expand Up @@ -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,
Expand All @@ -256,6 +257,7 @@ pub fn zkvm_prove_only(
}

pub fn rust_continuation<F: FieldElement, PipelineCallback, E>(
task: &str,
mut pipeline: Pipeline<F>,
pipeline_callback: PipelineCallback,
bootloader_inputs: Vec<F>,
Expand All @@ -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,
Expand Down

0 comments on commit e42cdcb

Please sign in to comment.