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§
Sourcefn get_final_paris_total_difficulty(&self) -> Option<U256>
fn get_final_paris_total_difficulty(&self) -> Option<U256>
Returns the final total difficulty if the Paris hardfork is known.
Sourcefn final_paris_total_difficulty(&self, block_number: u64) -> Option<U256>
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§
Sourcefn is_shanghai_active_at_timestamp(&self, timestamp: u64) -> bool
fn is_shanghai_active_at_timestamp(&self, timestamp: u64) -> bool
Convenience method to check if EthereumHardfork::Shanghai
is active at a given
timestamp.
Sourcefn is_cancun_active_at_timestamp(&self, timestamp: u64) -> bool
fn is_cancun_active_at_timestamp(&self, timestamp: u64) -> bool
Convenience method to check if EthereumHardfork::Cancun
is active at a given timestamp.
Sourcefn is_prague_active_at_timestamp(&self, timestamp: u64) -> bool
fn is_prague_active_at_timestamp(&self, timestamp: u64) -> bool
Convenience method to check if EthereumHardfork::Prague
is active at a given timestamp.
Sourcefn is_osaka_active_at_timestamp(&self, timestamp: u64) -> bool
fn is_osaka_active_at_timestamp(&self, timestamp: u64) -> bool
Convenience method to check if EthereumHardfork::Osaka
is active at a given timestamp.
Sourcefn is_byzantium_active_at_block(&self, block_number: u64) -> bool
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.
Sourcefn is_spurious_dragon_active_at_block(&self, block_number: u64) -> bool
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.
Sourcefn is_homestead_active_at_block(&self, block_number: u64) -> bool
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.
Sourcefn is_paris_active_at_block(&self, block_number: u64) -> Option<bool>
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.