lots of refactoring

This commit is contained in:
realbigsean
2023-05-19 17:47:44 -04:00
parent bef63e42f7
commit c7aad773a8
8 changed files with 408 additions and 382 deletions

View File

@@ -511,7 +511,7 @@ impl<T: EthSpec> TryInto<AvailableBlock<T>> for MaybeAvailableBlock<T> {
fn try_into(self) -> Result<AvailableBlock<T>, Self::Error> {
match self {
Self::Available(block) => Ok(block),
Self::AvailabilityPending(block) => Err(AvailabilityCheckError::MissingBlobs),
Self::AvailabilityPending(_block) => Err(AvailabilityCheckError::MissingBlobs),
}
}
}

View File

@@ -312,7 +312,9 @@ pub enum BlockError<T: EthSpec> {
ParentExecutionPayloadInvalid {
parent_root: Hash256,
},
/// The blob alone failed validation.
BlobValidation(BlobError<T>),
/// The block and blob together failed validation.
AvailabilityCheck(AvailabilityCheckError),
MissingBlockParts(Slot, Hash256),
}

View File

@@ -37,6 +37,7 @@ pub enum AvailabilityCheckError {
SszTypes(ssz_types::Error),
MissingBlobs,
NumBlobsMismatch {
/// The peer sent us an invalid block, we must penalise harshly.
num_kzg_commitments: usize,
num_blobs: usize,
},