@@ -171,15 +171,18 @@ where
171171 }
172172}
173173
174+ /// Ring proof full parameters.
175+ ///
176+ /// Wraps `PcsParams` and `PiopParams`.
174177#[ derive( Clone ) ]
175178pub struct RingContext < S : RingSuite >
176179where
177180 BaseField < S > : ark_ff:: PrimeField ,
178181 CurveConfig < S > : TECurveConfig + Clone ,
179182 AffinePoint < S > : TEMapping < CurveConfig < S > > ,
180183{
181- pcs_params : PcsParams < S > ,
182- piop_params : PiopParams < S > ,
184+ pub pcs_params : PcsParams < S > ,
185+ pub piop_params : PiopParams < S > ,
183186}
184187
185188/// Evaluation domain size required for the given ring size.
@@ -314,7 +317,10 @@ where
314317 RingVerifierKey :: < S > :: from_commitment_and_kzg_vk ( commitment, self . pcs_params . raw_vk ( ) )
315318 }
316319
317- /// Incremental construction of verifier key.
320+ /// Builder for incremental construction of verifier key.
321+ ///
322+ /// This returns both the builder and `RingBuilderKey`, which may be used to append
323+ /// new key items to the ring builder (as it implements `SrsLoader`).
318324 pub fn verifier_key_builder ( & self ) -> ( RingVerifierKeyBuilder < S > , RingBuilderKey < S > ) {
319325 let domain_size = piop_domain_size_from_pcs_params :: < S > ( & self . pcs_params ) ;
320326 let loader = RingBuilderKey :: < S > :: from_srs ( & self . pcs_params , domain_size) ;
@@ -438,11 +444,15 @@ macro_rules! ring_suite_types {
438444 } ;
439445}
440446
441- /// TODO: describe
447+ /// Information required for incremental ring construction.
448+ ///
449+ /// Basically the SRS in Lagrangian form plus G1 generator used in the monomial form.
450+ /// Can be constructed via the `PcsParams::ck_with_lagrangian()` method.
442451pub type RingBuilderKey < S > =
443452 ring_proof:: ring:: RingBuilderKey < BaseField < S > , <S as RingSuite >:: Pairing > ;
444453
445- type RingVerifierKeyBuilderInner < S > =
454+ // Under construction ring commitment.
455+ type PartialRingCommitment < S > =
446456 ring_proof:: ring:: Ring < BaseField < S > , <S as RingSuite >:: Pairing , CurveConfig < S > > ;
447457
448458type RawVerifierKey < S > = <PcsParams < S > as ring_proof:: pcs:: PcsParams >:: RVK ;
@@ -455,13 +465,14 @@ where
455465 CurveConfig < S > : TECurveConfig + Clone ,
456466 AffinePoint < S > : TEMapping < CurveConfig < S > > ,
457467{
458- inner : RingVerifierKeyBuilderInner < S > ,
468+ partial : PartialRingCommitment < S > ,
459469 raw_vk : RawVerifierKey < S > ,
460470}
461471
462472pub type G1Affine < S > = <<S as RingSuite >:: Pairing as Pairing >:: G1Affine ;
463473pub type G2Affine < S > = <<S as RingSuite >:: Pairing as Pairing >:: G2Affine ;
464474
475+ /// Lagrangian form SRS loader.
465476pub trait SrsLoader < S : RingSuite >
466477where
467478 BaseField < S > : ark_ff:: PrimeField ,
@@ -508,17 +519,14 @@ where
508519 use ring_proof:: pcs:: PcsParams ;
509520 let srs_loader = |range : Range < usize > | srs_loader. load ( range) . ok_or ( ( ) ) ;
510521 let raw_vk = ctx. pcs_params . raw_vk ( ) ;
511- let inner = RingVerifierKeyBuilderInner :: < S > :: empty (
512- & ctx. piop_params ,
513- srs_loader,
514- raw_vk. g1 . into_group ( ) ,
515- ) ;
516- RingVerifierKeyBuilder { inner, raw_vk }
522+ let partial =
523+ PartialRingCommitment :: < S > :: empty ( & ctx. piop_params , srs_loader, raw_vk. g1 . into_group ( ) ) ;
524+ RingVerifierKeyBuilder { partial, raw_vk }
517525 }
518526
519527 #[ inline( always) ]
520528 pub fn free_slots ( & self ) -> usize {
521- self . inner . max_keys - self . inner . curr_keys
529+ self . partial . max_keys - self . partial . curr_keys
522530 }
523531
524532 /// Append a new member to the ring verifier key.
@@ -536,13 +544,13 @@ where
536544 }
537545 let pks = TEMapping :: to_te_slice ( pks) ;
538546 let srs_loader = |range : Range < usize > | srs_loader. load ( range) . ok_or ( ( ) ) ;
539- self . inner . append ( & pks, srs_loader) ;
547+ self . partial . append ( & pks, srs_loader) ;
540548 Ok ( ( ) )
541549 }
542550
543551 /// Finalize and build verifier key.
544552 pub fn finalize ( self ) -> RingVerifierKey < S > {
545- RingVerifierKey :: < S > :: from_ring_and_kzg_vk ( & self . inner , self . raw_vk )
553+ RingVerifierKey :: < S > :: from_ring_and_kzg_vk ( & self . partial , self . raw_vk )
546554 }
547555}
548556
0 commit comments