Add payload attestation pool and block packing

Store gossip-verified PayloadAttestationMessages in the operation pool
keyed by PayloadAttestationData. At block production time, aggregate
them into PayloadAttestations using PTC position mapping and include
in the block body. Wire pool insertion into the gossip handler after
fork choice.
This commit is contained in:
Jimmy Chen
2026-04-27 11:32:25 +02:00
parent 6ab48a76f0
commit 1543db8b87
5 changed files with 343 additions and 3 deletions

View File

@@ -61,6 +61,7 @@ use crate::observed_data_sidecars::ObservedDataSidecars;
use crate::observed_operations::{ObservationOutcome, ObservedOperations};
use crate::observed_slashable::ObservedSlashable;
use crate::partial_data_column_assembler::PartialMergeResult;
use crate::payload_attestation_verification::VerifiedPayloadAttestationMessage;
use crate::payload_bid_verification::payload_bid_cache::GossipVerifiedPayloadBidCache;
#[cfg(not(test))]
use crate::payload_envelope_streamer::{EnvelopeRequestSource, launch_payload_envelope_stream};
@@ -2328,6 +2329,17 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
.map_err(Into::into)
}
/// Add a verified payload attestation message to the operation pool for block inclusion.
pub fn add_payload_attestation_to_pool(
&self,
verified: &VerifiedPayloadAttestationMessage<T>,
) -> Result<(), Error> {
self.op_pool
.insert_payload_attestation_message(verified.payload_attestation_message().clone())
.map_err(Error::OpPoolError)?;
Ok(())
}
/// Accepts some `SyncCommitteeMessage` from the network and attempts to verify it, returning `Ok(_)` if
/// it is valid to be (re)broadcast on the gossip network.
pub fn verify_sync_committee_message_for_gossip(

View File

@@ -434,8 +434,10 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
deposits,
voluntary_exits,
sync_aggregate,
// TODO(gloas) need to implement payload attestations
payload_attestations: vec![],
payload_attestations: self
.op_pool
.get_payload_attestations(&state, parent_root, &self.spec)
.map_err(BlockProductionError::OpPoolError)?,
bls_to_execution_changes,
},
state,