Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

fix small nits #153

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion crates/primitives/src/revm/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ pub fn tx_env_with_recovered(transaction: &TransactionSignedEcRecovered) -> TxEn

#[cfg(feature = "optimism")]
{
let mut envelope_buf = Vec::default();
let mut envelope_buf = Vec::new();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we instead allocate this with capacity? This is called a lot, so this reallocation may hit perf.

Suggested change
let mut envelope_buf = Vec::new();
let mut envelope_buf = Vec::with_capacity(transaction.length_without_header());

transaction.encode_enveloped(&mut envelope_buf);
fill_tx_env(&mut tx_env, transaction.as_ref(), transaction.signer(), envelope_buf.into());
}
Expand Down
6 changes: 3 additions & 3 deletions crates/rpc/rpc-engine-api/src/engine_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,12 @@ where
self.inner.task_spawner.spawn_blocking(Box::pin(async move {
if count > MAX_PAYLOAD_BODIES_LIMIT {
tx.send(Err(EngineApiError::PayloadRequestTooLarge { len: count })).ok();
return;
return
}

if start == 0 || count == 0 {
tx.send(Err(EngineApiError::InvalidBodiesRange { start, count })).ok();
return;
return
}

let mut result = Vec::with_capacity(count as usize);
Expand All @@ -291,7 +291,7 @@ where
}
Err(err) => {
tx.send(Err(EngineApiError::Internal(Box::new(err)))).ok();
return;
return
}
};
}
Expand Down
Loading