Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions poly-commit/src/linear_codes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,27 @@ where
let two_to_one_hash_param: &<<C as Config>::TwoToOneHash as TwoToOneCRHScheme>::Parameters =
vk.two_to_one_hash_param();

// We need to collect so that we can both check the lengths and iterate.
let commitments: Vec<&LabeledCommitment<Self::Commitment>> =
commitments.into_iter().collect();
let values: Vec<F> = values.into_iter().collect();

if commitments.len() != proof_array.len() {
return Err(Error::IncorrectInputLength(format!(
"commitments {}, but proof_array has length {}",
commitments.len(),
proof_array.len()
)));
}

if commitments.len() != values.len() {
return Err(Error::IncorrectInputLength(format!(
"commitments {}, but values has length {}",
commitments.len(),
values.len()
)));
}

for (i, (labeled_commitment, value)) in commitments.into_iter().zip(values).enumerate() {
let proof = &proof_array[i];
let commitment = labeled_commitment.commitment();
Expand Down