Skip to content

Commit

Permalink
chore(executor): rm upstream util (#755)
Browse files Browse the repository at this point in the history
  • Loading branch information
refcell authored Nov 1, 2024
1 parent 08d12cc commit 4002bdb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 45 deletions.
10 changes: 7 additions & 3 deletions crates/executor/src/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
Expand Down Expand Up @@ -205,7 +205,7 @@ where
cumulative_gas_used += result.gas_used();

// Create receipt envelope.
let receipt = receipt_envelope_from_parts(
let receipt = OpReceiptEnvelope::<Log>::from_parts(
result.is_success(),
cumulative_gas_used as u128,
result.logs(),
Expand All @@ -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);
}

Expand Down
44 changes: 2 additions & 42 deletions crates/executor/src/executor/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Item = &'a Log>,
tx_type: OpTxType,
deposit_nonce: Option<u64>,
deposit_receipt_version: Option<u64>,
) -> OpReceiptEnvelope {
let logs = logs.into_iter().cloned().collect::<Vec<_>>();
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
Expand Down

0 comments on commit 4002bdb

Please sign in to comment.