Skip to main content

Hardforks

Trait Hardforks 

Source
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§

Source

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

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

Source

fn forks_iter( &self, ) -> impl Iterator<Item = (&(dyn Hardfork + 'static), 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.

NOTE: This returns the latest implemented ForkId. In many cases this will be the future ForkId on given network.

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>(&self, fork: H, timestamp: u64) -> bool
where H: Hardfork,

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

Source

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".

Implementations on Foreign Types§

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

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 for Arc<T>
where T: Hardforks + ?Sized, Arc<T>: Clone,

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn latest_fork_id(&self) -> ForkId

Source§

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

Implementors§

Source§

impl<H> Hardforks for ChainSpec<H>
where H: BlockHeader,