diff --git a/plonky2x/examples/mapreduce.rs b/plonky2x/examples/mapreduce.rs index f08d110a1..5fdbae2b7 100644 --- a/plonky2x/examples/mapreduce.rs +++ b/plonky2x/examples/mapreduce.rs @@ -1,6 +1,7 @@ use ethers::types::U64; use itertools::Itertools; use jemallocator::Jemalloc; +use log::debug; use plonky2::plonk::config::{AlgebraicHasher, GenericConfig}; use plonky2x::backend::circuit::{Circuit, PlonkParameters}; use plonky2x::backend::function::VerifiableFunction; @@ -17,7 +18,7 @@ static GLOBAL: Jemalloc = Jemalloc; const BLOCK_ROOT: &str = "0x4f1dd351f11a8350212b534b3fca619a2a95ad8d9c16129201be4a6d73698adb"; /// The number of balances to fetch. -const NB_BALANCES: usize = 8192; +const NB_BALANCES: usize = 131072; /// The batch size for fetching balances and computing the local balance roots. const BATCH_SIZE: usize = 2048; @@ -61,6 +62,7 @@ impl Circuit for MapReduceCircuit { while leafs.len() != 1 { let mut tmp = Vec::new(); for i in 0..leafs.len() / 2 { + debug!("calling sha256 pair w/ curta"); tmp.push(builder.curta_sha256_pair(leafs[i*2], leafs[i*2+1])); } leafs = tmp; diff --git a/plonky2x/src/frontend/builder/mod.rs b/plonky2x/src/frontend/builder/mod.rs index 5b039a0ed..d8f747c4c 100644 --- a/plonky2x/src/frontend/builder/mod.rs +++ b/plonky2x/src/frontend/builder/mod.rs @@ -10,6 +10,7 @@ use backtrace::Backtrace; use ethers::providers::{Http, Middleware, Provider}; use ethers::types::U256; use itertools::Itertools; +use log::debug; use plonky2::iop::generator::SimpleGenerator; use plonky2::iop::target::{BoolTarget, Target}; use plonky2::plonk::circuit_builder::CircuitBuilder as CircuitAPI; @@ -114,6 +115,7 @@ impl, const D: usize> CircuitBuilder { /// Build the circuit. pub fn build(mut self) -> CircuitBuild { if !self.sha256_requests.is_empty() { + debug!("curta constraining sha256"); self.curta_constrain_sha256(); } diff --git a/plonky2x/src/frontend/hash/sha/sha256_curta.rs b/plonky2x/src/frontend/hash/sha/sha256_curta.rs index a636b042a..869a97a25 100644 --- a/plonky2x/src/frontend/hash/sha/sha256_curta.rs +++ b/plonky2x/src/frontend/hash/sha/sha256_curta.rs @@ -2,6 +2,7 @@ use curta::chip::hash::sha::sha256::builder_gadget::{SHA256Builder, SHA256Builde use curta::chip::hash::sha::sha256::generator::SHA256HintGenerator; use curta::math::field::Field; use itertools::Itertools; +use log::debug; use plonky2::iop::target::Target; use crate::backend::circuit::PlonkParameters; @@ -207,6 +208,7 @@ impl, const D: usize> CircuitBuilder { let mut nb_chunks = 0; let mut curr_rq = 0; let mut num_rqs = self.sha256_requests.len(); + debug!("num_rqs: {}", num_rqs); let zero = self.constant::(0u8); let zero_chunk = [zero; 1]; @@ -253,6 +255,7 @@ impl, const D: usize> CircuitBuilder { (0..nb_chunks / 1024) .map(|_| self.api.init_sha256()) .collect_vec(); + debug!("allocated {} curta sha256 gadgets", gadgets.len()); let mut rq_idx = 0; for i in 0..gadgets.len() { diff --git a/succinct.json b/succinct.json index de63bf700..f2505e6ac 100644 --- a/succinct.json +++ b/succinct.json @@ -1,5 +1,5 @@ { "preset": "plonky2", - "build_command": "rm -rf ./build && mkdir build && rustup override set nightly && RUST_LOG=debug cargo run --release --example mapreduce build && cp ./target/release/examples/mapreduce ./build/mapreduce", + "build_command": "rm -rf ./build && mkdir build && rustup override set nightly && RUSTFLAGS=-Ctarget-cpu=native RUST_LOG=debug cargo run --release --example mapreduce build && cp ./target/release/examples/mapreduce ./build/mapreduce", "prove_command": "./build/mapreduce prove --input-json input.json" }