Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion crates/evm/src/eth/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ pub struct EthBlockExecutionCtx<'a> {
pub withdrawals: Option<Cow<'a, Withdrawals>>,
/// Block extra data.
pub extra_data: Bytes,
/// Block transactions count hint. Used to preallocate the receipts vector.
pub tx_count_hint: Option<usize>,
}

/// Block executor for Ethereum.
Expand Down Expand Up @@ -72,10 +74,11 @@ where
{
/// Creates a new [`EthBlockExecutor`]
pub fn new(evm: Evm, ctx: EthBlockExecutionCtx<'a>, spec: Spec, receipt_builder: R) -> Self {
let tx_count_hint = ctx.tx_count_hint.unwrap_or_default();
Self {
evm,
ctx,
receipts: Vec::new(),
receipts: Vec::with_capacity(tx_count_hint),
gas_used: 0,
blob_gas_used: 0,
system_caller: SystemCaller::new(spec.clone()),
Expand Down