From 4002bdbd0bd54859d789da1fec473a89e82ce26a Mon Sep 17 00:00:00 2001 From: refcell Date: Fri, 1 Nov 2024 11:36:34 -0400 Subject: [PATCH] chore(executor): rm upstream util (#755) --- crates/executor/src/executor/mod.rs | 10 +++++-- crates/executor/src/executor/util.rs | 44 ++-------------------------- 2 files changed, 9 insertions(+), 45 deletions(-) diff --git a/crates/executor/src/executor/mod.rs b/crates/executor/src/executor/mod.rs index 845a318f5..cd547c19e 100644 --- a/crates/executor/src/executor/mod.rs +++ b/crates/executor/src/executor/mod.rs @@ -10,7 +10,7 @@ use crate::{ use alloc::vec::Vec; use alloy_consensus::{Header, Sealable, Transaction, EMPTY_OMMER_ROOT_HASH, EMPTY_ROOT_HASH}; use alloy_eips::eip2718::{Decodable2718, Encodable2718}; -use alloy_primitives::{keccak256, logs_bloom, Bytes, B256, U256}; +use alloy_primitives::{keccak256, logs_bloom, Bytes, Log, B256, U256}; use kona_mpt::{ordered_trie_with_encoder, TrieHinter, TrieProvider}; use op_alloy_consensus::{OpReceiptEnvelope, OpTxEnvelope}; use op_alloy_genesis::RollupConfig; @@ -28,7 +28,7 @@ pub use builder::{KonaHandleRegister, StatelessL2BlockExecutorBuilder}; mod env; mod util; -use util::{encode_holocene_eip_1559_params, receipt_envelope_from_parts}; +use util::encode_holocene_eip_1559_params; /// The block executor for the L2 client program. Operates off of a [TrieDB] backed [State], /// allowing for stateless block execution of OP Stack blocks. @@ -205,7 +205,7 @@ where cumulative_gas_used += result.gas_used(); // Create receipt envelope. - let receipt = receipt_envelope_from_parts( + let receipt = OpReceiptEnvelope::::from_parts( result.is_success(), cumulative_gas_used as u128, result.logs(), @@ -222,6 +222,10 @@ where }) .flatten(), ); + // Ensure the receipt is not an EIP-7702 receipt. + if matches!(receipt, OpReceiptEnvelope::Eip7702(_)) { + panic!("EIP-7702 receipts are not supported by the fault proof program"); + } receipts.push(receipt); } diff --git a/crates/executor/src/executor/util.rs b/crates/executor/src/executor/util.rs index cf12df775..4939595bb 100644 --- a/crates/executor/src/executor/util.rs +++ b/crates/executor/src/executor/util.rs @@ -2,52 +2,12 @@ use crate::{constants::HOLOCENE_EXTRA_DATA_VERSION, ExecutorError, ExecutorResult}; use alloc::vec::Vec; -use alloy_consensus::{Eip658Value, Header, Receipt, ReceiptWithBloom}; +use alloy_consensus::Header; use alloy_eips::eip1559::BaseFeeParams; -use alloy_primitives::{logs_bloom, Bytes, Log, B64}; -use op_alloy_consensus::{ - OpDepositReceipt, OpDepositReceiptWithBloom, OpReceiptEnvelope, OpTxType, -}; +use alloy_primitives::{Bytes, B64}; use op_alloy_genesis::RollupConfig; use op_alloy_rpc_types_engine::OpPayloadAttributes; -/// Constructs a [OpReceiptEnvelope] from a [Receipt] fields and [OpTxType]. -pub(crate) fn receipt_envelope_from_parts<'a>( - status: bool, - cumulative_gas_used: u128, - logs: impl IntoIterator, - tx_type: OpTxType, - deposit_nonce: Option, - deposit_receipt_version: Option, -) -> OpReceiptEnvelope { - let logs = logs.into_iter().cloned().collect::>(); - let logs_bloom = logs_bloom(&logs); - let inner_receipt = Receipt { status: Eip658Value::Eip658(status), cumulative_gas_used, logs }; - match tx_type { - OpTxType::Legacy => { - OpReceiptEnvelope::Legacy(ReceiptWithBloom { receipt: inner_receipt, logs_bloom }) - } - OpTxType::Eip2930 => { - OpReceiptEnvelope::Eip2930(ReceiptWithBloom { receipt: inner_receipt, logs_bloom }) - } - OpTxType::Eip1559 => { - OpReceiptEnvelope::Eip1559(ReceiptWithBloom { receipt: inner_receipt, logs_bloom }) - } - OpTxType::Eip7702 => panic!("EIP-7702 is not supported"), - OpTxType::Deposit => { - let inner = OpDepositReceiptWithBloom { - receipt: OpDepositReceipt { - inner: inner_receipt, - deposit_nonce, - deposit_receipt_version, - }, - logs_bloom, - }; - OpReceiptEnvelope::Deposit(inner) - } - } -} - /// Parse Holocene [Header] extra data. /// /// ## Takes