reth_primitives

Trait EthereumHardforks

pub trait EthereumHardforks: Hardforks {
    // Required methods
    fn get_final_paris_total_difficulty(&self) -> Option<Uint<256, 4>>;
    fn final_paris_total_difficulty(
        &self,
        block_number: u64,
    ) -> Option<Uint<256, 4>>;

    // Provided methods
    fn is_shanghai_active_at_timestamp(&self, timestamp: u64) -> bool { ... }
    fn is_cancun_active_at_timestamp(&self, timestamp: u64) -> bool { ... }
    fn is_prague_active_at_timestamp(&self, timestamp: u64) -> bool { ... }
    fn is_osaka_active_at_timestamp(&self, timestamp: u64) -> bool { ... }
    fn is_byzantium_active_at_block(&self, block_number: u64) -> bool { ... }
    fn is_spurious_dragon_active_at_block(&self, block_number: u64) -> bool { ... }
    fn is_homestead_active_at_block(&self, block_number: u64) -> bool { ... }
    fn is_paris_active_at_block(&self, block_number: u64) -> Option<bool> { ... }
}
Expand description

Helper methods for Ethereum forks.

Required Methods§

fn get_final_paris_total_difficulty(&self) -> Option<Uint<256, 4>>

Returns the final total difficulty if the Paris hardfork is known.

fn final_paris_total_difficulty( &self, block_number: u64, ) -> Option<Uint<256, 4>>

Returns the final total difficulty if the given block number is after the Paris hardfork.

Note: technically this would also be valid for the block before the paris upgrade, but this edge case is omitted here.

Provided Methods§

fn is_shanghai_active_at_timestamp(&self, timestamp: u64) -> bool

Convenience method to check if EthereumHardfork::Shanghai is active at a given timestamp.

fn is_cancun_active_at_timestamp(&self, timestamp: u64) -> bool

Convenience method to check if EthereumHardfork::Cancun is active at a given timestamp.

fn is_prague_active_at_timestamp(&self, timestamp: u64) -> bool

Convenience method to check if EthereumHardfork::Prague is active at a given timestamp.

fn is_osaka_active_at_timestamp(&self, timestamp: u64) -> bool

Convenience method to check if EthereumHardfork::Osaka is active at a given timestamp.

fn is_byzantium_active_at_block(&self, block_number: u64) -> bool

Convenience method to check if EthereumHardfork::Byzantium is active at a given block number.

fn is_spurious_dragon_active_at_block(&self, block_number: u64) -> bool

Convenience method to check if EthereumHardfork::SpuriousDragon is active at a given block number.

fn is_homestead_active_at_block(&self, block_number: u64) -> bool

Convenience method to check if EthereumHardfork::Homestead is active at a given block number.

fn is_paris_active_at_block(&self, block_number: u64) -> Option<bool>

The Paris hardfork (merge) is activated via block number. If we have knowledge of the block, this function will return true if the block number is greater than or equal to the Paris (merge) block.

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> EthereumHardforks for &'a T

§

fn is_shanghai_active_at_timestamp(&self, timestamp: u64) -> bool

§

fn is_cancun_active_at_timestamp(&self, timestamp: u64) -> bool

§

fn is_prague_active_at_timestamp(&self, timestamp: u64) -> bool

§

fn is_osaka_active_at_timestamp(&self, timestamp: u64) -> bool

§

fn is_byzantium_active_at_block(&self, block_number: u64) -> bool

§

fn is_spurious_dragon_active_at_block(&self, block_number: u64) -> bool

§

fn is_homestead_active_at_block(&self, block_number: u64) -> bool

§

fn is_paris_active_at_block(&self, block_number: u64) -> Option<bool>

§

fn get_final_paris_total_difficulty(&self) -> Option<Uint<256, 4>>

§

fn final_paris_total_difficulty( &self, block_number: u64, ) -> Option<Uint<256, 4>>

§

impl<T> EthereumHardforks for Arc<T>

§

fn is_shanghai_active_at_timestamp(&self, timestamp: u64) -> bool

§

fn is_cancun_active_at_timestamp(&self, timestamp: u64) -> bool

§

fn is_prague_active_at_timestamp(&self, timestamp: u64) -> bool

§

fn is_osaka_active_at_timestamp(&self, timestamp: u64) -> bool

§

fn is_byzantium_active_at_block(&self, block_number: u64) -> bool

§

fn is_spurious_dragon_active_at_block(&self, block_number: u64) -> bool

§

fn is_homestead_active_at_block(&self, block_number: u64) -> bool

§

fn is_paris_active_at_block(&self, block_number: u64) -> Option<bool>

§

fn get_final_paris_total_difficulty(&self) -> Option<Uint<256, 4>>

§

fn final_paris_total_difficulty( &self, block_number: u64, ) -> Option<Uint<256, 4>>

Implementors§