Skip to content

Commit

Permalink
replace DisplayHardforks with Box<dyn Display> (#12219)
Browse files Browse the repository at this point in the history
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
  • Loading branch information
stevencartavia and mattsse authored Oct 31, 2024
1 parent d020b41 commit bd8c4ec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
11 changes: 5 additions & 6 deletions crates/chainspec/src/api.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use crate::{ChainSpec, DepositContract};
use alloc::vec::Vec;
use alloc::{boxed::Box, vec::Vec};
use alloy_chains::Chain;
use alloy_eips::eip1559::BaseFeeParams;
use alloy_genesis::Genesis;
use alloy_primitives::B256;
use core::fmt::Debug;
use reth_ethereum_forks::DisplayHardforks;
use core::fmt::{Debug, Display};
use reth_network_peers::NodeRecord;
use reth_primitives_traits::Header;

Expand Down Expand Up @@ -39,7 +38,7 @@ pub trait EthChainSpec: Send + Sync + Unpin + Debug {
fn prune_delete_limit(&self) -> usize;

/// Returns a string representation of the hardforks.
fn display_hardforks(&self) -> DisplayHardforks;
fn display_hardforks(&self) -> Box<dyn Display>;

/// The genesis header.
fn genesis_header(&self) -> &Header;
Expand Down Expand Up @@ -89,8 +88,8 @@ impl EthChainSpec for ChainSpec {
self.prune_delete_limit
}

fn display_hardforks(&self) -> DisplayHardforks {
self.display_hardforks()
fn display_hardforks(&self) -> Box<dyn Display> {
Box::new(Self::display_hardforks(self))
}

fn genesis_header(&self) -> &Header {
Expand Down
10 changes: 5 additions & 5 deletions crates/optimism/chainspec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ mod dev;
mod op;
mod op_sepolia;

use alloc::{vec, vec::Vec};
use alloc::{boxed::Box, vec, vec::Vec};
use alloy_chains::Chain;
use alloy_genesis::Genesis;
use alloy_primitives::{Bytes, Parity, Signature, B256, U256};
Expand All @@ -30,8 +30,8 @@ pub(crate) use once_cell::sync::Lazy as LazyLock;
pub use op::OP_MAINNET;
pub use op_sepolia::OP_SEPOLIA;
use reth_chainspec::{
BaseFeeParams, BaseFeeParamsKind, ChainSpec, ChainSpecBuilder, DepositContract,
DisplayHardforks, EthChainSpec, EthereumHardforks, ForkFilter, ForkId, Hardforks, Head,
BaseFeeParams, BaseFeeParamsKind, ChainSpec, ChainSpecBuilder, DepositContract, EthChainSpec,
EthereumHardforks, ForkFilter, ForkId, Hardforks, Head,
};
use reth_ethereum_forks::{ChainHardforks, EthereumHardfork, ForkCondition, Hardfork};
use reth_network_peers::NodeRecord;
Expand Down Expand Up @@ -287,8 +287,8 @@ impl EthChainSpec for OpChainSpec {
self.inner.prune_delete_limit()
}

fn display_hardforks(&self) -> DisplayHardforks {
self.inner.display_hardforks()
fn display_hardforks(&self) -> Box<dyn Display> {
Box::new(ChainSpec::display_hardforks(self))
}

fn genesis_header(&self) -> &Header {
Expand Down

0 comments on commit bd8c4ec

Please sign in to comment.