Skip to content

Commit

Permalink
More nits
Browse files Browse the repository at this point in the history
  • Loading branch information
davxy committed May 30, 2024
1 parent bcdcd0f commit c4d99a5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub type CurveConfig<S> = <AffinePoint<S> as AffineRepr>::Config;
pub type HashOutput<S> = digest::Output<<S as Suite>::Hasher>;

/// Verification error(s)
#[derive(Debug)]
pub enum Error {
VerificationFailure,
}
Expand Down
4 changes: 2 additions & 2 deletions src/ring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,12 @@ where
self.piop_params.keyset_part_size
}

pub fn prover_key(&self, pks: Vec<AffinePoint<S>>) -> ProverKey<S> {
pub fn prover_key(&self, pks: &[AffinePoint<S>]) -> ProverKey<S> {
let pks = pks.iter().map(|p| p.into_sw()).collect();
ring_proof::index(self.pcs_params.clone(), &self.piop_params, pks).0
}

pub fn verifier_key(&self, pks: Vec<AffinePoint<S>>) -> VerifierKey<S> {
pub fn verifier_key(&self, pks: &[AffinePoint<S>]) -> VerifierKey<S> {
let pks: Vec<_> = pks.iter().map(|p| p.into_sw()).collect();
ring_proof::index(self.pcs_params.clone(), &self.piop_params, pks).1
}
Expand Down
7 changes: 2 additions & 5 deletions src/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,11 @@ where
let mut pks = random_vec::<AffinePoint<S>>(keyset_size, Some(rng));
pks[prover_idx] = public.0;

let prover_key = ring_ctx.prover_key(pks.clone());
let prover_key = ring_ctx.prover_key(&pks);
let prover = ring_ctx.prover(prover_key, prover_idx);
let proof = secret.prove(input, output, b"foo", &prover);
let mut buf = Vec::new();
proof.serialize_compressed(&mut buf).unwrap();
println!("RING PROOF LEN: {}", buf.len());

let verifier_key = ring_ctx.verifier_key(pks);
let verifier_key = ring_ctx.verifier_key(&pks);
let verifier = ring_ctx.verifier(verifier_key);
let result = Public::verify(input, output, b"foo", &proof, &verifier);
assert!(result.is_ok());
Expand Down

0 comments on commit c4d99a5

Please sign in to comment.