(
&mut self,
rng: &mut R,
comm_key: &'a [G],
message: G::ScalarField,
blinding: Option<G::ScalarField>,
)
| 51 | } |
| 52 | |
| 53 | pub fn init<R: RngCore>( |
| 54 | &mut self, |
| 55 | rng: &mut R, |
| 56 | comm_key: &'a [G], |
| 57 | message: G::ScalarField, |
| 58 | blinding: Option<G::ScalarField>, |
| 59 | ) -> Result<(), ProofSystemError> { |
| 60 | if self.sp1.is_some() || self.sp2.is_some() { |
| 61 | return Err(ProofSystemError::SubProtocolAlreadyInitialized(self.id)); |
| 62 | } |
| 63 | let msg_as_u64 = enforce_and_get_u64::<G::ScalarField>(&message)?; |
| 64 | |
| 65 | // blindings for the commitments in the Bulletproofs++ proof, there will be 2 Bulletproofs++ proofs, for ranges `(message - min)` and `(max - message)` |
| 66 | let bpp_randomness = vec![G::ScalarField::rand(rng), G::ScalarField::rand(rng)]; |
| 67 | let (commitments, values) = ProofArbitraryRange::compute_commitments_and_values( |
| 68 | vec![(msg_as_u64, self.min, self.max)], |
| 69 | &bpp_randomness, |
| 70 | &self.setup_params, |
| 71 | )?; |
| 72 | self.init_schnorr_protocol( |
| 73 | rng, |
| 74 | comm_key, |
| 75 | message, |
| 76 | blinding, |
| 77 | (bpp_randomness[0], bpp_randomness[1]), |
| 78 | &commitments, |
| 79 | )?; |
| 80 | self.values = Some(values); |
| 81 | self.commitments = Some(commitments); |
| 82 | self.bpp_randomness = Some(bpp_randomness); |
| 83 | Ok(()) |
| 84 | } |
| 85 | |
| 86 | fn init_schnorr_protocol<R: RngCore>( |
| 87 | &mut self, |
no test coverage detected