Expose blst internals (#6829)

This commit is contained in:
Daniel Knopik
2025-02-24 04:39:20 +01:00
committed by GitHub
parent 01df433dfd
commit 60964fc7b5
6 changed files with 101 additions and 6 deletions

View File

@@ -1,4 +1,7 @@
use bls::{FixedBytesExtended, Hash256, INFINITY_SIGNATURE, SECRET_KEY_BYTES_LEN};
use bls::{
FixedBytesExtended, Hash256, INFINITY_SIGNATURE, INFINITY_SIGNATURE_UNCOMPRESSED,
SECRET_KEY_BYTES_LEN,
};
use ssz::{Decode, Encode};
use std::borrow::Cow;
use std::fmt::Debug;
@@ -37,6 +40,18 @@ macro_rules! test_suite {
assert!(AggregateSignature::infinity().is_infinity());
}
#[test]
fn infinity_sig_serializations_match() {
let sig = Signature::deserialize(&INFINITY_SIGNATURE).unwrap();
assert_eq!(
sig.serialize_uncompressed().unwrap(),
INFINITY_SIGNATURE_UNCOMPRESSED
);
let sig =
Signature::deserialize_uncompressed(&INFINITY_SIGNATURE_UNCOMPRESSED).unwrap();
assert_eq!(sig.serialize(), INFINITY_SIGNATURE);
}
#[test]
fn ssz_round_trip_multiple_types() {
let mut agg_sig = AggregateSignature::infinity();