Resolve into_attestation_and_indices todo

This commit is contained in:
dapplion
2024-06-18 22:16:37 +02:00
parent 4d3edfeaed
commit 7fce143300
2 changed files with 9 additions and 6 deletions

View File

@@ -105,12 +105,7 @@ impl<T: BeaconChainTypes> VerifiedAttestation<T> for VerifiedAggregate<T> {
/// Efficient clone-free implementation that moves out of the `Box`.
fn into_attestation_and_indices(self) -> (Attestation<T::EthSpec>, Vec<u64>) {
// TODO(electra): technically we shouldn't have to clone..
let attestation = self
.signed_aggregate
.message()
.aggregate()
.clone_as_attestation();
let attestation = self.signed_aggregate.into_attestation();
let attesting_indices = self.indexed_attestation.attesting_indices_to_vec();
(attestation, attesting_indices)
}

View File

@@ -6,6 +6,7 @@ use super::{
Signature, SignedRoot,
};
use crate::test_utils::TestRandom;
use crate::Attestation;
use serde::{Deserialize, Serialize};
use ssz_derive::{Decode, Encode};
use superstruct::superstruct;
@@ -109,4 +110,11 @@ impl<E: EthSpec> SignedAggregateAndProof<E> {
}
}
}
pub fn into_attestation(self) -> Attestation<E> {
match self {
Self::Base(att) => Attestation::Base(att.message.aggregate),
Self::Electra(att) => Attestation::Electra(att.message.aggregate),
}
}
}