Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add range proof batch verification blame #224

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AaronFeickert
Copy link
Contributor

@AaronFeickert AaronFeickert commented Feb 24, 2024

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 new verify_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 new verify_batch_with_all_blame function performs a complete linear search if batch verification fails, returning an error containing the indexes of all failed proofs.

@AaronFeickert
Copy link
Contributor Author

This still needs tests.

@AaronFeickert
Copy link
Contributor Author

It was suggested that the Bulletproofs+ library would be a better place for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants