@@ -50,16 +50,16 @@ pub type PcsParams<S> = ring_proof::pcs::kzg::urs::URS<<S as RingSuite>::Pairing
5050///
5151/// Basically all the application specific parameters required to construct and
5252/// verify the ring proof.
53- type PiopParams < S > = ring_proof:: PiopParams < BaseField < S > , CurveConfig < S > > ;
53+ pub type PiopParams < S > = ring_proof:: PiopParams < BaseField < S > , CurveConfig < S > > ;
5454
5555/// Ring keys commitment.
5656pub type RingCommitment < S > = ring_proof:: FixedColumnsCommitted < BaseField < S > , PcsCommitment < S > > ;
5757
5858/// Ring prover key.
59- pub type ProverKey < S > = ring_proof:: ProverKey < BaseField < S > , Pcs < S > , TEAffine < CurveConfig < S > > > ;
59+ pub type RingProverKey < S > = ring_proof:: ProverKey < BaseField < S > , Pcs < S > , TEAffine < CurveConfig < S > > > ;
6060
6161/// Ring verifier key.
62- pub type VerifierKey < S > = ring_proof:: VerifierKey < BaseField < S > , Pcs < S > > ;
62+ pub type RingVerifierKey < S > = ring_proof:: VerifierKey < BaseField < S > , Pcs < S > > ;
6363
6464/// Ring prover.
6565pub type RingProver < S > = ring_proof:: ring_prover:: RingProver < BaseField < S > , Pcs < S > , CurveConfig < S > > ;
@@ -72,34 +72,9 @@ pub type RingVerifier<S> =
7272///
7373/// This is the primitive ring proof used in conjunction with Pedersen proof to
7474/// construct the actual ring vrf proof [`Proof`].
75- pub type RingProof < S > = ring_proof:: RingProof < BaseField < S > , Pcs < S > > ;
75+ pub type RingBareProof < S > = ring_proof:: RingProof < BaseField < S > , Pcs < S > > ;
7676
77- /// Define type aliases for the given ring suite.
78- #[ macro_export]
79- macro_rules! ring_suite_types {
80- ( $suite: ident) => {
81- #[ allow( dead_code) ]
82- pub type PcsParams = $crate:: ring:: PcsParams <$suite>;
83- #[ allow( dead_code) ]
84- pub type RingContext = $crate:: ring:: RingContext <$suite>;
85- #[ allow( dead_code) ]
86- pub type RingCommitment = $crate:: ring:: RingCommitment <$suite>;
87- #[ allow( dead_code) ]
88- pub type RingVerifierKey = $crate:: ring:: VerifierKey <$suite>;
89- #[ allow( dead_code) ]
90- pub type RingProver = $crate:: ring:: RingProver <$suite>;
91- #[ allow( dead_code) ]
92- pub type RingVerifier = $crate:: ring:: RingVerifier <$suite>;
93- #[ allow( dead_code) ]
94- pub type RingProof = $crate:: ring:: RingProof <$suite>;
95- #[ allow( dead_code) ]
96- pub type Proof = $crate:: ring:: Proof <$suite>;
97- } ;
98- }
99-
100- /// Ring proof bundled together with a Pedersen proof.
101- ///
102- /// Pedersen proof is used to provide VRF capability.
77+ /// Ring VRF proof.
10378#[ derive( Clone , CanonicalSerialize , CanonicalDeserialize ) ]
10479pub struct Proof < S : RingSuite >
10580where
10883 AffinePoint < S > : TEMapping < CurveConfig < S > > ,
10984{
11085 pub pedersen_proof : PedersenProof < S > ,
111- pub ring_proof : RingProof < S > ,
86+ pub ring_proof : RingBareProof < S > ,
11287}
11388
11489/// Ring VRF prover.
@@ -280,19 +255,19 @@ where
280255 self . piop_params . keyset_part_size
281256 }
282257
283- /// Construct a `ProverKey` instance for the given ring.
258+ /// Construct [`RingProverKey`] for the given ring.
284259 ///
285260 /// Note: if `pks.len() > self.max_ring_size()` the extra keys in the tail are ignored.
286- pub fn prover_key ( & self , pks : & [ AffinePoint < S > ] ) -> ProverKey < S > {
261+ pub fn prover_key ( & self , pks : & [ AffinePoint < S > ] ) -> RingProverKey < S > {
287262 let pks = TEMapping :: to_te_slice ( & pks[ ..pks. len ( ) . min ( self . max_ring_size ( ) ) ] ) ;
288263 ring_proof:: index ( & self . pcs_params , & self . piop_params , & pks) . 0
289264 }
290265
291- /// Construct `RingProver` from `ProverKey` for the prover implied by `key_index`.
266+ /// Construct [ `RingProver`] from [`RingProverKey`] for the prover implied by `key_index`.
292267 ///
293268 /// Key index is the prover index within the `pks` sequence passed to construct the
294- /// `ProverKey` via the `prover_key` method.
295- pub fn prover ( & self , prover_key : ProverKey < S > , key_index : usize ) -> RingProver < S > {
269+ /// [`RingProverKey`] via the `prover_key` method.
270+ pub fn prover ( & self , prover_key : RingProverKey < S > , key_index : usize ) -> RingProver < S > {
296271 RingProver :: < S > :: init (
297272 prover_key,
298273 self . piop_params . clone ( ) ,
@@ -301,42 +276,48 @@ where
301276 )
302277 }
303278
304- /// Construct a `VerifierKey ` instance for the given ring.
279+ /// Construct a `RingVerifierKey ` instance for the given ring.
305280 ///
306281 /// Note: if `pks.len() > self.max_ring_size()` the extra keys in the tail are ignored.
307- pub fn verifier_key ( & self , pks : & [ AffinePoint < S > ] ) -> VerifierKey < S > {
282+ pub fn verifier_key ( & self , pks : & [ AffinePoint < S > ] ) -> RingVerifierKey < S > {
308283 let pks = TEMapping :: to_te_slice ( & pks[ ..pks. len ( ) . min ( self . max_ring_size ( ) ) ] ) ;
309284 ring_proof:: index ( & self . pcs_params , & self . piop_params , & pks) . 1
310285 }
311286
312- /// Construct `VerifierKey ` instance for the ring previously committed.
287+ /// Construct `RingVerifierKey ` instance for the ring previously committed.
313288 ///
314289 /// The `RingCommitment` instance can be obtained via the `VerifierKey::commitment()` method.
315290 ///
316291 /// This allows to quickly reconstruct the verifier key without having to recompute the
317292 /// keys commitment.
318- pub fn verifier_key_from_commitment ( & self , commitment : RingCommitment < S > ) -> VerifierKey < S > {
293+ pub fn verifier_key_from_commitment (
294+ & self ,
295+ commitment : RingCommitment < S > ,
296+ ) -> RingVerifierKey < S > {
319297 use ring_proof:: pcs:: PcsParams ;
320- VerifierKey :: < S > :: from_commitment_and_kzg_vk ( commitment, self . pcs_params . raw_vk ( ) )
298+ RingVerifierKey :: < S > :: from_commitment_and_kzg_vk ( commitment, self . pcs_params . raw_vk ( ) )
321299 }
322300
323- /// Construct `RingVerifier` from `VerifierKey `.
324- pub fn verifier ( & self , verifier_key : VerifierKey < S > ) -> RingVerifier < S > {
301+ /// Construct `RingVerifier` from `RingVerifierKey `.
302+ pub fn verifier ( & self , verifier_key : RingVerifierKey < S > ) -> RingVerifier < S > {
325303 RingVerifier :: < S > :: init (
326304 verifier_key,
327305 self . piop_params . clone ( ) ,
328306 ring_proof:: ArkTranscript :: new ( S :: SUITE_ID ) ,
329307 )
330308 }
331309
332- /// Constructs a `RingVerifier` from a `VerifierKey ` without a `RingContext` instance .
310+ /// Constructs a `RingVerifier` from `RingVerifierKey ` without no `RingContext`.
333311 ///
334312 /// While this approach is slightly less efficient than using a pre-constructed `RingContext`,
335313 /// as some parameters need to be computed on-the-fly, it is beneficial in memory or
336314 /// storage constrained environments. This avoids the need to retain the full `RingContext` for
337315 /// ring signature verification. Instead, the `VerifierKey` contains only the essential information
338316 /// needed to verify ring proofs.
339- pub fn verifier_no_context ( verifier_key : VerifierKey < S > , ring_size : usize ) -> RingVerifier < S > {
317+ pub fn verifier_no_context (
318+ verifier_key : RingVerifierKey < S > ,
319+ ring_size : usize ,
320+ ) -> RingVerifier < S > {
340321 RingVerifier :: < S > :: init (
341322 verifier_key,
342323 piop_params :: < S > ( domain_size :: < S > ( ring_size) ) ,
@@ -408,6 +389,29 @@ where
408389 }
409390}
410391
392+ /// Define type aliases for the given ring suite.
393+ #[ macro_export]
394+ macro_rules! ring_suite_types {
395+ ( $suite: ident) => {
396+ #[ allow( dead_code) ]
397+ pub type PcsParams = $crate:: ring:: PcsParams <$suite>;
398+ #[ allow( dead_code) ]
399+ pub type RingContext = $crate:: ring:: RingContext <$suite>;
400+ #[ allow( dead_code) ]
401+ pub type RingProverKey = $crate:: ring:: RingProverKey <$suite>;
402+ #[ allow( dead_code) ]
403+ pub type RingVerifierKey = $crate:: ring:: RingVerifierKey <$suite>;
404+ #[ allow( dead_code) ]
405+ pub type RingCommitment = $crate:: ring:: RingCommitment <$suite>;
406+ #[ allow( dead_code) ]
407+ pub type RingProver = $crate:: ring:: RingProver <$suite>;
408+ #[ allow( dead_code) ]
409+ pub type RingVerifier = $crate:: ring:: RingVerifier <$suite>;
410+ #[ allow( dead_code) ]
411+ pub type Proof = $crate:: ring:: Proof <$suite>;
412+ } ;
413+ }
414+
411415#[ cfg( test) ]
412416pub ( crate ) mod testing {
413417 use super :: * ;
@@ -555,7 +559,7 @@ pub(crate) mod testing {
555559 pub pedersen : pedersen:: testing:: TestVector < S > ,
556560 pub ring_pks : [ AffinePoint < S > ; TEST_RING_SIZE ] ,
557561 pub ring_pks_com : RingCommitment < S > ,
558- pub ring_proof : RingProof < S > ,
562+ pub ring_proof : RingBareProof < S > ,
559563 }
560564
561565 impl < S : RingSuite > core:: fmt:: Debug for TestVector < S >
@@ -625,7 +629,7 @@ pub(crate) mod testing {
625629
626630 let ring_pks = map. get :: < [ AffinePoint < S > ; TEST_RING_SIZE ] > ( "ring_pks" ) ;
627631 let ring_pks_com = map. get :: < RingCommitment < S > > ( "ring_pks_com" ) ;
628- let ring_proof = map. get :: < RingProof < S > > ( "ring_proof" ) ;
632+ let ring_proof = map. get :: < RingBareProof < S > > ( "ring_proof" ) ;
629633
630634 Self {
631635 pedersen,
0 commit comments