mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 01:05:47 +00:00
fix some todos
This commit is contained in:
@@ -23,7 +23,6 @@ use types::{
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum AvailabilityCheckError {
|
pub enum AvailabilityCheckError {
|
||||||
DuplicateBlob(Hash256),
|
|
||||||
Kzg(KzgError),
|
Kzg(KzgError),
|
||||||
KzgVerificationFailed,
|
KzgVerificationFailed,
|
||||||
KzgNotInitialized,
|
KzgNotInitialized,
|
||||||
@@ -37,7 +36,6 @@ pub enum AvailabilityCheckError {
|
|||||||
KzgCommitmentMismatch {
|
KzgCommitmentMismatch {
|
||||||
blob_index: u64,
|
blob_index: u64,
|
||||||
},
|
},
|
||||||
Pending,
|
|
||||||
IncorrectFork,
|
IncorrectFork,
|
||||||
BlockBlobRootMismatch {
|
BlockBlobRootMismatch {
|
||||||
block_root: Hash256,
|
block_root: Hash256,
|
||||||
@@ -412,27 +410,6 @@ impl<T: EthSpec, S: SlotClock> DataAvailabilityChecker<T, S> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks if a block is available, returning an error if the block is not immediately available.
|
|
||||||
/// Does not access the gossip cache.
|
|
||||||
pub fn try_check_availability(
|
|
||||||
&self,
|
|
||||||
block: BlockWrapper<T>,
|
|
||||||
) -> Result<AvailableBlock<T>, AvailabilityCheckError> {
|
|
||||||
match block {
|
|
||||||
BlockWrapper::Block(block) => {
|
|
||||||
let blob_requirements = self.get_blob_requirements(&block)?;
|
|
||||||
let blobs = match blob_requirements {
|
|
||||||
BlobRequirements::EmptyBlobs => VerifiedBlobs::EmptyBlobs,
|
|
||||||
BlobRequirements::NotRequired => VerifiedBlobs::NotRequired,
|
|
||||||
BlobRequirements::PreDeneb => VerifiedBlobs::PreDeneb,
|
|
||||||
BlobRequirements::Required => return Err(AvailabilityCheckError::MissingBlobs),
|
|
||||||
};
|
|
||||||
Ok(AvailableBlock { block, blobs })
|
|
||||||
}
|
|
||||||
BlockWrapper::BlockAndBlobs(_, _) => Err(AvailabilityCheckError::Pending),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Verifies a block against a set of KZG verified blobs. Returns an AvailableBlock if block's
|
/// Verifies a block against a set of KZG verified blobs. Returns an AvailableBlock if block's
|
||||||
/// commitments are consistent with the provided verified blob commitments.
|
/// commitments are consistent with the provided verified blob commitments.
|
||||||
pub fn check_availability_with_blobs(
|
pub fn check_availability_with_blobs(
|
||||||
|
|||||||
@@ -989,8 +989,10 @@ impl<T: BeaconChainTypes> Worker<T> {
|
|||||||
);
|
);
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
Err(e @ BlockError::BlobValidation(_)) => {
|
Err(e @ BlockError::BlobValidation(_))
|
||||||
warn!(self.log, "Could not verify blob for gossip. Rejecting the block and blob";
|
| Err(e @ BlockError::MissingBlockParts(_, _))
|
||||||
|
| Err(e @ BlockError::AvailabilityCheck(_)) => {
|
||||||
|
warn!(self.log, "Could not verify block against known blobs in gossip. Rejecting the block";
|
||||||
"error" => %e);
|
"error" => %e);
|
||||||
self.propagate_validation_result(message_id, peer_id, MessageAcceptance::Reject);
|
self.propagate_validation_result(message_id, peer_id, MessageAcceptance::Reject);
|
||||||
self.gossip_penalize_peer(
|
self.gossip_penalize_peer(
|
||||||
@@ -1000,7 +1002,6 @@ impl<T: BeaconChainTypes> Worker<T> {
|
|||||||
);
|
);
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
_ => todo!(), //TODO(sean)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
metrics::inc_counter(&metrics::BEACON_PROCESSOR_GOSSIP_BLOCK_VERIFIED_TOTAL);
|
metrics::inc_counter(&metrics::BEACON_PROCESSOR_GOSSIP_BLOCK_VERIFIED_TOTAL);
|
||||||
|
|||||||
@@ -984,11 +984,11 @@ impl<T: BeaconChainTypes> SyncManager<T> {
|
|||||||
seen_timestamp,
|
seen_timestamp,
|
||||||
&mut self.network,
|
&mut self.network,
|
||||||
),
|
),
|
||||||
RequestId::BackFillBlocks { id } => {
|
RequestId::BackFillBlocks { id: _ } => {
|
||||||
todo!()
|
warn!(self.log, "Blob received during backfill block request"; "peer_id" => %peer_id );
|
||||||
}
|
}
|
||||||
RequestId::RangeBlocks { id } => {
|
RequestId::RangeBlocks { id: _ } => {
|
||||||
todo!()
|
warn!(self.log, "Blob received during range block request"; "peer_id" => %peer_id );
|
||||||
}
|
}
|
||||||
RequestId::BackFillBlockAndBlobs { id } => {
|
RequestId::BackFillBlockAndBlobs { id } => {
|
||||||
self.backfill_block_and_blobs_response(id, peer_id, blob.into())
|
self.backfill_block_and_blobs_response(id, peer_id, blob.into())
|
||||||
|
|||||||
Reference in New Issue
Block a user