mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: add missing is active at timestamp fns (#12206)
This commit is contained in:
@ -26,18 +26,35 @@ pub trait OptimismHardforks: EthereumHardforks {
|
||||
self.fork(OptimismHardfork::Bedrock).active_at_block(block_number)
|
||||
}
|
||||
|
||||
/// Returns `true` if [`Canyon`](OptimismHardfork::Canyon) is active at given block timestamp.
|
||||
fn is_canyon_active_at_timestamp(&self, timestamp: u64) -> bool {
|
||||
self.fork(OptimismHardfork::Canyon).active_at_timestamp(timestamp)
|
||||
}
|
||||
|
||||
/// Returns `true` if [`Ecotone`](OptimismHardfork::Ecotone) is active at given block timestamp.
|
||||
fn is_ecotone_active_at_timestamp(&self, timestamp: u64) -> bool {
|
||||
self.fork(OptimismHardfork::Ecotone).active_at_timestamp(timestamp)
|
||||
}
|
||||
|
||||
/// Returns `true` if [`Ecotone`](OptimismHardfork::Ecotone) is active at given block timestamp.
|
||||
/// Returns `true` if [`Fjord`](OptimismHardfork::Fjord) is active at given block timestamp.
|
||||
fn is_fjord_active_at_timestamp(&self, timestamp: u64) -> bool {
|
||||
self.fork(OptimismHardfork::Ecotone).active_at_timestamp(timestamp)
|
||||
self.fork(OptimismHardfork::Fjord).active_at_timestamp(timestamp)
|
||||
}
|
||||
|
||||
/// Returns `true` if [`Granite`](OptimismHardfork::Granite) is active at given block timestamp.
|
||||
fn is_granite_active_at_timestamp(&self, timestamp: u64) -> bool {
|
||||
self.fork(OptimismHardfork::Granite).active_at_timestamp(timestamp)
|
||||
}
|
||||
|
||||
/// Returns `true` if [`Holocene`](OptimismHardfork::Holocene) is active at given block
|
||||
/// timestamp.
|
||||
fn is_holocene_active_at_timestamp(&self, timestamp: u64) -> bool {
|
||||
self.fork(OptimismHardfork::Holocene).active_at_timestamp(timestamp)
|
||||
}
|
||||
|
||||
/// Returns `true` if [`Regolith`](OptimismHardfork::Regolith) is active at given block
|
||||
/// timestamp.
|
||||
fn is_regolith_active_at_timestamp(&self, timestamp: u64) -> bool {
|
||||
self.fork(OptimismHardfork::Regolith).active_at_timestamp(timestamp)
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ use reth_node_api::{
|
||||
validate_version_specific_fields, EngineTypes, EngineValidator,
|
||||
};
|
||||
use reth_optimism_chainspec::OpChainSpec;
|
||||
use reth_optimism_forks::OptimismHardfork;
|
||||
use reth_optimism_forks::{OptimismHardfork, OptimismHardforks};
|
||||
use reth_optimism_payload_builder::{
|
||||
builder::decode_eip_1559_params, OptimismBuiltPayload, OptimismPayloadBuilderAttributes,
|
||||
};
|
||||
@ -149,10 +149,8 @@ where
|
||||
))
|
||||
}
|
||||
|
||||
if self.chain_spec.is_fork_active_at_timestamp(
|
||||
OptimismHardfork::Holocene,
|
||||
attributes.payload_attributes.timestamp,
|
||||
) {
|
||||
if self.chain_spec.is_holocene_active_at_timestamp(attributes.payload_attributes.timestamp)
|
||||
{
|
||||
let Some(eip_1559_params) = attributes.eip_1559_params else {
|
||||
return Err(EngineObjectValidationError::InvalidParams(
|
||||
"MissingEip1559ParamsInPayloadAttributes".to_string().into(),
|
||||
|
||||
@ -11,7 +11,7 @@ use reth_evm::{system_calls::SystemCaller, ConfigureEvm, ConfigureEvmEnv, NextBl
|
||||
use reth_execution_types::ExecutionOutcome;
|
||||
use reth_optimism_chainspec::OpChainSpec;
|
||||
use reth_optimism_consensus::calculate_receipt_root_no_memo_optimism;
|
||||
use reth_optimism_forks::{OptimismHardfork, OptimismHardforks};
|
||||
use reth_optimism_forks::OptimismHardforks;
|
||||
use reth_payload_primitives::{PayloadBuilderAttributes, PayloadBuilderError};
|
||||
use reth_primitives::{
|
||||
proofs,
|
||||
@ -193,10 +193,8 @@ where
|
||||
|
||||
let block_number = initialized_block_env.number.to::<u64>();
|
||||
|
||||
let is_regolith = chain_spec.is_fork_active_at_timestamp(
|
||||
OptimismHardfork::Regolith,
|
||||
attributes.payload_attributes.timestamp,
|
||||
);
|
||||
let is_regolith =
|
||||
chain_spec.is_regolith_active_at_timestamp(attributes.payload_attributes.timestamp);
|
||||
|
||||
// apply eip-4788 pre block contract call
|
||||
let mut system_caller = SystemCaller::new(evm_config.clone(), &chain_spec);
|
||||
@ -315,10 +313,7 @@ where
|
||||
// receipt hashes should be computed when set. The state transition process
|
||||
// ensures this is only set for post-Canyon deposit transactions.
|
||||
deposit_receipt_version: chain_spec
|
||||
.is_fork_active_at_timestamp(
|
||||
OptimismHardfork::Canyon,
|
||||
attributes.payload_attributes.timestamp,
|
||||
)
|
||||
.is_canyon_active_at_timestamp(attributes.payload_attributes.timestamp)
|
||||
.then_some(1),
|
||||
}));
|
||||
|
||||
@ -473,10 +468,8 @@ where
|
||||
(None, None)
|
||||
};
|
||||
|
||||
let is_holocene = chain_spec.is_fork_active_at_timestamp(
|
||||
OptimismHardfork::Holocene,
|
||||
attributes.payload_attributes.timestamp,
|
||||
);
|
||||
let is_holocene =
|
||||
chain_spec.is_holocene_active_at_timestamp(attributes.payload_attributes.timestamp);
|
||||
|
||||
if is_holocene {
|
||||
extra_data = attributes
|
||||
|
||||
Reference in New Issue
Block a user