mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 18:32:42 +00:00
Data column gossip validation and error handling (#6181)
* Add gossip verification and error handling. * Merge branch 'unstable' into das-gossip-validation * Add inclusion proof verification and some renames for consistency
This commit is contained in:
@@ -6,7 +6,7 @@ use crate::{
|
||||
};
|
||||
use beacon_chain::blob_verification::{GossipBlobError, GossipVerifiedBlob};
|
||||
use beacon_chain::block_verification_types::AsBlock;
|
||||
use beacon_chain::data_column_verification::GossipVerifiedDataColumn;
|
||||
use beacon_chain::data_column_verification::{GossipDataColumnError, GossipVerifiedDataColumn};
|
||||
use beacon_chain::store::Error;
|
||||
use beacon_chain::{
|
||||
attestation_verification::{self, Error as AttnError, VerifiedAttestation},
|
||||
@@ -621,7 +621,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
);
|
||||
match self
|
||||
.chain
|
||||
.verify_data_column_sidecar_for_gossip(column_sidecar, *subnet_id)
|
||||
.verify_data_column_sidecar_for_gossip(column_sidecar.clone(), *subnet_id)
|
||||
{
|
||||
Ok(gossip_verified_data_column) => {
|
||||
metrics::inc_counter(
|
||||
@@ -656,8 +656,82 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
)
|
||||
.await
|
||||
}
|
||||
Err(_) => {
|
||||
// TODO(das) implement gossip error handling
|
||||
Err(err) => {
|
||||
match err {
|
||||
GossipDataColumnError::ParentUnknown { parent_root } => {
|
||||
debug!(
|
||||
self.log,
|
||||
"Unknown parent hash for column";
|
||||
"action" => "requesting parent",
|
||||
"block_root" => %block_root,
|
||||
"parent_root" => %parent_root,
|
||||
);
|
||||
self.send_sync_message(SyncMessage::UnknownParentDataColumn(
|
||||
peer_id,
|
||||
column_sidecar,
|
||||
));
|
||||
}
|
||||
GossipDataColumnError::KzgNotInitialized
|
||||
| GossipDataColumnError::PubkeyCacheTimeout
|
||||
| GossipDataColumnError::BeaconChainError(_) => {
|
||||
crit!(
|
||||
self.log,
|
||||
"Internal error when verifying column sidecar";
|
||||
"error" => ?err,
|
||||
)
|
||||
}
|
||||
GossipDataColumnError::ProposalSignatureInvalid
|
||||
| GossipDataColumnError::UnknownValidator(_)
|
||||
| GossipDataColumnError::ProposerIndexMismatch { .. }
|
||||
| GossipDataColumnError::IsNotLaterThanParent { .. }
|
||||
| GossipDataColumnError::InvalidSubnetId { .. }
|
||||
| GossipDataColumnError::InvalidInclusionProof { .. }
|
||||
| GossipDataColumnError::InvalidKzgProof { .. }
|
||||
| GossipDataColumnError::NotFinalizedDescendant { .. } => {
|
||||
debug!(
|
||||
self.log,
|
||||
"Could not verify column sidecar for gossip. Rejecting the column sidecar";
|
||||
"error" => ?err,
|
||||
"slot" => %slot,
|
||||
"block_root" => %block_root,
|
||||
"index" => %index,
|
||||
);
|
||||
// Prevent recurring behaviour by penalizing the peer slightly.
|
||||
self.gossip_penalize_peer(
|
||||
peer_id,
|
||||
PeerAction::LowToleranceError,
|
||||
"gossip_data_column_low",
|
||||
);
|
||||
self.propagate_validation_result(
|
||||
message_id,
|
||||
peer_id,
|
||||
MessageAcceptance::Reject,
|
||||
);
|
||||
}
|
||||
GossipDataColumnError::FutureSlot { .. }
|
||||
| GossipDataColumnError::PriorKnown { .. }
|
||||
| GossipDataColumnError::PastFinalizedSlot { .. } => {
|
||||
debug!(
|
||||
self.log,
|
||||
"Could not verify column sidecar for gossip. Ignoring the column sidecar";
|
||||
"error" => ?err,
|
||||
"slot" => %slot,
|
||||
"block_root" => %block_root,
|
||||
"index" => %index,
|
||||
);
|
||||
// Prevent recurring behaviour by penalizing the peer slightly.
|
||||
self.gossip_penalize_peer(
|
||||
peer_id,
|
||||
PeerAction::HighToleranceError,
|
||||
"gossip_data_column_high",
|
||||
);
|
||||
self.propagate_validation_result(
|
||||
message_id,
|
||||
peer_id,
|
||||
MessageAcceptance::Ignore,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user