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: batch verification with blame #66

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

AaronFeickert
Copy link
Collaborator

@AaronFeickert AaronFeickert commented Feb 25, 2024

When batch verification fails, it may be useful to know which proofs are invalid. Unfortunately, Proof::verify_batch cannot identify this.

The optimal method for this depends on the caller's needs. If the caller only needs to identify one invalid proof in a failed batch, it's more efficient to use a binary search to identify it. But if the caller needs to identify all invalid proofs, we need to check them all individually.

This PR adds both of these. The new Proof::verify_batch_with_single_blame uses a binary search on batch failure, and returns an error containing the index of an invalid proof. The new Proof::verify_batch_with_all_blame iteratively checks all proofs on batch failure, and returns an error containing the indexes of all invalid proofs.

BREAKING CHANGE: Empty batches are now considered valid by definition.

@AaronFeickert AaronFeickert marked this pull request as draft February 25, 2024 17:24
@AaronFeickert AaronFeickert marked this pull request as ready for review March 4, 2024 21:29
@AaronFeickert AaronFeickert merged commit a86158f into tari-project:main Mar 4, 2024
6 checks passed
@AaronFeickert AaronFeickert deleted the blame branch March 4, 2024 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant