feat: add range proof batch verification blame #224
+141
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It may be the case that verification of a batch of range proofs fails. When this happens, the verifier does not know which proofs in the batch are invalid.
The best approach to take depends on the use case.
If you only need to know the index of any invalid proof in the batch, a linear scan is inefficient. In this case, performing a binary search on the batch is more efficient since it requires only a logarithmic number of verifications.
On the other hand, if you need to know the index of all invalid proofs in the batch, and if this number may be large, a complete linear search is more efficient than repeated binary searches.
This PR adds both approaches via the
ExtendedRangeProofService
trait. The newverify_batch_with_first_blame
function performs a binary search if batch verification fails, returning an error containing the index of the first invalid proof. The newverify_batch_with_all_blame
function performs a complete linear search if batch verification fails, returning an error containing the indexes of all failed proofs.