mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 01:05:47 +00:00
Gloas: envelope peer penalties and REJECT/IGNORE mapping (#8981)
Closes #8949 Implements peer penalties and REJECT/IGNORE message propagation for `SignedExecutionPayloadEnvelope` gossip handling, completing follow-up work from #8806. Feedback on the error classification would be appreciated. ### Key Implementation Details - Maps all 15 `EnvelopeError` variants to REJECT/IGNORE based on [Gloas p2p spec](https://github.com/ethereum/consensus-specs/blob/master/specs/gloas/p2p-interface.md#execution_payload) - Follows `ExecutionPayloadError` handling pattern from block gossip (`penalize_peer()` method) - Uses explicit variant matching (rather than catch-all `_`) for type safety - Applies `LowToleranceError` penalty for protocol violations (invalid signatures, mismatches, etc.) - Ignores without penalty for spec-defined cases (unknown block root, prior to finalization) and internal errors Co-Authored-By: 0u-Y <yyw1000@naver.com> Co-Authored-By: Eitan Seri-Levi <eserilev@gmail.com>
This commit is contained in:
@@ -3337,63 +3337,112 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
|||||||
|
|
||||||
verified_envelope
|
verified_envelope
|
||||||
}
|
}
|
||||||
|
Err(e) => {
|
||||||
|
match e {
|
||||||
|
EnvelopeError::ExecutionPayloadError(ref epe) if !epe.penalize_peer() => {
|
||||||
|
self.propagate_validation_result(
|
||||||
|
message_id,
|
||||||
|
peer_id,
|
||||||
|
MessageAcceptance::Ignore,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Err(EnvelopeError::BlockRootUnknown { block_root }) => {
|
EnvelopeError::BadSignature
|
||||||
let envelope_slot = envelope.slot();
|
| EnvelopeError::BuilderIndexMismatch { .. }
|
||||||
|
| EnvelopeError::SlotMismatch { .. }
|
||||||
|
| EnvelopeError::BlockHashMismatch { .. }
|
||||||
|
| EnvelopeError::UnknownValidator { .. }
|
||||||
|
| EnvelopeError::IncorrectBlockProposer { .. }
|
||||||
|
| EnvelopeError::ExecutionPayloadError(_)
|
||||||
|
| EnvelopeError::EnvelopeProcessingError(_)
|
||||||
|
| EnvelopeError::BlockError(_) => {
|
||||||
|
self.propagate_validation_result(
|
||||||
|
message_id,
|
||||||
|
peer_id,
|
||||||
|
MessageAcceptance::Reject,
|
||||||
|
);
|
||||||
|
self.gossip_penalize_peer(
|
||||||
|
peer_id,
|
||||||
|
PeerAction::LowToleranceError,
|
||||||
|
"gossip_envelope_low",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
debug!(
|
EnvelopeError::BlockRootUnknown { block_root } => {
|
||||||
?block_root,
|
let envelope_slot = envelope.slot();
|
||||||
%envelope_slot,
|
|
||||||
"Envelope references unknown block, deferring to reprocess queue"
|
|
||||||
);
|
|
||||||
|
|
||||||
self.propagate_validation_result(message_id, peer_id, MessageAcceptance::Ignore);
|
debug!(
|
||||||
|
?block_root,
|
||||||
|
%envelope_slot,
|
||||||
|
"Envelope references unknown block, deferring to reprocess queue"
|
||||||
|
);
|
||||||
|
|
||||||
let inner_self = self.clone();
|
self.propagate_validation_result(
|
||||||
let chain = self.chain.clone();
|
message_id.clone(),
|
||||||
let process_fn = Box::pin(async move {
|
peer_id,
|
||||||
match chain.verify_envelope_for_gossip(envelope).await {
|
MessageAcceptance::Ignore,
|
||||||
Ok(verified_envelope) => {
|
);
|
||||||
inner_self
|
|
||||||
.process_gossip_verified_execution_payload_envelope(
|
let inner_self = self.clone();
|
||||||
peer_id,
|
let chain = self.chain.clone();
|
||||||
verified_envelope,
|
let process_fn = Box::pin(async move {
|
||||||
)
|
match chain.verify_envelope_for_gossip(envelope).await {
|
||||||
.await;
|
Ok(verified_envelope) => {
|
||||||
}
|
inner_self
|
||||||
Err(e) => {
|
.process_gossip_verified_execution_payload_envelope(
|
||||||
debug!(
|
peer_id,
|
||||||
error = ?e,
|
verified_envelope,
|
||||||
"Deferred envelope failed verification"
|
)
|
||||||
|
.await;
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
debug!(
|
||||||
|
error = ?e,
|
||||||
|
"Deferred envelope failed verification"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if self
|
||||||
|
.beacon_processor_send
|
||||||
|
.try_send(WorkEvent {
|
||||||
|
drop_during_sync: false,
|
||||||
|
work: Work::Reprocess(
|
||||||
|
ReprocessQueueMessage::UnknownBlockForEnvelope(
|
||||||
|
QueuedGossipEnvelope {
|
||||||
|
beacon_block_slot: envelope_slot,
|
||||||
|
beacon_block_root: block_root,
|
||||||
|
process_fn,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
})
|
||||||
|
.is_err()
|
||||||
|
{
|
||||||
|
error!(
|
||||||
|
%envelope_slot,
|
||||||
|
?block_root,
|
||||||
|
"Failed to defer envelope import"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
if self
|
EnvelopeError::PriorToFinalization { .. }
|
||||||
.beacon_processor_send
|
| EnvelopeError::OptimisticSyncNotSupported { .. }
|
||||||
.try_send(WorkEvent {
|
| EnvelopeError::BeaconChainError(_)
|
||||||
drop_during_sync: false,
|
| EnvelopeError::BeaconStateError(_)
|
||||||
work: Work::Reprocess(ReprocessQueueMessage::UnknownBlockForEnvelope(
|
| EnvelopeError::BlockProcessingError(_)
|
||||||
QueuedGossipEnvelope {
|
| EnvelopeError::InternalError(_) => {
|
||||||
beacon_block_slot: envelope_slot,
|
self.propagate_validation_result(
|
||||||
beacon_block_root: block_root,
|
message_id,
|
||||||
process_fn,
|
peer_id,
|
||||||
},
|
MessageAcceptance::Ignore,
|
||||||
)),
|
);
|
||||||
})
|
}
|
||||||
.is_err()
|
|
||||||
{
|
|
||||||
error!(
|
|
||||||
%envelope_slot,
|
|
||||||
?block_root,
|
|
||||||
"Failed to defer envelope import"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
// TODO(gloas) penalize peers accordingly
|
|
||||||
Err(_) => return None,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let envelope_slot = verified_envelope.signed_envelope.slot();
|
let envelope_slot = verified_envelope.signed_envelope.slot();
|
||||||
@@ -3441,7 +3490,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
|||||||
|
|
||||||
async fn process_gossip_verified_execution_payload_envelope(
|
async fn process_gossip_verified_execution_payload_envelope(
|
||||||
self: Arc<Self>,
|
self: Arc<Self>,
|
||||||
_peer_id: PeerId,
|
peer_id: PeerId,
|
||||||
verified_envelope: GossipVerifiedEnvelope<T>,
|
verified_envelope: GossipVerifiedEnvelope<T>,
|
||||||
) {
|
) {
|
||||||
let _processing_start_time = Instant::now();
|
let _processing_start_time = Instant::now();
|
||||||
@@ -3467,9 +3516,39 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
|||||||
| Ok(AvailabilityProcessingStatus::MissingComponents(_, _)) => {
|
| Ok(AvailabilityProcessingStatus::MissingComponents(_, _)) => {
|
||||||
// Nothing to do
|
// Nothing to do
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(e) => match e {
|
||||||
// TODO(gloas) implement peer penalties
|
EnvelopeError::ExecutionPayloadError(epe) if !epe.penalize_peer() => {}
|
||||||
}
|
EnvelopeError::BadSignature
|
||||||
|
| EnvelopeError::BuilderIndexMismatch { .. }
|
||||||
|
| EnvelopeError::SlotMismatch { .. }
|
||||||
|
| EnvelopeError::BlockHashMismatch { .. }
|
||||||
|
| EnvelopeError::UnknownValidator { .. }
|
||||||
|
| EnvelopeError::IncorrectBlockProposer { .. }
|
||||||
|
| EnvelopeError::ExecutionPayloadError(_) => {
|
||||||
|
self.gossip_penalize_peer(
|
||||||
|
peer_id,
|
||||||
|
PeerAction::LowToleranceError,
|
||||||
|
"gossip_envelope_processing_low",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
EnvelopeError::EnvelopeProcessingError(_)
|
||||||
|
| EnvelopeError::BlockError(_)
|
||||||
|
| EnvelopeError::BlockRootUnknown { .. } => {
|
||||||
|
self.gossip_penalize_peer(
|
||||||
|
peer_id,
|
||||||
|
PeerAction::LowToleranceError,
|
||||||
|
"gossip_envelope_processing_error",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
EnvelopeError::PriorToFinalization { .. }
|
||||||
|
| EnvelopeError::OptimisticSyncNotSupported { .. }
|
||||||
|
| EnvelopeError::BeaconChainError(_)
|
||||||
|
| EnvelopeError::BeaconStateError(_)
|
||||||
|
| EnvelopeError::BlockProcessingError(_)
|
||||||
|
| EnvelopeError::InternalError(_) => {}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user