Generate responses for the 3 Schnorr protocols
(
&mut self,
challenge: &E::ScalarField,
)
| 209 | |
| 210 | /// Generate responses for the 3 Schnorr protocols |
| 211 | pub fn gen_proof_contribution( |
| 212 | &mut self, |
| 213 | challenge: &E::ScalarField, |
| 214 | ) -> Result<StatementProof<E>, ProofSystemError> { |
| 215 | if self.ciphertext.is_none() { |
| 216 | return Err(ProofSystemError::SubProtocolNotReadyToGenerateProof( |
| 217 | self.id, |
| 218 | )); |
| 219 | } |
| 220 | let ciphertext = self.ciphertext.take().unwrap(); |
| 221 | let mut sp_chunks = self.sp_chunks.take().unwrap(); |
| 222 | let mut sp_combined = self.sp_combined.take().unwrap(); |
| 223 | let skip_for_chunks = BTreeSet::from_iter(0..ciphertext.enc_chunks.len()); |
| 224 | // Don't generated response for index 0 since its response will come from proofs of one of the signatures. |
| 225 | let skip_for_message = BTreeSet::from([0]); |
| 226 | Ok(StatementProof::Saver(SaverProof { |
| 227 | ciphertext, |
| 228 | snark_proof: self.snark_proof.take().unwrap(), |
| 229 | comm_chunks: sp_chunks.commitment, |
| 230 | comm_combined: sp_combined.commitment, |
| 231 | sp_ciphertext: self |
| 232 | .sp_ciphertext |
| 233 | .take() |
| 234 | .unwrap() |
| 235 | .gen_proof_contribution_as_struct(challenge)?, |
| 236 | sp_chunks: sp_chunks |
| 237 | .gen_partial_proof_contribution_as_struct(challenge, &skip_for_chunks)?, |
| 238 | sp_combined: sp_combined |
| 239 | .gen_partial_proof_contribution_as_struct(challenge, &skip_for_message)?, |
| 240 | })) |
| 241 | } |
| 242 | |
| 243 | /// Verify that the snark proof is valid, the commitment in the ciphertext is correct, the commitment |
| 244 | /// to the chunks and the combined message are equal, the chunks committed in ciphertext are same |
no test coverage detected