MCPcopy Create free account
hub / github.com/arkworks-rs/poly-commit / open

Method open

poly-commit/src/linear_codes/mod.rs:300–373  ·  view source on GitHub ↗
(
        ck: &Self::CommitterKey,
        _labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F, P>>,
        commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commit

Source from the content-addressed store, hash-verified

298 }
299
300 fn open<'a>(
301 ck: &Self::CommitterKey,
302 _labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F, P>>,
303 commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
304 point: &'a P::Point,
305 sponge: &mut impl CryptographicSponge,
306 states: impl IntoIterator<Item = &'a Self::CommitmentState>,
307 _rng: Option<&mut dyn RngCore>,
308 ) -> Result<Self::Proof, Self::Error>
309 where
310 P: 'a,
311 Self::CommitmentState: 'a,
312 Self::Commitment: 'a,
313 {
314 let mut proof_array = LPCPArray::default();
315
316 for (labeled_commitment, state) in commitments.into_iter().zip(states) {
317 let commitment = labeled_commitment.commitment();
318 let n_rows = commitment.metadata.n_rows;
319 let n_cols = commitment.metadata.n_cols;
320
321 // 1. Arrange the coefficients of the polynomial into a matrix,
322 // and apply encoding to get `ext_mat`.
323 // 2. Create the Merkle tree from the hashes of each column.
324 let Self::CommitmentState {
325 mat,
326 ext_mat,
327 leaves: col_hashes,
328 } = state;
329 let mut col_hashes: Vec<C::Leaf> =
330 col_hashes.clone().into_iter().map(|h| h.into()).collect(); // TODO cfg_inter
331
332 let col_tree = create_merkle_tree::<C>(
333 &mut col_hashes,
334 ck.leaf_hash_param(),
335 ck.two_to_one_hash_param(),
336 )?;
337
338 // 3. Generate vector `b` to left-multiply the matrix.
339 let (_, b) = L::tensor(point, n_cols, n_rows);
340
341 sponge.absorb(&to_bytes!(&commitment.root).map_err(|_| Error::TranscriptError)?);
342
343 // If we are checking well-formedness, we need to compute the well-formedness proof (which is just r.M) and append it to the transcript.
344 let well_formedness = if ck.check_well_formedness() {
345 let r = sponge.squeeze_field_elements::<F>(n_rows);
346 let v = mat.row_mul(&r);
347
348 sponge.absorb(&v);
349 Some(v)
350 } else {
351 None
352 };
353
354 let point_vec = L::point_to_vec(point.clone());
355 sponge.absorb(&point_vec);
356
357 proof_array.push(LinCodePCProof {

Callers

nothing calls this directly

Calls 9

generate_proofFunction · 0.85
commitmentMethod · 0.80
pushMethod · 0.80
leaf_hash_paramMethod · 0.45
two_to_one_hash_paramMethod · 0.45
check_well_formednessMethod · 0.45
row_mulMethod · 0.45
sec_paramMethod · 0.45
distanceMethod · 0.45

Tested by

no test coverage detected