@@ -22,24 +22,17 @@ use rand::{CryptoRng, RngCore};
2222/// deterministic challenge generation function.
2323///
2424/// Challenge generation occurs in two stages:
25- /// - `push_commitment `: absorbs commitments to feed the codec
25+ /// - `absorb_statement_and_commitment `: absorbs commitments to feed the codec
2626/// - `get_challenge`: extracts the challenge from the codec
2727///
2828/// # Type Parameters
2929/// - `C`: the codec used for encoding/decoding messages to/from the IP space.
3030pub trait FiatShamir < C : Codec > : SigmaProtocol {
31- fn push_commitment ( & self , codec : & mut C , commitment : & Self :: Commitment ) ;
31+ fn absorb_statement_and_commitment ( & self , codec : & mut C , commitment : & Self :: Commitment ) ;
3232
3333 fn get_challenge ( & self , codec : & mut C ) -> Result < Self :: Challenge , Error > ;
3434}
3535
36- /// Structures implementing this trait must implicitly have an associated linear relation.
37- ///
38- /// This trait allows the data of the morphisms underlying the structure to be absorbed into a codec.
39- pub trait HasGroupMorphism {
40- fn absorb_morphism_structure < C : Codec > ( & self , codec : & mut C ) -> Result < ( ) , Error > ;
41- }
42-
4336type Transcript < P > = (
4437 <P as SigmaProtocol >:: Commitment ,
4538 <P as SigmaProtocol >:: Challenge ,
@@ -116,7 +109,8 @@ where
116109
117110 let ( commitment, prover_state) = self . sigmap . prover_commit ( witness, rng) ?;
118111 // Fiat Shamir challenge
119- self . sigmap . push_commitment ( & mut codec, & commitment) ;
112+ self . sigmap
113+ . absorb_statement_and_commitment ( & mut codec, & commitment) ;
120114 let challenge = self . sigmap . get_challenge ( & mut codec) ?;
121115 // Prover's response
122116 let response = self . sigmap . prover_response ( prover_state, & challenge) ?;
@@ -149,7 +143,8 @@ where
149143 let mut codec = self . hash_state . clone ( ) ;
150144
151145 // Recompute the challenge
152- self . sigmap . push_commitment ( & mut codec, commitment) ;
146+ self . sigmap
147+ . absorb_statement_and_commitment ( & mut codec, commitment) ;
153148 let expected_challenge = self . sigmap . get_challenge ( & mut codec) ?;
154149 // Verification of the proof
155150 match * challenge == expected_challenge {
@@ -199,7 +194,8 @@ where
199194 let mut codec = self . hash_state . clone ( ) ;
200195
201196 // Recompute the challenge
202- self . sigmap . push_commitment ( & mut codec, & commitment) ;
197+ self . sigmap
198+ . absorb_statement_and_commitment ( & mut codec, & commitment) ;
203199 let challenge = self . sigmap . get_challenge ( & mut codec) ?;
204200 // Verification of the proof
205201 self . sigmap . verifier ( & commitment, & challenge, & response)
@@ -259,15 +255,3 @@ where
259255 self . verify ( & commitment, & challenge, & response)
260256 }
261257}
262-
263- impl < P , C > NISigmaProtocol < P , C >
264- where
265- P : SigmaProtocol + HasGroupMorphism + FiatShamir < C > ,
266- P :: Challenge : PartialEq ,
267- C : Codec < Challenge = P :: Challenge > + Clone ,
268- {
269- /// Absorbs the morphism structure into the transcript codec.
270- pub fn absorb_morphism ( & self , codec : & mut C ) -> Result < ( ) , Error > {
271- self . sigmap . absorb_morphism_structure :: < C > ( codec)
272- }
273- }
0 commit comments