Implement a binary search for BatchVerifier blame

Adds helper functions to verify and, on failure, blame, which move an 
unwrap from callers into multiexp where it's guaranteed to be safe and 
easily verified to be proper.

Closes https://github.com/serai-dex/serai/issues/10.
This commit is contained in:
Luke Parker
2022-05-27 02:01:01 -04:00
parent c90e957e6a
commit 469ce9106b
4 changed files with 51 additions and 32 deletions

View File

@@ -225,10 +225,7 @@ fn complete_r2<R: RngCore + CryptoRng, C: Curve>(
batch.queue(rng, *l, values);
}
if !batch.verify() {
Err(FrostError::InvalidCommitment(batch.blame_vartime().unwrap()))?;
}
batch.verify_with_vartime_blame().map_err(|l| FrostError::InvalidCommitment(l))?;
// TODO: Clear the original share