mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-22 14:24:44 +00:00
Add DataColumnSidecar gossip topic and message handling (#6147)
* Add `DataColumnSidecar` gossip topic and verification (#5050 and #5783). * Remove gossip verification changes (#5783). * Merge branch 'unstable' into data-column-gossip # Conflicts: # beacon_node/beacon_chain/src/data_column_verification.rs # beacon_node/beacon_chain/src/lib.rs * Add gossip cache timeout for data columns. Rename data column metrics for consistency. * Remove usage of `unimplemented!` and address review comments. * Remove unnused `GossipDataColumnError` variants and address review comments. * Merge branch 'unstable' into data-column-gossip * Update Cargo.lock * Arc `ChainSpec` in discovery to avoid performance regression when needing to clone it repeatedly.
This commit is contained in:
@@ -54,6 +54,7 @@ use crate::block_verification_types::{
|
||||
AsBlock, BlockContentsError, BlockImportData, GossipVerifiedBlockContents, RpcBlock,
|
||||
};
|
||||
use crate::data_availability_checker::{AvailabilityCheckError, MaybeAvailableBlock};
|
||||
use crate::data_column_verification::GossipDataColumnError;
|
||||
use crate::eth1_finalization_cache::Eth1FinalizationData;
|
||||
use crate::execution_payload::{
|
||||
is_optimistic_candidate_block, validate_execution_payload_for_gossip, validate_merge_block,
|
||||
@@ -303,6 +304,13 @@ pub enum BlockError<E: EthSpec> {
|
||||
/// TODO: We may need to penalize the peer that gave us a potentially invalid rpc blob.
|
||||
/// https://github.com/sigp/lighthouse/issues/4546
|
||||
AvailabilityCheck(AvailabilityCheckError),
|
||||
/// An internal error has occurred when processing the block or sidecars.
|
||||
///
|
||||
/// ## Peer scoring
|
||||
///
|
||||
/// We were unable to process this block due to an internal error. It's unclear if the block is
|
||||
/// valid.
|
||||
InternalError(String),
|
||||
}
|
||||
|
||||
impl<E: EthSpec> From<AvailabilityCheckError> for BlockError<E> {
|
||||
@@ -523,6 +531,20 @@ impl<E: EthSpec> BlockSlashInfo<GossipBlobError<E>> {
|
||||
}
|
||||
}
|
||||
|
||||
impl BlockSlashInfo<GossipDataColumnError> {
|
||||
pub fn from_early_error_data_column(
|
||||
header: SignedBeaconBlockHeader,
|
||||
e: GossipDataColumnError,
|
||||
) -> Self {
|
||||
match e {
|
||||
GossipDataColumnError::ProposalSignatureInvalid => BlockSlashInfo::SignatureInvalid(e),
|
||||
// `InvalidSignature` could indicate any signature in the block, so we want
|
||||
// to recheck the proposer signature alone.
|
||||
_ => BlockSlashInfo::SignatureNotChecked(header, e),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Process invalid blocks to see if they are suitable for the slasher.
|
||||
///
|
||||
/// If no slasher is configured, this is a no-op.
|
||||
@@ -2007,6 +2029,23 @@ impl<E: EthSpec> BlockBlobError for GossipBlobError<E> {
|
||||
}
|
||||
}
|
||||
|
||||
impl BlockBlobError for GossipDataColumnError {
|
||||
fn not_later_than_parent_error(data_column_slot: Slot, parent_slot: Slot) -> Self {
|
||||
GossipDataColumnError::IsNotLaterThanParent {
|
||||
data_column_slot,
|
||||
parent_slot,
|
||||
}
|
||||
}
|
||||
|
||||
fn unknown_validator_error(validator_index: u64) -> Self {
|
||||
GossipDataColumnError::UnknownValidator(validator_index)
|
||||
}
|
||||
|
||||
fn proposer_signature_invalid() -> Self {
|
||||
GossipDataColumnError::ProposalSignatureInvalid
|
||||
}
|
||||
}
|
||||
|
||||
/// Performs a cheap (time-efficient) state advancement so the committees and proposer shuffling for
|
||||
/// `slot` can be obtained from `state`.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user