Gloas gossip boilerplate (#8700)

All the required boilerplate for gloas gossip. We'll include the gossip message processing logic in a separate PR


  


Co-Authored-By: Eitan Seri- Levi <eserilev@gmail.com>

Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
This commit is contained in:
Eitan Seri-Levi
2026-01-27 23:12:48 -08:00
committed by GitHub
parent f7b5c7ee3f
commit b202e98dd9
11 changed files with 532 additions and 12 deletions

View File

@@ -35,9 +35,11 @@ use tracing::{Instrument, Span, debug, error, info, instrument, trace, warn};
use types::{
Attestation, AttestationData, AttestationRef, AttesterSlashing, BlobSidecar, DataColumnSidecar,
DataColumnSubnetId, EthSpec, Hash256, IndexedAttestation, LightClientFinalityUpdate,
LightClientOptimisticUpdate, ProposerSlashing, SignedAggregateAndProof, SignedBeaconBlock,
SignedBlsToExecutionChange, SignedContributionAndProof, SignedVoluntaryExit, SingleAttestation,
Slot, SubnetId, SyncCommitteeMessage, SyncSubnetId, block::BlockImportSource,
LightClientOptimisticUpdate, PayloadAttestationMessage, ProposerSlashing,
SignedAggregateAndProof, SignedBeaconBlock, SignedBlsToExecutionChange,
SignedContributionAndProof, SignedExecutionPayloadBid, SignedExecutionPayloadEnvelope,
SignedProposerPreferences, SignedVoluntaryExit, SingleAttestation, Slot, SubnetId,
SyncCommitteeMessage, SyncSubnetId, block::BlockImportSource,
};
use beacon_processor::work_reprocessing_queue::QueuedColumnReconstruction;
@@ -3221,4 +3223,85 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
write_file(error_path, error.to_string().as_bytes());
}
}
pub async fn process_gossip_execution_payload(
self: &Arc<Self>,
message_id: MessageId,
peer_id: PeerId,
execution_payload: SignedExecutionPayloadEnvelope<T::EthSpec>,
) {
// TODO(EIP-7732): Implement proper execution payload envelope gossip processing.
// This should integrate with the envelope_verification.rs module once it's implemented.
trace!(
%peer_id,
builder_index = execution_payload.message.builder_index,
slot = %execution_payload.message.slot,
beacon_block_root = %execution_payload.message.beacon_block_root,
"Processing execution payload envelope"
);
// For now, ignore all envelopes since verification is not implemented
self.propagate_validation_result(message_id, peer_id, MessageAcceptance::Ignore);
}
pub fn process_gossip_execution_payload_bid(
self: &Arc<Self>,
message_id: MessageId,
peer_id: PeerId,
payload_bid: SignedExecutionPayloadBid,
) {
// TODO(EIP-7732): Implement proper payload bid gossip processing.
// This should integrate with a payload execution bid verification module once it's implemented.
trace!(
%peer_id,
slot = %payload_bid.message.slot,
value = %payload_bid.message.value,
"Processing execution payload bid"
);
// For now, ignore all payload bids since verification is not implemented
self.propagate_validation_result(message_id, peer_id, MessageAcceptance::Ignore);
}
pub fn process_gossip_payload_attestation(
self: &Arc<Self>,
message_id: MessageId,
peer_id: PeerId,
payload_attestation_message: PayloadAttestationMessage,
) {
// TODO(EIP-7732): Implement proper payload attestation message gossip processing.
// This should integrate with a payload_attestation_verification.rs module once it's implemented.
trace!(
%peer_id,
validator_index = payload_attestation_message.validator_index,
slot = %payload_attestation_message.data.slot,
beacon_block_root = %payload_attestation_message.data.beacon_block_root,
"Processing payload attestation message"
);
// For now, ignore all payload attestation messages since verification is not implemented
self.propagate_validation_result(message_id, peer_id, MessageAcceptance::Ignore);
}
pub fn process_gossip_proposer_preferences(
self: &Arc<Self>,
message_id: MessageId,
peer_id: PeerId,
proposer_preferences: SignedProposerPreferences,
) {
// TODO(EIP-7732): Implement proper proposer preferences gossip processing.
trace!(
%peer_id,
validator_index = proposer_preferences.message.validator_index,
slot = %proposer_preferences.message.proposal_slot,
"Processing proposer preferences"
);
// For now, ignore all proposer preferences since verification is not implemented
self.propagate_validation_result(message_id, peer_id, MessageAcceptance::Ignore);
}
}

