reth_primitives

Trait Hardforks

pub trait Hardforks: Clone {
    // Required methods
    fn fork<H>(&self, fork: H) -> ForkCondition
       where H: Hardfork;
    fn forks_iter(
        &self,
    ) -> impl Iterator<Item = (&(dyn Hardfork + 'static), 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>(&self, fork: H, timestamp: u64) -> bool
       where H: Hardfork { ... }
    fn is_fork_active_at_block<H>(&self, fork: H, block_number: u64) -> bool
       where H: Hardfork { ... }
}
Expand description

Generic trait over a set of ordered hardforks

Required Methods§

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

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

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

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

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

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

fn latest_fork_id(&self) -> ForkId

Returns the ForkId for the last fork.

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

Creates a ForkFilter for the block described by Head.

Provided Methods§

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

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

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

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§

§

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

§

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

§

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

§

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

§

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

§

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

§

fn latest_fork_id(&self) -> ForkId

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

fn latest_fork_id(&self) -> ForkId

§

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

Implementors§