-
Notifications
You must be signed in to change notification settings - Fork 767
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'deneb-free-blobs' into kzg-runtime
- Loading branch information
Showing
154 changed files
with
1,012 additions
and
716 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
beacon_node/beacon_chain/src/data_availability_checker/error.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
use kzg::{Error as KzgError, KzgCommitment}; | ||
use strum::IntoStaticStr; | ||
use types::{BeaconStateError, Hash256}; | ||
|
||
#[derive(Debug, IntoStaticStr)] | ||
pub enum Error { | ||
Kzg(KzgError), | ||
KzgNotInitialized, | ||
KzgVerificationFailed, | ||
KzgCommitmentMismatch { | ||
blob_commitment: KzgCommitment, | ||
block_commitment: KzgCommitment, | ||
}, | ||
Unexpected, | ||
SszTypes(ssz_types::Error), | ||
MissingBlobs, | ||
BlobIndexInvalid(u64), | ||
StoreError(store::Error), | ||
DecodeError(ssz::DecodeError), | ||
InconsistentBlobBlockRoots { | ||
block_root: Hash256, | ||
blob_block_root: Hash256, | ||
}, | ||
ParentStateMissing(Hash256), | ||
BlockReplayError(state_processing::BlockReplayError), | ||
RebuildingStateCaches(BeaconStateError), | ||
} | ||
|
||
pub enum ErrorCategory { | ||
/// Internal Errors (not caused by peers) | ||
Internal, | ||
/// Errors caused by faulty / malicious peers | ||
Malicious, | ||
} | ||
|
||
impl Error { | ||
pub fn category(&self) -> ErrorCategory { | ||
match self { | ||
Error::KzgNotInitialized | ||
| Error::SszTypes(_) | ||
| Error::MissingBlobs | ||
| Error::StoreError(_) | ||
| Error::DecodeError(_) | ||
| Error::Unexpected | ||
| Error::ParentStateMissing(_) | ||
| Error::BlockReplayError(_) | ||
| Error::RebuildingStateCaches(_) => ErrorCategory::Internal, | ||
Error::Kzg(_) | ||
| Error::BlobIndexInvalid(_) | ||
| Error::KzgCommitmentMismatch { .. } | ||
| Error::KzgVerificationFailed | ||
| Error::InconsistentBlobBlockRoots { .. } => ErrorCategory::Malicious, | ||
} | ||
} | ||
} | ||
|
||
impl From<ssz_types::Error> for Error { | ||
fn from(value: ssz_types::Error) -> Self { | ||
Self::SszTypes(value) | ||
} | ||
} | ||
|
||
impl From<store::Error> for Error { | ||
fn from(value: store::Error) -> Self { | ||
Self::StoreError(value) | ||
} | ||
} | ||
|
||
impl From<ssz::DecodeError> for Error { | ||
fn from(value: ssz::DecodeError) -> Self { | ||
Self::DecodeError(value) | ||
} | ||
} | ||
|
||
impl From<state_processing::BlockReplayError> for Error { | ||
fn from(value: state_processing::BlockReplayError) -> Self { | ||
Self::BlockReplayError(value) | ||
} | ||
} |
Oops, something went wrong.