1414
1515use crate :: codec:: Codec ;
1616use crate :: errors:: Error ;
17- use crate :: group_morphism:: HasGroupMorphism ;
1817use crate :: traits:: { CompactProtocol , SigmaProtocol } ;
1918
20- use group:: { Group , GroupEncoding } ;
2119use rand:: { CryptoRng , RngCore } ;
2220
2321pub trait FiatShamir < C : Codec > : SigmaProtocol {
@@ -26,6 +24,13 @@ pub trait FiatShamir<C: Codec>: SigmaProtocol {
2624 fn get_challenge ( & self , codec : & mut C ) -> Result < Self :: Challenge , Error > ;
2725}
2826
27+ /// Trait for accessing the underlying group morphism in a Sigma protocol.
28+ pub trait HasGroupMorphism {
29+ /// Absorbs the morphism structure into a codec.
30+ /// Only compatible with 64-bit platforms
31+ fn absorb_morphism_structure < C : Codec > ( & self , codec : & mut C ) -> Result < ( ) , Error > ;
32+ }
33+
2934type Transcript < P > = (
3035 <P as SigmaProtocol >:: Commitment ,
3136 <P as SigmaProtocol >:: Challenge ,
@@ -249,13 +254,12 @@ where
249254
250255impl < P , C > NISigmaProtocol < P , C >
251256where
252- P : SigmaProtocol < Challenge = < P :: Group as Group > :: Scalar > + HasGroupMorphism + FiatShamir < C > ,
257+ P : SigmaProtocol + HasGroupMorphism + FiatShamir < C > ,
253258 P :: Challenge : PartialEq ,
254- P :: Group : Group + GroupEncoding ,
255259 C : Codec < Challenge = P :: Challenge > + Clone ,
256260{
257261 /// Absorbs the morphism structure into the transcript codec.
258262 pub fn absorb_morphism ( & self , codec : & mut C ) -> Result < ( ) , Error > {
259- self . sigmap . absorb_morphism_structure ( codec)
263+ self . sigmap . absorb_morphism_structure :: < C > ( codec)
260264 }
261265}
0 commit comments