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

Function generate_proof

poly-commit/src/linear_codes/mod.rs:523–566  ·  view source on GitHub ↗
(
    sec_param: usize,
    distance: (usize, usize),
    b: &[F],
    mat: &Matrix<F>,
    ext_mat: &Matrix<F>,
    col_tree: &MerkleTree<C>,
    sponge: &mut S,
)

Source from the content-addressed store, hash-verified

521}
522
523fn generate_proof<F, C, S>(
524 sec_param: usize,
525 distance: (usize, usize),
526 b: &[F],
527 mat: &Matrix<F>,
528 ext_mat: &Matrix<F>,
529 col_tree: &MerkleTree<C>,
530 sponge: &mut S,
531) -> Result<LinCodePCProofSingle<F, C>, Error>
532where
533 F: PrimeField + Absorb,
534 C: Config,
535 S: CryptographicSponge,
536{
537 let t = calculate_t::<F>(sec_param, distance, ext_mat.m)?;
538
539 // 1. left-multiply the matrix by `b`.
540 let v = mat.row_mul(b);
541 sponge.absorb(&v);
542
543 // 2. Generate t column indices to test the linear combination on.
544 let indices = get_indices_from_sponge(ext_mat.m, t, sponge)?;
545
546 // 3. Compute Merkle tree paths for the requested columns.
547 let mut queried_columns = Vec::with_capacity(t);
548 let mut paths = Vec::with_capacity(t);
549
550 let ext_mat_cols = ext_mat.cols();
551
552 for i in indices {
553 queried_columns.push(ext_mat_cols[i].clone());
554 paths.push(
555 col_tree
556 .generate_proof(i)
557 .map_err(|_| Error::TranscriptError)?,
558 );
559 }
560
561 Ok(LinCodePCProofSingle {
562 paths,
563 v,
564 columns: queried_columns,
565 })
566}

Callers 1

openMethod · 0.85

Calls 4

get_indices_from_spongeFunction · 0.85
colsMethod · 0.80
pushMethod · 0.80
row_mulMethod · 0.45

Tested by

no test coverage detected