diff --git a/eth2/types/src/attestation.rs b/eth2/types/src/attestation.rs index 7938ae6574..afffc2e2fd 100644 --- a/eth2/types/src/attestation.rs +++ b/eth2/types/src/attestation.rs @@ -1,6 +1,6 @@ -use super::{AttestationData, Bitfield, Hash256}; +use super::{AggregatePublicKey, AggregateSignature, AttestationData, Bitfield, Hash256}; use crate::test_utils::TestRandom; -use bls::AggregateSignature; +use bls::bls_verify_aggregate; use rand::RngCore; use serde_derive::Serialize; use ssz::{hash, Decodable, DecodeError, Encodable, SszStream, TreeHash}; @@ -21,6 +21,17 @@ impl Attestation { pub fn signable_message(&self, custody_bit: bool) -> Vec { self.data.signable_message(custody_bit) } + + pub fn verify_signature( + &self, + group_public_key: &AggregatePublicKey, + custody_bit: bool, + // TODO: use domain. + _domain: u64, + ) -> bool { + self.aggregate_signature + .verify(&self.signable_message(custody_bit), group_public_key) + } } impl Encodable for Attestation {