Conversation
Replace IOPattern-based transcript with whir's DomainSeparator/ProverState/ VerifierState API (rev 246dae28). Update spongefish to v1.0.0-rc1 with byte-oriented Permutation<64> interface. Proof now carries narg_string + hints instead of a single transcript blob. Key changes: - Sponge: Permutation<64> with U=u8, WIDTH=64, RATE=32 - PoW: PoWSolution return type, solution() method - Prover: config.commit()/config.prove() replacing CommitmentWriter/Prover - Verifier: config.receive_commitment()/config.verify() replacing readers - Public weights use Weights::geometric (non-deferred) on both sides - Cross-evaluation hints for dual-commitment path - NTT registration via global type-map for ark_bn254::Fr - Clippy clean on prover/verifier crates
Propagate whir's debug_assertions transcript pattern through WhirR1CSProof so in-process prove→verify (bench tests) passes in debug builds. Add register_ntt() call in bench tests. Point whir to 22efa1b2 (px/reduce-tracing-noise branch).
Replace ark-crypto-primitives-based SkyscraperCRH/SkyscraperMerkleConfig with a whir HashEngine implementation that registers Skyscraper for leaf hashing, internal nodes, and proof-of-work. Uses block4 NEON SIMD on aarch64 for batched compression, with a stack-allocated pair buffer to avoid heap allocation in the hot path.
| #[derive(Debug, Serialize, Deserialize)] | ||
|
|
||
| pub struct WHIRConfigGnark { | ||
| /// number of rounds |
There was a problem hiding this comment.
There does not seem any logical reason to remove comments. Maybe its better to keep it for more context when fixing gnark.
tooling/cli/src/main.rs
Outdated
| fn main() -> Result<()> { | ||
| let args = argh::from_env::<cmd::Args>(); | ||
| let subscriber = Registry::default().with(SpanStats); | ||
| let subscriber = Registry::default().with(SpanStats.with_filter(LevelFilter::INFO)); |
There was a problem hiding this comment.
I think its better to define level instead of defaulting to INFO.
for eg :
// Debug builds: track ALL spans for detailed profiling
// Release builds: only INFO+ to reduce overhead
#[cfg(debug_assertions)]
let level = LevelFilter::TRACE;
#[cfg(not(debug_assertions))]
let level = LevelFilter::INFO;
| pub extern "C" fn pk_init() -> c_int { | ||
| // Initialize tracing/logging if needed | ||
| // For now, we'll keep it simple and just return success | ||
| provekit_common::register_ntt(); |
There was a problem hiding this comment.
Keep the tracing/logging as a TODO comment
| challenge: [u64; 4], | ||
| bits: f64, | ||
| challenge: [u8; 32], | ||
| challenge_u64: [u64; 4], |
There was a problem hiding this comment.
Storing u64 challenge seems redundant. transmuting when required might be a better approach.
For eg : see verify code below
| Self { | ||
| challenge: transmute!(challenge), | ||
| challenge, | ||
| challenge_u64: transmute!(challenge), |
provekit/prover/src/whir_r1cs.rs
Outdated
| .map(|w| covector_dot(w, &c1r_evals)) | ||
| .collect(); | ||
|
|
||
| merlin.prover_hint_ark(&(f_sums_1.clone(), g_sums_1.clone())); |
There was a problem hiding this comment.
unnecessary cloning, these 4 aren't used again hence can be directly passed
| // weights_2 on c1's polynomials. Whir's prove() expects evaluations | ||
| // for ALL (weight, polynomial) pairs in row-major order. | ||
| let c1m_evals = coeffs_to_evals(&c1.masked_polynomial_coeff); | ||
| let c1r_evals = coeffs_to_evals(&c1.random_polynomial_coeff); |
There was a problem hiding this comment.
redundant call , its same as c1m_evals
provekit/prover/src/whir_r1cs.rs
Outdated
| &c2.random_polynomial_coeff, | ||
| ]; | ||
|
|
||
| let poly_evals: Vec<Vec<FieldElement>> = |
There was a problem hiding this comment.
c1m and c1r evals are already calculated before.
use let poly_evals = vec![c1m_evals, c1r_evals, c2m_evals, c2r_evals];
provekit/verifier/src/whir_r1cs.rs
Outdated
| (sums_2.0.try_into().unwrap(), sums_2.1.try_into().unwrap()); | ||
|
|
||
| let mut statement_1 = prepare_statement_for_witness_verifier::<3>( | ||
| _public_weights_challenge, |
There was a problem hiding this comment.
This variable starts with _ , but it is used and not unused, fix naming
provekit/verifier/src/whir_r1cs.rs
Outdated
| // Check deferred linear constraints. | ||
| // The public weight is Geometric (non-deferred), so it's not in the deferred | ||
| // list. | ||
| let offset = 0; |
There was a problem hiding this comment.
Irrelevent comment and remove offset.
- Remove redundant challenge_u64 field in SkyscraperPoW, inline transmute - Add SAFETY comment for unsafe block in SkyscraperHashEngine - Add PoW unit test for Skyscraper - Move coeffs_to_evals and covector_dot to common/utils/zk_utils - Derive Debug on WhirR1CSScheme (WhirConfig now supports it) - Call register_ntt() in create_domain_separator for robustness - Remove unnecessary clones on prover hint submissions - Reuse pre-computed evaluations instead of redundant recomputation - Remove unused _public_weights_challenge from verifier destructuring - Remove dead offset variable in deferred eval checks - Use cfg-based LevelFilter (TRACE debug, INFO release) in CLI - Add TODO for FFI tracing initialization - Restore doc comments on GnarkConfig and WHIRConfigGnark fields - Restore comment about arbitrary no-public-inputs hint
- Remove redundant challenge_u64 field in SkyscraperPoW, inline transmute - Add SAFETY comment for unsafe block in SkyscraperHashEngine - Add PoW unit test for Skyscraper - Move coeffs_to_evals and covector_dot to common/utils/zk_utils - Derive Debug on WhirR1CSScheme (WhirConfig now supports it) - Call register_ntt() in create_domain_separator for robustness - Remove unnecessary clones on prover hint submissions - Reuse pre-computed evaluations instead of redundant recomputation - Remove unused _public_weights_challenge from verifier destructuring - Remove dead offset variable in deferred eval checks - Use cfg-based LevelFilter (TRACE debug, INFO release) in CLI - Add TODO for FFI tracing initialization - Restore doc comments on GnarkConfig and WHIRConfigGnark fields - Restore comment about arbitrary no-public-inputs hint
e17c47c to
ac651c1
Compare
Ports provekit to whir's PR #215 transcript API and PR #217 Weights trait. Uses SHA-256 for Merkle tree hash, transcript sponge, and proof of work.
Changes
IOPattern→DomainSeparator/ProverState/VerifierState. Spongefish v1.0.0-rc1 (byte-oriented).Weightsenum →Covector<F>+dyn Weights<F>trait objects.whir::hash::SHA2), transcript sponge (spongefish::instantiations::SHA256), and PoW. Skyscraper code retained for future use.release-fastprofile, jemalloc, reduced tracing noise.SumcheckIOPattern,WitnessIOPattern,witness_io_pattern.rs.Tested
Prepare → Prove → Verify on
complete_age_check.