fix: gracefully handle missing persisted_trie_updates (#13942)

This commit is contained in:
Arsenii Kulikov
2025-01-27 18:02:53 +04:00
committed by GitHub
parent b9a6e65d8c
commit 33bf34b2fb
15 changed files with 249 additions and 162 deletions

View File

@ -14,7 +14,7 @@ use alloy_rpc_types_engine::PayloadId;
use op_alloy_consensus::{OpDepositReceipt, OpTxType};
use op_alloy_rpc_types_engine::OpPayloadAttributes;
use reth_basic_payload_builder::*;
use reth_chain_state::ExecutedBlock;
use reth_chain_state::{ExecutedBlock, ExecutedBlockWithTrieUpdates};
use reth_chainspec::{ChainSpecProvider, EthereumHardforks};
use reth_evm::{
env::EvmEnv, system_calls::SystemCaller, ConfigureEvm, ConfigureEvmEnv, Evm,
@ -435,13 +435,15 @@ where
debug!(target: "payload_builder", id=%ctx.attributes().payload_id(), sealed_block_header = ?sealed_block.header(), "sealed built block");
// create the executed block data
let executed: ExecutedBlock<OpPrimitives> = ExecutedBlock {
recovered_block: Arc::new(RecoveredBlock::new_sealed(
sealed_block.as_ref().clone(),
info.executed_senders,
)),
execution_output: Arc::new(execution_outcome),
hashed_state: Arc::new(hashed_state),
let executed: ExecutedBlockWithTrieUpdates<OpPrimitives> = ExecutedBlockWithTrieUpdates {
block: ExecutedBlock {
recovered_block: Arc::new(RecoveredBlock::new_sealed(
sealed_block.as_ref().clone(),
info.executed_senders,
)),
execution_output: Arc::new(execution_outcome),
hashed_state: Arc::new(hashed_state),
},
trie: Arc::new(trie_output),
};

View File

@ -11,7 +11,7 @@ use op_alloy_consensus::{encode_holocene_extra_data, EIP1559ParamError};
/// Re-export for use in downstream arguments.
pub use op_alloy_rpc_types_engine::OpPayloadAttributes;
use op_alloy_rpc_types_engine::{OpExecutionPayloadEnvelopeV3, OpExecutionPayloadEnvelopeV4};
use reth_chain_state::ExecutedBlock;
use reth_chain_state::ExecutedBlockWithTrieUpdates;
use reth_chainspec::EthereumHardforks;
use reth_optimism_chainspec::OpChainSpec;
use reth_optimism_primitives::{OpBlock, OpPrimitives, OpTransactionSigned};
@ -137,7 +137,7 @@ pub struct OpBuiltPayload {
/// The built block
pub(crate) block: Arc<SealedBlock<OpBlock>>,
/// Block execution data for the payload, if any.
pub(crate) executed_block: Option<ExecutedBlock<OpPrimitives>>,
pub(crate) executed_block: Option<ExecutedBlockWithTrieUpdates<OpPrimitives>>,
/// The fees of the block
pub(crate) fees: U256,
/// The blobs, proofs, and commitments in the block. If the block is pre-cancun, this will be
@ -159,7 +159,7 @@ impl OpBuiltPayload {
fees: U256,
chain_spec: Arc<OpChainSpec>,
attributes: OpPayloadBuilderAttributes,
executed_block: Option<ExecutedBlock<OpPrimitives>>,
executed_block: Option<ExecutedBlockWithTrieUpdates<OpPrimitives>>,
) -> Self {
Self { id, block, executed_block, fees, sidecars: Vec::new(), chain_spec, attributes }
}
@ -196,7 +196,7 @@ impl BuiltPayload for OpBuiltPayload {
self.fees
}
fn executed_block(&self) -> Option<ExecutedBlock<OpPrimitives>> {
fn executed_block(&self) -> Option<ExecutedBlockWithTrieUpdates<OpPrimitives>> {
self.executed_block.clone()
}
@ -216,7 +216,7 @@ impl BuiltPayload for &OpBuiltPayload {
(**self).fees()
}
fn executed_block(&self) -> Option<ExecutedBlock<OpPrimitives>> {
fn executed_block(&self) -> Option<ExecutedBlockWithTrieUpdates<OpPrimitives>> {
self.executed_block.clone()
}