Attestation superstruct changes for EIP 7549 (#5644)

* update

* experiment

* superstruct changes

* revert

* superstruct changes

* fix tests

* indexed attestation

* indexed attestation superstruct

* updated TODOs
This commit is contained in:
Eitan Seri-Levi
2024-04-30 19:49:08 +03:00
committed by GitHub
parent 4a48d7b546
commit 3b7132bc0d
56 changed files with 943 additions and 429 deletions

View File

@@ -72,7 +72,7 @@ impl<T: BeaconChainTypes> VerifiedAttestation<T> for VerifiedUnaggregate<T> {
fn into_attestation_and_indices(self) -> (Attestation<T::EthSpec>, Vec<u64>) {
let attestation = *self.attestation;
let attesting_indices = self.indexed_attestation.attesting_indices.into();
let attesting_indices = self.indexed_attestation.attesting_indices_to_vec();
(attestation, attesting_indices)
}
}
@@ -106,7 +106,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>) {
let attestation = self.signed_aggregate.message.aggregate;
let attesting_indices = self.indexed_attestation.attesting_indices.into();
let attesting_indices = self.indexed_attestation.attesting_indices_to_vec();
(attestation, attesting_indices)
}
}
@@ -133,7 +133,7 @@ enum FailedAtt<E: EthSpec> {
impl<E: EthSpec> FailedAtt<E> {
pub fn beacon_block_root(&self) -> &Hash256 {
&self.attestation().data.beacon_block_root
&self.attestation().data().beacon_block_root
}
pub fn kind(&self) -> &'static str {
@@ -309,7 +309,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
match result {
Ok(verified_attestation) => {
let indexed_attestation = &verified_attestation.indexed_attestation;
let beacon_block_root = indexed_attestation.data.beacon_block_root;
let beacon_block_root = indexed_attestation.data().beacon_block_root;
// Register the attestation with any monitored validators.
self.chain
@@ -412,7 +412,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
reprocess_tx: Option<mpsc::Sender<ReprocessQueueMessage>>,
seen_timestamp: Duration,
) {
let beacon_block_root = aggregate.message.aggregate.data.beacon_block_root;
let beacon_block_root = aggregate.message.aggregate.data().beacon_block_root;
let result = match self
.chain
@@ -2282,7 +2282,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
self.log,
"Ignored attestation to finalized block";
"block_root" => ?beacon_block_root,
"attestation_slot" => failed_att.attestation().data.slot,
"attestation_slot" => failed_att.attestation().data().slot,
);
self.propagate_validation_result(message_id, peer_id, MessageAcceptance::Ignore);
@@ -2305,9 +2305,9 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
debug!(
self.log,
"Dropping attestation";
"target_root" => ?failed_att.attestation().data.target.root,
"target_root" => ?failed_att.attestation().data().target.root,
"beacon_block_root" => ?beacon_block_root,
"slot" => ?failed_att.attestation().data.slot,
"slot" => ?failed_att.attestation().data().slot,
"type" => ?attestation_type,
"error" => ?e,
"peer_id" => % peer_id
@@ -2326,7 +2326,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
self.log,
"Unable to validate attestation";
"beacon_block_root" => ?beacon_block_root,
"slot" => ?failed_att.attestation().data.slot,
"slot" => ?failed_att.attestation().data().slot,
"type" => ?attestation_type,
"peer_id" => %peer_id,
"error" => ?e,

View File

@@ -144,7 +144,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
processor.process_gossip_aggregate_batch(aggregates, Some(reprocess_tx))
};
let beacon_block_root = aggregate.message.aggregate.data.beacon_block_root;
let beacon_block_root = aggregate.message.aggregate.data().beacon_block_root;
self.try_send(BeaconWorkEvent {
drop_during_sync: true,
work: Work::GossipAggregate {

View File

@@ -389,7 +389,7 @@ impl<T: BeaconChainTypes> AttestationService<T> {
.map(|tracked_vals| {
tracked_vals.contains_key(&ExactSubnet {
subnet_id: subnet,
slot: attestation.data.slot,
slot: attestation.data().slot,
})
})
.unwrap_or(true)