Update spec tests to v1.1.0-beta.4 (#2548)

## Proposed Changes

Bump the spec tests to beta.4, including the new randomised tests (which all pass 🎉)
This commit is contained in:
Michael Sproul
2021-09-25 05:58:35 +00:00
parent 00a7ef0036
commit a844ce5ba9
22 changed files with 231 additions and 36 deletions

View File

@@ -1,4 +1,8 @@
use crate::{generic_public_key::GenericPublicKey, Error};
use crate::{
generic_public_key::{GenericPublicKey, TPublicKey},
Error,
};
use std::fmt::{self, Debug};
use std::marker::PhantomData;
/// Implemented on some struct from a BLS library so it may be used internally in this crate.
@@ -35,3 +39,13 @@ where
})
}
}
impl<Pub, AggPub> Debug for GenericAggregatePublicKey<Pub, AggPub>
where
AggPub: TAggregatePublicKey<Pub>,
Pub: TPublicKey,
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{:?}", self.to_public_key())
}
}

View File

@@ -194,6 +194,20 @@ where
}
}
/// Wrapper for `fast_aggregate_verify` accepting `G2_POINT_AT_INFINITY` signature when
/// `pubkeys` is empty.
pub fn eth_fast_aggregate_verify(
&self,
msg: Hash256,
pubkeys: &[&GenericPublicKey<Pub>],
) -> bool {
if pubkeys.is_empty() && self.is_infinity() {
true
} else {
self.fast_aggregate_verify(msg, pubkeys)
}
}
/// Verify that `self` represents an aggregate signature where all `pubkeys` have signed their
/// corresponding message in `msgs`.
///