Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace DisplayHardforks with Box<dyn Display> #12219

Merged
merged 5 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(ChainSpec::display_hardforks(self))
mattsse marked this conversation as resolved.
Show resolved Hide resolved
}

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
Loading