Skip to content

Commit

Permalink
use derive
Browse files Browse the repository at this point in the history
  • Loading branch information
dapplion committed Jul 28, 2024
1 parent 513c1b5 commit 8a0f4af
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
8 changes: 1 addition & 7 deletions beacon_node/beacon_chain/src/blob_verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use types::blob_sidecar::BlobIdentifier;
use types::{BeaconStateError, BlobSidecar, EthSpec, Hash256, SignedBeaconBlockHeader, Slot};

/// An error occurred while validating a gossip blob.
#[derive(Debug)]
#[derive(Debug, strum::Display)]
pub enum GossipBlobError {
/// The blob sidecar is from a slot that is later than the current slot (with respect to the
/// gossip clock disparity).
Expand Down Expand Up @@ -143,12 +143,6 @@ pub enum GossipBlobError {
NotFinalizedDescendant { block_parent_root: Hash256 },
}

impl std::fmt::Display for GossipBlobError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self)
}
}

impl From<BeaconChainError> for GossipBlobError {
fn from(e: BeaconChainError) -> Self {
GossipBlobError::BeaconChainError(e)
Expand Down
13 changes: 1 addition & 12 deletions beacon_node/beacon_chain/src/block_verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const WRITE_BLOCK_PROCESSING_SSZ: bool = cfg!(feature = "write_ssz_files");
///
/// - The block is malformed/invalid (indicated by all results other than `BeaconChainError`.
/// - We encountered an error whilst trying to verify the block (a `BeaconChainError`).
#[derive(Debug)]
#[derive(Debug, strum::Display)]
pub enum BlockError {
/// The parent block was unknown.
///
Expand Down Expand Up @@ -426,17 +426,6 @@ impl From<InconsistentFork> for BlockError {
}
}

impl std::fmt::Display for BlockError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
BlockError::ParentUnknown { parent_root, .. } => {
write!(f, "ParentUnknown(parent_root:{})", parent_root)
}
other => write!(f, "{:?}", other),
}
}
}

impl From<BlockSignatureVerifierError> for BlockError {
fn from(e: BlockSignatureVerifierError) -> Self {
match e {
Expand Down

0 comments on commit 8a0f4af

Please sign in to comment.