View File

@@ -423,6 +423,92 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
})
}
/// Create a new `Work` event for some execution payload envelope.
pub fn send_gossip_execution_payload(
self: &Arc<Self>,
message_id: MessageId,
peer_id: PeerId,
execution_payload: Box<SignedExecutionPayloadEnvelope<T::EthSpec>>,
) -> Result<(), Error<T::EthSpec>> {
let processor = self.clone();
let process_fn = async move {
processor
.process_gossip_execution_payload(message_id, peer_id, *execution_payload)
.await
};
self.try_send(BeaconWorkEvent {
drop_during_sync: false,
work: Work::GossipExecutionPayload(Box::pin(process_fn)),
})
}
/// Create a new `Work` event for some execution payload bid
pub fn send_gossip_execution_payload_bid(
self: &Arc<Self>,
message_id: MessageId,
peer_id: PeerId,
execution_payload_bid: Box<SignedExecutionPayloadBid>,
) -> Result<(), Error<T::EthSpec>> {
let processor = self.clone();
let process_fn = move || {
processor.process_gossip_execution_payload_bid(
message_id,
peer_id,
*execution_payload_bid,
)
};
self.try_send(BeaconWorkEvent {
drop_during_sync: true,
work: Work::GossipExecutionPayloadBid(Box::new(process_fn)),
})
}
/// Create a new `Work` event for some payload attestation
pub fn send_gossip_payload_attestation(
self: &Arc<Self>,
message_id: MessageId,
peer_id: PeerId,
payload_attestation_message: Box<PayloadAttestationMessage>,
) -> Result<(), Error<T::EthSpec>> {
let processor = self.clone();
let process_fn = move || {
processor.process_gossip_payload_attestation(
message_id,
peer_id,
*payload_attestation_message,
)
};
self.try_send(BeaconWorkEvent {
drop_during_sync: true,
work: Work::GossipPayloadAttestation(Box::new(process_fn)),
})
}
/// Create a new `Work` event for some proposer preferences
pub fn send_gossip_proposer_preferences(
self: &Arc<Self>,
message_id: MessageId,
peer_id: PeerId,
proposer_preferences: Box<SignedProposerPreferences>,
) -> Result<(), Error<T::EthSpec>> {
let processor = self.clone();
let process_fn = move || {
processor.process_gossip_proposer_preferences(
message_id,
peer_id,
*proposer_preferences,
)
};
self.try_send(BeaconWorkEvent {
drop_during_sync: false,
work: Work::GossipProposerPreferences(Box::new(process_fn)),
})
}
/// Create a new `Work` event for some block, where the result from computation (if any) is
/// sent to the other side of `result_tx`.
pub fn send_rpc_beacon_block(

View File

@@ -486,6 +486,49 @@ impl<T: BeaconChainTypes> Router<T> {
bls_to_execution_change,
),
),
PubsubMessage::ExecutionPayload(signed_execution_payload_envelope) => {
trace!(%peer_id, "Received a signed execution payload envelope");
self.handle_beacon_processor_send_result(
self.network_beacon_processor.send_gossip_execution_payload(
message_id,
peer_id,
signed_execution_payload_envelope,
),
)
}
PubsubMessage::PayloadAttestation(payload_attestation_message) => {
trace!(%peer_id, "Received a payload attestation message");
self.handle_beacon_processor_send_result(
self.network_beacon_processor
.send_gossip_payload_attestation(
message_id,
peer_id,
payload_attestation_message,
),
)
}
PubsubMessage::ExecutionPayloadBid(execution_payload_bid) => {
trace!(%peer_id, "Received a signed execution payload bid");
self.handle_beacon_processor_send_result(
self.network_beacon_processor
.send_gossip_execution_payload_bid(
message_id,
peer_id,
execution_payload_bid,
),
)
}
PubsubMessage::ProposerPreferences(proposer_preferences) => {
trace!(%peer_id, "Received signed proposer preferences");
self.handle_beacon_processor_send_result(
self.network_beacon_processor
.send_gossip_proposer_preferences(
message_id,
peer_id,
proposer_preferences,
),
)
}
}
}