diff --git a/eth2/utils/bls/src/aggregate_public_key.rs b/eth2/utils/bls/src/aggregate_public_key.rs index d36477d760..2980462486 100644 --- a/eth2/utils/bls/src/aggregate_public_key.rs +++ b/eth2/utils/bls/src/aggregate_public_key.rs @@ -1,5 +1,6 @@ use super::PublicKey; use milagro_bls::AggregatePublicKey as RawAggregatePublicKey; +use serde_hex::encode as hex_encode; /// A BLS aggregate public key. /// @@ -21,4 +22,10 @@ impl AggregatePublicKey { pub fn as_raw(&self) -> &RawAggregatePublicKey { &self.0 } + + /// Return a hex string representation of this key's bytes. + #[cfg(test)] + pub fn as_hex_string(&self) -> String { + hex_encode(self.as_raw().as_bytes()) + } } diff --git a/eth2/utils/bls/src/aggregate_signature.rs b/eth2/utils/bls/src/aggregate_signature.rs index cf7ce78c26..f434feb0d7 100644 --- a/eth2/utils/bls/src/aggregate_signature.rs +++ b/eth2/utils/bls/src/aggregate_signature.rs @@ -129,6 +129,12 @@ impl AggregateSignature { is_empty: true, } } + + /// Return a hex string representation of the bytes of this signature. + #[cfg(test)] + pub fn as_hex_string(&self) -> String { + hex_encode(self.as_bytes()) + } } impl_ssz!(