mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 18:04:18 +00:00
There was a discrepancy between the is_empty fields of fake signatures during testing, so I've added a small hack to set the is_empty field of a fake signature based on the byte content. Alternatively, we could just make it so that any fake signature is defined to be equal to any other.
36 lines
772 B
Rust
36 lines
772 B
Rust
use super::{PublicKey, BLS_PUBLIC_KEY_BYTE_SIZE};
|
|
|
|
/// A BLS aggregate public key.
|
|
///
|
|
/// This struct is a wrapper upon a base type and provides helper functions (e.g., SSZ
|
|
/// serialization).
|
|
#[derive(Debug, Clone, Default)]
|
|
pub struct FakeAggregatePublicKey {
|
|
bytes: Vec<u8>,
|
|
}
|
|
|
|
impl FakeAggregatePublicKey {
|
|
pub fn new() -> Self {
|
|
Self::zero()
|
|
}
|
|
|
|
/// Creates a new all-zero's aggregate public key
|
|
pub fn zero() -> Self {
|
|
Self {
|
|
bytes: vec![0; BLS_PUBLIC_KEY_BYTE_SIZE],
|
|
}
|
|
}
|
|
|
|
pub fn add(&mut self, _public_key: &PublicKey) {
|
|
// No nothing.
|
|
}
|
|
|
|
pub fn as_raw(&self) -> &FakeAggregatePublicKey {
|
|
&self
|
|
}
|
|
|
|
pub fn as_bytes(&self) -> Vec<u8> {
|
|
self.bytes.clone()
|
|
}
|
|
}
|