mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix: do not calculate requests root pre-prague in dev mode (#8652)
Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com>
This commit is contained in:
@ -260,14 +260,13 @@ impl StorageInner {
|
||||
/// transactions.
|
||||
pub(crate) fn build_header_template(
|
||||
&self,
|
||||
timestamp: u64,
|
||||
transactions: &[TransactionSigned],
|
||||
ommers: &[Header],
|
||||
withdrawals: Option<&Withdrawals>,
|
||||
requests: Option<&Requests>,
|
||||
chain_spec: Arc<ChainSpec>,
|
||||
) -> Header {
|
||||
let timestamp = SystemTime::now().duration_since(UNIX_EPOCH).unwrap_or_default().as_secs();
|
||||
|
||||
// check previous block for base fee
|
||||
let base_fee_per_gas = self.headers.get(&self.best_block).and_then(|parent| {
|
||||
parent.next_block_base_fee(chain_spec.base_fee_params_at_timestamp(timestamp))
|
||||
@ -347,8 +346,6 @@ impl StorageInner {
|
||||
&mut self,
|
||||
transactions: Vec<TransactionSigned>,
|
||||
ommers: Vec<Header>,
|
||||
withdrawals: Option<Withdrawals>,
|
||||
requests: Option<Requests>,
|
||||
provider: &Provider,
|
||||
chain_spec: Arc<ChainSpec>,
|
||||
executor: &Executor,
|
||||
@ -357,7 +354,17 @@ impl StorageInner {
|
||||
Executor: BlockExecutorProvider,
|
||||
Provider: StateProviderFactory,
|
||||
{
|
||||
let timestamp = SystemTime::now().duration_since(UNIX_EPOCH).unwrap_or_default().as_secs();
|
||||
|
||||
// if shanghai is active, include empty withdrawals
|
||||
let withdrawals =
|
||||
chain_spec.is_shanghai_active_at_timestamp(timestamp).then_some(Withdrawals::default());
|
||||
// if prague is active, include empty requests
|
||||
let requests =
|
||||
chain_spec.is_prague_active_at_timestamp(timestamp).then_some(Requests::default());
|
||||
|
||||
let header = self.build_header_template(
|
||||
timestamp,
|
||||
&transactions,
|
||||
&ommers,
|
||||
withdrawals.as_ref(),
|
||||
|
||||
@ -3,7 +3,7 @@ use futures_util::{future::BoxFuture, FutureExt};
|
||||
use reth_beacon_consensus::{BeaconEngineMessage, ForkchoiceStatus};
|
||||
use reth_engine_primitives::EngineTypes;
|
||||
use reth_evm::execute::BlockExecutorProvider;
|
||||
use reth_primitives::{ChainSpec, IntoRecoveredTransaction, Requests, Withdrawals};
|
||||
use reth_primitives::{ChainSpec, IntoRecoveredTransaction};
|
||||
use reth_provider::{CanonChainTracker, StateProviderFactory};
|
||||
use reth_rpc_types::engine::ForkchoiceState;
|
||||
use reth_stages_api::PipelineEvent;
|
||||
@ -129,15 +129,10 @@ where
|
||||
})
|
||||
.collect();
|
||||
let ommers = vec![];
|
||||
// todo(onbjerg): these two dont respect chainspec
|
||||
let withdrawals = Some(Withdrawals::default());
|
||||
let requests = Some(Requests::default());
|
||||
|
||||
match storage.build_and_execute(
|
||||
transactions.clone(),
|
||||
ommers.clone(),
|
||||
withdrawals.clone(),
|
||||
requests.clone(),
|
||||
&client,
|
||||
chain_spec,
|
||||
&executor,
|
||||
|
||||
Reference in New Issue
Block a user