reth_ethereum_forks

Trait Hardforks

Source
pub trait Hardforks: Clone {
    // Required methods
    fn fork<H: Hardfork>(&self, fork: H) -> ForkCondition;
    fn forks_iter(&self) -> impl Iterator<Item = (&dyn Hardfork, ForkCondition)>;
    fn fork_id(&self, head: &Head) -> ForkId;
    fn latest_fork_id(&self) -> ForkId;
    fn fork_filter(&self, head: Head) -> ForkFilter;

    // Provided methods
    fn is_fork_active_at_timestamp<H: Hardfork>(
        &self,
        fork: H,
        timestamp: u64,
    ) -> bool { ... }
    fn is_fork_active_at_block<H: Hardfork>(
        &self,
        fork: H,
        block_number: u64,
    ) -> bool { ... }
}
Expand description

Generic trait over a set of ordered hardforks

Required Methods§

Source

fn fork<H: Hardfork>(&self, fork: H) -> ForkCondition

Retrieves ForkCondition from fork. If fork is not present, returns ForkCondition::Never.

Source

fn forks_iter(&self) -> impl Iterator<Item = (&dyn Hardfork, ForkCondition)>

Get an iterator of all hardforks with their respective activation conditions.

Source

fn fork_id(&self, head: &Head) -> ForkId

Compute the ForkId for the given Head following eip-6122 spec

Source

fn latest_fork_id(&self) -> ForkId

Returns the ForkId for the last fork.

Source

fn fork_filter(&self, head: Head) -> ForkFilter

Creates a ForkFilter for the block described by Head.

Provided Methods§

Source

fn is_fork_active_at_timestamp<H: Hardfork>( &self, fork: H, timestamp: u64, ) -> bool

Convenience method to check if a fork is active at a given timestamp.

Source

fn is_fork_active_at_block<H: Hardfork>( &self, fork: H, block_number: u64, ) -> bool

Convenience method to check if a fork is active at a given block number.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a, T: 'a + Hardforks + ?Sized> Hardforks for &'a T
where &'a T: Clone,

Source§

fn fork<H: Hardfork>(&self, fork: H) -> ForkCondition

Source§

fn forks_iter(&self) -> impl Iterator<Item = (&dyn Hardfork, ForkCondition)>

Source§

fn is_fork_active_at_timestamp<H: Hardfork>( &self, fork: H, timestamp: u64, ) -> bool

Source§

fn is_fork_active_at_block<H: Hardfork>( &self, fork: H, block_number: u64, ) -> bool

Source§

fn fork_id(&self, head: &Head) -> ForkId

Source§

fn latest_fork_id(&self) -> ForkId

Source§

fn fork_filter(&self, head: Head) -> ForkFilter

Source§

impl<T: Hardforks + ?Sized> Hardforks for Arc<T>
where Arc<T>: Clone,

Source§

fn fork<H: Hardfork>(&self, fork: H) -> ForkCondition

Source§

fn forks_iter(&self) -> impl Iterator<Item = (&dyn Hardfork, ForkCondition)>

Source§

fn is_fork_active_at_timestamp<H: Hardfork>( &self, fork: H, timestamp: u64, ) -> bool

Source§

fn is_fork_active_at_block<H: Hardfork>( &self, fork: H, block_number: u64, ) -> bool

Source§

fn fork_id(&self, head: &Head) -> ForkId

Source§

fn latest_fork_id(&self) -> ForkId

Source§

fn fork_filter(&self, head: Head) -> ForkFilter

Implementors§