reth_ethereum_forks

Trait EthereumHardforks

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

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

Source

fn get_final_paris_total_difficulty(&self) -> Option<U256>

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

Source

fn final_paris_total_difficulty(&self, block_number: u64) -> Option<U256>

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§

Source

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

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

Source

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

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

Source

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

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

Source

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

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

Source

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.

Source

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.

Source

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.

Source

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§

Source§

impl<'a, T: 'a + EthereumHardforks + ?Sized> EthereumHardforks for &'a T

Source§

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

Implementors§