From cede8b7dd6b6e4ea413192cf40804ffee126cdac Mon Sep 17 00:00:00 2001 From: Thomas Coratger <60488569+tcoratger@users.noreply.github.com> Date: Fri, 9 Feb 2024 18:24:55 +0100 Subject: [PATCH] replace &Bytes with &[u8] in optimism functions (#5896) Co-authored-by: Matthias Seitz --- crates/revm/src/optimism/mod.rs | 8 ++++---- crates/rpc/rpc/src/eth/api/transactions.rs | 7 ++----- crates/transaction-pool/src/validate/eth.rs | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/crates/revm/src/optimism/mod.rs b/crates/revm/src/optimism/mod.rs index 0c3d394dd6..1b553593b0 100644 --- a/crates/revm/src/optimism/mod.rs +++ b/crates/revm/src/optimism/mod.rs @@ -170,7 +170,7 @@ pub trait RethL1BlockInfo { &self, chain_spec: &ChainSpec, timestamp: u64, - input: &Bytes, + input: &[u8], is_deposit: bool, ) -> Result; @@ -184,7 +184,7 @@ pub trait RethL1BlockInfo { &self, chain_spec: &ChainSpec, timestamp: u64, - input: &Bytes, + input: &[u8], ) -> Result; } @@ -193,7 +193,7 @@ impl RethL1BlockInfo for L1BlockInfo { &self, chain_spec: &ChainSpec, timestamp: u64, - input: &Bytes, + input: &[u8], is_deposit: bool, ) -> Result { if is_deposit { @@ -218,7 +218,7 @@ impl RethL1BlockInfo for L1BlockInfo { &self, chain_spec: &ChainSpec, timestamp: u64, - input: &Bytes, + input: &[u8], ) -> Result { let spec_id = if chain_spec.is_fork_active_at_timestamp(Hardfork::Regolith, timestamp) { SpecId::REGOLITH diff --git a/crates/rpc/rpc/src/eth/api/transactions.rs b/crates/rpc/rpc/src/eth/api/transactions.rs index 36348db5fc..20d0bbb6d2 100644 --- a/crates/rpc/rpc/src/eth/api/transactions.rs +++ b/crates/rpc/rpc/src/eth/api/transactions.rs @@ -1112,11 +1112,8 @@ where ) -> EthResult { let Some(l1_block_info) = l1_block_info else { return Ok(OptimismTxMeta::default()) }; - let envelope_buf: Bytes = { - let mut envelope_buf = bytes::BytesMut::new(); - tx.encode_enveloped(&mut envelope_buf); - envelope_buf.freeze().into() - }; + let mut envelope_buf = bytes::BytesMut::new(); + tx.encode_enveloped(&mut envelope_buf); let (l1_fee, l1_data_gas) = if tx.is_deposit() { let inner_l1_fee = l1_block_info diff --git a/crates/transaction-pool/src/validate/eth.rs b/crates/transaction-pool/src/validate/eth.rs index e41907e845..fb9c9e1569 100644 --- a/crates/transaction-pool/src/validate/eth.rs +++ b/crates/transaction-pool/src/validate/eth.rs @@ -342,7 +342,7 @@ where info.l1_tx_data_fee( &self.chain_spec, block.timestamp, - &encoded.freeze().into(), + &encoded, transaction.is_deposit(), ) }) {