diff --git a/eth2/utils/bls/src/fake_aggregate_public_key.rs b/eth2/utils/bls/src/fake_aggregate_public_key.rs index 9ac6073114..65774b7c68 100644 --- a/eth2/utils/bls/src/fake_aggregate_public_key.rs +++ b/eth2/utils/bls/src/fake_aggregate_public_key.rs @@ -1,5 +1,4 @@ use super::{PublicKey, BLS_PUBLIC_KEY_BYTE_SIZE}; -use milagro_bls::AggregatePublicKey as RawAggregatePublicKey; /// A BLS aggregate public key. /// diff --git a/eth2/utils/bls/src/fake_public_key.rs b/eth2/utils/bls/src/fake_public_key.rs index d8a1b1be5a..617363d12e 100644 --- a/eth2/utils/bls/src/fake_public_key.rs +++ b/eth2/utils/bls/src/fake_public_key.rs @@ -1,6 +1,5 @@ use super::{SecretKey, BLS_PUBLIC_KEY_BYTE_SIZE}; use cached_tree_hash::cached_tree_hash_ssz_encoding_as_vector; -use milagro_bls::PublicKey as RawPublicKey; use serde::de::{Deserialize, Deserializer}; use serde::ser::{Serialize, Serializer}; use serde_hex::{encode as hex_encode, HexVisitor}; diff --git a/eth2/utils/bls/src/fake_signature.rs b/eth2/utils/bls/src/fake_signature.rs index de16a05f38..ebe4e997ea 100644 --- a/eth2/utils/bls/src/fake_signature.rs +++ b/eth2/utils/bls/src/fake_signature.rs @@ -59,9 +59,10 @@ impl FakeSignature { expected: BLS_SIG_BYTE_SIZE, }) } else { + let is_empty = bytes.iter().all(|x| *x == 0); Ok(Self { bytes: bytes.to_vec(), - is_empty: false, + is_empty, }) } } diff --git a/eth2/utils/bls/src/signature.rs b/eth2/utils/bls/src/signature.rs index 5009d060c2..257254ebaa 100644 --- a/eth2/utils/bls/src/signature.rs +++ b/eth2/utils/bls/src/signature.rs @@ -101,6 +101,12 @@ impl Signature { pub fn is_empty(&self) -> bool { self.is_empty } + + /// Display a signature as a hex string of its bytes. + #[cfg(test)] + pub fn as_hex_string(&self) -> String { + hex_encode(self.as_bytes()) + } } impl_ssz!(Signature, BLS_SIG_BYTE_SIZE, "Signature");