Skip to content

Commit b43fb5a

Browse files
authored
Consolidate spartan-wrapper crates into wrapper submodules (#1439)
## Summary - Move `spartan-wrapper` into `spartan-verifier::wrapper` and `spartan-wrapper-prover` into `spartan-prover::wrapper` - Wire up re-exports from the new submodule locations and delete the old standalone crates - Update all imports and doc links to reference the new paths ## Test plan - `cargo test -p binius-spartan-prover -p binius-spartan-verifier` - `cargo clippy --all --all-features --tests --benches --examples -- -D warnings` - `cargo doc --no-deps --document-private-items` 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent addcc9d commit b43fb5a

File tree

12 files changed

+27
-70
lines changed

12 files changed

+27
-70
lines changed

crates/spartan-prover/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ workspace = true
1111
binius-field = { path = "../field" }
1212
binius-iop = { path = "../iop" }
1313
binius-iop-prover = { path = "../iop-prover" }
14+
binius-ip = { path = "../ip" }
1415
binius-ip-prover = { path = "../ip-prover" }
1516
binius-math = { path = "../math" }
1617
binius-transcript = { path = "../transcript" }
@@ -29,7 +30,11 @@ tracing.workspace = true
2930
[dev-dependencies]
3031
anyhow.workspace = true
3132
binius-hash = { path = "../hash" }
33+
binius-iop = { path = "../iop" }
34+
binius-ip = { path = "../ip" }
3235
binius-math = { path = "../math", features = ["test-utils"] }
36+
binius-spartan-verifier = { path = "../spartan-verifier" }
37+
binius-verifier = { path = "../verifier" }
3338
rand = { workspace = true, features = ["thread_rng"] }
3439
smallvec.workspace = true
3540

crates/spartan-prover/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
mod error;
3131
mod wiring;
32+
pub mod wrapper;
3233

3334
use std::{
3435
iter::{repeat_n, repeat_with},
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
//! interaction through a [`ReplayChannel`] to fill the outer witness, then runs the outer IOP
99
//! prover.
1010
//!
11-
//! [`ZKWrappedVerifierChannel`]: binius_spartan_wrapper::ZKWrappedVerifierChannel
11+
//! [`ZKWrappedVerifierChannel`]: binius_spartan_verifier::wrapper::ZKWrappedVerifierChannel
1212
//! [`BaseFoldZKProverChannel`]: binius_iop_prover::basefold_zk_channel::BaseFoldZKProverChannel
13-
//! [`ReplayChannel`]: binius_spartan_wrapper::ReplayChannel
13+
//! [`ReplayChannel`]: binius_spartan_verifier::wrapper::ReplayChannel
1414
//! [`finish`]: ZKWrappedProverChannel::finish
1515
1616
mod zk_wrapped_prover_channel;

crates/spartan-wrapper-prover/src/zk_wrapped_prover_channel.rs renamed to crates/spartan-prover/src/wrapper/zk_wrapped_prover_channel.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//! a [`ReplayChannel`] to fill the outer witness, then runs the outer IOP prover.
1010
//!
1111
//! [`BaseFoldZKProverChannel`]: binius_iop_prover::basefold_zk_channel::BaseFoldZKProverChannel
12-
//! [`ReplayChannel`]: binius_spartan_wrapper::ReplayChannel
12+
//! [`ReplayChannel`]: binius_spartan_verifier::wrapper::ReplayChannel
1313
//! [`finish`]: ZKWrappedProverChannel::finish
1414
1515
use binius_field::{BinaryField128bGhash as B128, PackedExtension, PackedField};
@@ -23,13 +23,13 @@ use binius_ip::channel::IPVerifierChannel;
2323
use binius_ip_prover::channel::IPProverChannel;
2424
use binius_math::{FieldBuffer, FieldSlice, ntt::AdditiveNTT};
2525
use binius_spartan_frontend::constraint_system::WitnessLayout;
26-
use binius_spartan_prover::IOPProver;
27-
use binius_spartan_verifier::IOPVerifier;
28-
use binius_spartan_wrapper::ReplayChannel;
26+
use binius_spartan_verifier::{IOPVerifier, wrapper::ReplayChannel};
2927
use binius_transcript::fiat_shamir::Challenger;
3028
use binius_utils::SerializeBytes;
3129
use rand::CryptoRng;
3230

31+
use crate::IOPProver;
32+
3333
/// A prover channel that wraps a [`BaseFoldZKProverChannel`] and an outer Spartan IOP prover.
3434
///
3535
/// This channel records all channel values. On
@@ -108,8 +108,8 @@ where
108108
/// 1. Replays the recorded interaction through a [`ReplayChannel`] to fill the outer witness
109109
/// 2. Validates and generates the outer IOP proof
110110
///
111-
/// [`ReplayChannel`]: binius_spartan_wrapper::ReplayChannel
112-
pub fn finish(self, rng: impl CryptoRng) -> Result<(), binius_spartan_prover::Error> {
111+
/// [`ReplayChannel`]: binius_spartan_verifier::wrapper::ReplayChannel
112+
pub fn finish(self, rng: impl CryptoRng) -> Result<(), crate::Error> {
113113
let Self {
114114
inner_channel,
115115
outer_prover,

crates/spartan-wrapper-prover/tests/integration_test.rs renamed to crates/spartan-prover/tests/wrapper_integration_test.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ use binius_spartan_frontend::{
1717
compiler::compile,
1818
constraint_system::BlindingInfo,
1919
};
20-
use binius_spartan_prover::IOPProver;
20+
use binius_spartan_prover::{IOPProver, wrapper::ZKWrappedProverChannel};
2121
use binius_spartan_verifier::{
22-
IOPVerifier, SECURITY_BITS, config::StdChallenger, constraint_system::ConstraintSystemPadded,
22+
IOPVerifier, SECURITY_BITS,
23+
config::StdChallenger,
24+
constraint_system::ConstraintSystemPadded,
25+
wrapper::{IronSpartanBuilderChannel, ZKWrappedVerifierChannel},
2326
};
24-
use binius_spartan_wrapper::{IronSpartanBuilderChannel, ZKWrappedVerifierChannel};
25-
use binius_spartan_wrapper_prover::ZKWrappedProverChannel;
2627
use binius_transcript::ProverTranscript;
2728
use binius_verifier::fri::{self, MinProofSizeStrategy};
2829
use rand::{SeedableRng, rngs::StdRng};

crates/spartan-verifier/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
pub mod config;
3232
pub mod constraint_system;
3333
pub mod wiring;
34+
pub mod wrapper;
3435

3536
use binius_field::{BinaryField, BinaryField128bGhash as B128, field::FieldOps};
3637
use binius_iop::{

crates/spartan-wrapper/src/channel.rs renamed to crates/spartan-verifier/src/wrapper/channel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use binius_spartan_frontend::{
1212
constraint_system::{ConstraintWire, WitnessLayout},
1313
};
1414

15-
use crate::circuit_elem::{CircuitElem, CircuitWire};
15+
use super::circuit_elem::{CircuitElem, CircuitWire};
1616

1717
/// A channel that symbolically executes a verifier, building up an IronSpartan constraint system.
1818
///
File renamed without changes.

crates/spartan-wrapper/src/lib.rs renamed to crates/spartan-verifier/src/wrapper/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ mod tests {
2525
use binius_spartan_frontend::circuit_builder::ConstraintBuilder;
2626

2727
use super::*;
28-
use crate::circuit_elem::{CircuitElem, CircuitWire};
28+
use crate::wrapper::circuit_elem::{CircuitElem, CircuitWire};
2929

3030
type BuildElem = CircuitElem<ConstraintBuilder<B128>>;
3131
type BuildWire = CircuitWire<ConstraintBuilder<B128>>;
@@ -145,7 +145,8 @@ mod tests {
145145
use binius_spartan_frontend::{
146146
circuit_builder::CircuitBuilder, circuits::powers, compiler::compile,
147147
};
148-
use binius_spartan_verifier::{
148+
149+
use crate::{
149150
IOPVerifier,
150151
constraint_system::{BlindingInfo, ConstraintSystemPadded},
151152
};

crates/spartan-wrapper/src/zk_wrapped_channel.rs renamed to crates/spartan-verifier/src/wrapper/zk_wrapped_channel.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ use binius_iop::{
1515
merkle_tree::MerkleTreeScheme,
1616
};
1717
use binius_ip::channel::IPVerifierChannel;
18-
use binius_spartan_verifier::IOPVerifier;
1918
use binius_transcript::fiat_shamir::Challenger;
2019
use binius_utils::DeserializeBytes;
2120

21+
use crate::{Error, IOPVerifier};
22+
2223
/// A verifier channel that wraps a [`BaseFoldZKVerifierChannel`] and an [`IOPVerifier`].
2324
///
2425
/// All values received, sampled, and observed through this channel are recorded as public inputs
@@ -82,7 +83,7 @@ where
8283
/// the required public size, and runs [`IOPVerifier::verify`] against the inner channel.
8384
///
8485
/// Returns the full public input vector on success.
85-
pub fn finish(mut self) -> Result<Vec<B128>, binius_spartan_verifier::Error> {
86+
pub fn finish(mut self) -> Result<Vec<B128>, Error> {
8687
let outer_cs = self.outer_verifier.constraint_system();
8788
let public_size = 1 << outer_cs.log_public();
8889

0 commit comments

Comments
 (0)