@@ -60,10 +60,7 @@ pub trait SigmaProtocol {
6060 response : & Self :: Response ,
6161 ) -> Result < ( ) , ProofError > ;
6262
63- /// Serializes a proof transcript (commitment, challenge, response) to bytes for batching.
64- ///
65- /// # Panics
66- /// Panics if serialization is not supported for this protocol.
63+ /// Serializes a proof transcript (commitment, challenge, response) to bytes batchable proof.
6764 fn serialize_batchable (
6865 & self ,
6966 _commitment : & Self :: Commitment ,
@@ -73,12 +70,9 @@ pub trait SigmaProtocol {
7370 Err ( ProofError :: NotImplemented ( "serialize_batchable not implemented for this protocol" ) )
7471 }
7572
76- /// Deserializes a proof transcript from bytes.
73+ /// Deserializes a batchable proof from bytes.
7774 ///
7875 /// Returns `Some((commitment, response))` if parsing is successful, otherwise `None`.
79- ///
80- /// # Panics
81- /// Panics if deserialization is not supported for this protocol.
8276 fn deserialize_batchable (
8377 & self ,
8478 _data : & [ u8 ]
@@ -87,13 +81,25 @@ pub trait SigmaProtocol {
8781 }
8882}
8983
84+ /// A feature defining the behavior of a protocol for which it is possible to compact the proofs by omitting the commitments.
85+ ///
86+ /// This is possible if it is possible to retrieve the commitments from the challenge and responses.
87+ /// This is what the get_commitment function is for.
88+ ///
89+ /// ## Minimal Implementation
90+ /// Types implementing `CompactProtocol` must define:
91+ /// - `get_commitment`
9092pub trait CompactProtocol : SigmaProtocol {
93+ /// Returns the commitment for which ('commitment', 'challenge', 'response') is a valid transcription
94+ ///
95+ /// This function allows to omit commitment in compact proofs of the type ('challenge', 'response')
9196 fn get_commitment (
9297 & self ,
9398 challenge : & Self :: Challenge ,
9499 response : & Self :: Response ,
95100 ) -> Self :: Commitment ;
96101
102+ /// Serializes a proof transcript (commitment, challenge, response) to bytes compact proof.
97103 fn serialize_compact (
98104 & self ,
99105 _commitment : & Self :: Commitment ,
@@ -103,6 +109,9 @@ pub trait CompactProtocol: SigmaProtocol {
103109 Err ( ProofError :: NotImplemented ( "serialize_compact not implemented for this protocol" ) )
104110 }
105111
112+ /// Deserializes a compact proof from bytes.
113+ ///
114+ /// Returns `Some((challenge, response))` if parsing is successful, otherwise `None`.
106115 fn deserialize_compact (
107116 & self ,
108117 _data : & [ u8 ]
@@ -124,19 +133,13 @@ pub trait SigmaProtocolSimulator: SigmaProtocol {
124133 /// Simulates a protocol transcript given a challenge.
125134 ///
126135 /// This serves to create zero-knowledge simulations without access to a witness.
127- ///
128- /// # Panics
129- /// Panics if simulation is not implemented for this protocol.
130136 fn simulate_proof (
131137 & self ,
132138 challenge : & Self :: Challenge ,
133139 rng : & mut ( impl Rng + CryptoRng ) ,
134140 ) -> ( Self :: Commitment , Self :: Response ) ;
135141
136142 /// Simulates an entire protocol transcript.
137- ///
138- /// # Panics
139- /// Panics if simulation is not implemented for this protocol.
140143 fn simulate_transcript (
141144 & self ,
142145 rng : & mut ( impl Rng + CryptoRng ) ,
0 commit comments