feat: add Header AT to EthChainSpec (#13046)

This commit is contained in:
Arsenii Kulikov
2024-12-02 04:56:00 +04:00
committed by GitHub
parent 7f88e62781
commit 3f93f35c20
7 changed files with 39 additions and 24 deletions

View File

@ -14,6 +14,9 @@ pub trait EthChainSpec: Send + Sync + Unpin + Debug {
// todo: make chain spec type generic over hardfork
//type Hardfork: Clone + Copy + 'static;
/// The header type of the network.
type Header;
/// Returns the [`Chain`] object this spec targets.
fn chain(&self) -> Chain;
@ -41,7 +44,7 @@ pub trait EthChainSpec: Send + Sync + Unpin + Debug {
fn display_hardforks(&self) -> Box<dyn Display>;
/// The genesis header.
fn genesis_header(&self) -> &Header;
fn genesis_header(&self) -> &Self::Header;
/// The genesis block specification.
fn genesis(&self) -> &Genesis;
@ -64,6 +67,8 @@ pub trait EthChainSpec: Send + Sync + Unpin + Debug {
}
impl EthChainSpec for ChainSpec {
type Header = Header;
fn chain(&self) -> Chain {
self.chain
}
@ -92,7 +97,7 @@ impl EthChainSpec for ChainSpec {
Box::new(Self::display_hardforks(self))
}
fn genesis_header(&self) -> &Header {
fn genesis_header(&self) -> &Self::Header {
self.genesis_header()
}