Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ rand_pcg = "0.10"
rayon = "1.10"
spongefish = "0.7.4"
thiserror = "2.0"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }



Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ The workspace contains library crates under `crates/` and the `bitz-cli` package

## Acknowledgments

We thank the authors and maintainers of the projects that support this implementation:

- **[Flock](https://github.com/succinctlabs/flock) and Ligerito.** We use Ligerito through Flock's `flock-core` for our internal binary-field PCS.
- **[Spongefish](https://github.com/arkworks-rs/spongefish).** We use Spongefish for Fiat–Shamir transcripts, challenge generation, and message encoding.
- **[Nethermind's crypto-primitives](https://github.com/NethermindEth/crypto-primitives).** We use its field traits and procedural macros throughout our arithmetic and polynomial code.
Expand Down
1 change: 1 addition & 0 deletions crates/gkr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license.workspace = true
[dependencies]
field = { path = "../field", features = ["spongefish"] }
transcript = {path ="../transcript"}
tracing = { workspace = true }
poly = { path = "../poly" }
num-traits = { workspace = true }
rayon = { workspace = true }
Expand Down
3 changes: 3 additions & 0 deletions crates/gkr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type Point = VecDeque<Field>;
/// Proves the layer-by-layer sumcheck reduction from a claim at `point`
/// (an evaluation point on the output layer) down to a claim on the leaves.
// TODO #[must_use], requires changing the test suite
#[tracing::instrument(name = "Prove GKR", skip_all)]
pub fn gpgkr_prove(
ps: &mut ProverState,
point: &[F128],
Expand Down Expand Up @@ -188,6 +189,7 @@ impl SuffixTable {
const PARALLEL_MIN_LANES: usize = 1 << 12;

#[must_use]
#[tracing::instrument(name = "Verify GKR", skip_all)]
pub fn gpgkr_verify(
vs: &mut VerifierState,
mut claim: Field,
Expand Down Expand Up @@ -280,6 +282,7 @@ impl GrandProductCircuit {
// Returns the final evaluation and the witnesses of the intermediate layers
// Can't consume the input as the circuit is necessary for the initialisation of fiat shamir
// TODO: replace with leaf lookups and add multithreading
#[tracing::instrument(name = "Evaluate grand-product circuit", level = "debug", skip_all)]
pub fn batched_eval(&self, groups: usize) -> (Vec<Field>, LayerWitnesses) {
// +1 to deal with the possible case that the leafs are empty. Given that otherwise the constructor padded it to a power of two, and ilog rounds it down, it becomes a noop
let mut witnesses = Vec::with_capacity((self.leafs.len() + 1).ilog2() as usize);
Expand Down
1 change: 1 addition & 0 deletions crates/pcs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ common = { workspace = true }
field = { workspace = true, features = ["spongefish"] }
flock-core = { workspace = true }
transcript = { workspace = true }
tracing = { workspace = true }
num-traits = { workspace = true }

[dev-dependencies]
Expand Down
1 change: 1 addition & 0 deletions crates/pcs/src/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ impl Pcs {
}

/// Commits to the exact configured number of packed field elements.
#[tracing::instrument(name = "Commit witness", skip_all)]
pub fn commit(&self, packed_witness: &[F128]) -> Result<(Root, ProverData), CommitError> {
// 1. Input Validation
if packed_witness.len() != self.packed_len() {
Expand Down
2 changes: 2 additions & 0 deletions crates/pcs/src/ligerito.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ impl<'a> ReducedProver<'a> {
}

/// Proves one reduced claim and writes the completed opening proof.
#[tracing::instrument(name = "Prove Ligerito", skip_all)]
pub(crate) fn prove(
self,
claim: ReducedClaim,
Expand Down Expand Up @@ -276,6 +277,7 @@ pub(crate) fn read_proof(
Ok(proof)
}

#[tracing::instrument(name = "Verify Ligerito", skip_all)]
pub(crate) fn verify_succinct<F>(
pcs: &Pcs,
commitment: &Root,
Expand Down
29 changes: 19 additions & 10 deletions crates/pcs/src/opening.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ impl From<QueryError> for VerifyError {
}
}

#[tracing::instrument(name = "Prove PCS opening", skip_all)]
pub(crate) fn prove(
pcs: &Pcs,
data: &ProverData,
Expand Down Expand Up @@ -121,6 +122,7 @@ pub(crate) fn prove(
}
}

#[tracing::instrument(name = "Verify PCS opening", skip_all)]
pub(crate) fn verify(
pcs: &Pcs,
commitment: &Root,
Expand Down Expand Up @@ -176,10 +178,14 @@ fn prove_mle(
target: F128,
transcript: &mut ProverState,
) -> Result<(), ProveError> {
let prepared_claims = ring_switch.prepare_claims(as_flock_f128s(prover.witness()), target)?;
write_claims(transcript, &prepared_claims.claims);
let batching_point = sample_challenges(transcript);
let dense_reduction = prepared_claims.reduce_dense(&batching_point);
let dense_reduction = {
let _span = tracing::info_span!("Ring switch").entered();
let prepared_claims =
ring_switch.prepare_claims(as_flock_f128s(prover.witness()), target)?;
write_claims(transcript, &prepared_claims.claims);
let batching_point = sample_challenges(transcript);
prepared_claims.reduce_dense(&batching_point)
};
prover.prove(dense_reduction, transcript)
}

Expand All @@ -192,12 +198,15 @@ fn verify_mle(
transcript: &mut VerifierState<'_>,
) -> Result<(), VerifyError> {
let proof = ligerito::read_proof(pcs, commitment, transcript)?;
let claims = read_claims(transcript)?;
if !ring_switch.target_matches(&claims, target) {
return Err(VerifyError::VerificationFailed);
}
let batching_point = sample_challenges(transcript);
let reduction = ring_switch.reduce_succinct(&claims, &batching_point);
let reduction = {
let _span = tracing::info_span!("Verify ring switch").entered();
let claims = read_claims(transcript)?;
if !ring_switch.target_matches(&claims, target) {
return Err(VerifyError::VerificationFailed);
}
let batching_point = sample_challenges(transcript);
ring_switch.reduce_succinct(&claims, &batching_point)
};
ligerito::verify_succinct(
pcs,
commitment,
Expand Down
2 changes: 2 additions & 0 deletions crates/pcs/src/sumcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub(super) struct MleClaim {
}

/// Proves the reduction using a temporary dense table of witness evaluations.
#[tracing::instrument(name = "Prove inner-product sumcheck", skip_all)]
pub(super) fn prove(
claim: &LinearClaim<F128>,
packed_witness: &[F128],
Expand Down Expand Up @@ -81,6 +82,7 @@ pub(super) fn prove(
}

/// Verifies sumcheck and returns a witness claim that still requires the final PCS opening.
#[tracing::instrument(name = "Verify inner-product sumcheck", skip_all)]
pub(super) fn verify(
claim: &LinearClaim<F128>,
transcript: &mut VerifierState<'_>,
Expand Down
1 change: 1 addition & 0 deletions crates/prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ common = { workspace = true }
field = { workspace = true, features = ["spongefish"] }
pcs = { workspace = true }
transcript = { workspace = true }
tracing = { workspace = true }
gkr = {workspace = true}
num-traits = {workspace = true}
poly = {workspace= true}
Expand Down
Loading
Loading