Remove potentially-failing unchecked arithmetic operations for ones which error

In response to 9.13.3.

Requires a bump to Rust 1.82 to take advantage of `Option::is_none_or`.
This commit is contained in:
Luke Parker
2025-08-08 22:30:34 -04:00
parent cbab9486c6
commit 188fcc3cb4
13 changed files with 65 additions and 18 deletions

View File

@@ -23,6 +23,11 @@ pub(crate) struct InternalBatchVerifier {
impl InternalBatchVerifier {
#[must_use]
fn verify(self, G: EdwardsPoint, H: EdwardsPoint, generators: &Generators) -> bool {
/*
Technically, this following line can overflow, and joining these `Vec`s _may_ panic if
they're individually acceptable lengths yet their sum isn't. This is so negligible, due to
the amount of memory required, it's dismissed.
*/
let capacity = 2 + self.g_bold.len() + self.h_bold.len() + self.other.len();
let mut scalars = Vec::with_capacity(capacity);
let mut points = Vec::with_capacity(capacity);