Skip to content

Commit

Permalink
fix: remove extra range proof verifications (#6190)
Browse files Browse the repository at this point in the history
Description
---
Removes extra range proof verifications that are done if batch
verification fails.

Motivation and Context
---
If a batch of range proofs fails verification, each proof is checked
separately until an invalid proof is found; this is reported for
debugging purposes, but is otherwise not used.

This is inefficient and can lead to denial of service.

Until (or unless) #6167 is implemented to provide a more efficient
method of identifying an invalid proof, this PR removes the unused extra
verification operations.

How Has This Been Tested?
---
Existing tests pass.

What process can a PR reviewer use to test or verify this change?
---
Confirm that the existing verification operations were unused (except
for debugging purposes), and that batch verification continues to work
as expected.
  • Loading branch information
AaronFeickert authored Mar 7, 2024
1 parent 820e936 commit 57330bf
Showing 1 changed file with 3 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -547,27 +547,9 @@ pub fn batch_verify_range_proofs(
});
proofs.push(output.proof_result()?.as_vec());
}
if let Err(err_1) = prover.verify_batch(proofs, statements.iter().collect()) {
for output in &bulletproof_plus_proofs {
if let Err(err_2) = output.verify_range_proof(prover) {
return Err(RangeProofError::InvalidRangeProof {
reason: format!(
"commitment {}, minimum_value_promise {}, proof {} ({:?})",
output.commitment.to_hex(),
output.minimum_value_promise,
output.proof_hex_display(false),
err_2,
),
});
}
}
Err(RangeProofError::InvalidRangeProof {
reason: format!(
"Batch verification failed, but individual verification passed - {:?}",
err_1
),
})?
}

// Attempt to verify the range proofs in a batch
prover.verify_batch(proofs, statements.iter().collect())?;
}

let revealed_value_proofs = outputs
Expand Down

0 comments on commit 57330bf

Please sign in to comment.