From 16fbf988c77c1259b70f71fd762d2b4fdbfcba52 Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Mon, 3 Mar 2025 16:50:50 -0800 Subject: [PATCH] chore: clippy + cleanup --- crates/cli/src/commands/spam.rs | 5 ++++- crates/core/src/generator/named_txs.rs | 4 ++-- crates/core/src/spammer/mod.rs | 2 +- crates/core/src/test_scenario.rs | 11 ++++------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/crates/cli/src/commands/spam.rs b/crates/cli/src/commands/spam.rs index 0526b80..09efeb6 100644 --- a/crates/cli/src/commands/spam.rs +++ b/crates/cli/src/commands/spam.rs @@ -252,7 +252,10 @@ async fn get_max_spam_cost vec![tx_req.to_owned()], - ExecutionPayload::SignedTxBundle(_envelopes, tx_reqs) => tx_reqs.to_vec(), + ExecutionPayload::SignedTxBundle(_envelopes, tx_reqs) => tx_reqs + .iter() + .map(|tx| Box::new(tx.to_owned())) + .collect::>(), }) .collect::>() .concat(); diff --git a/crates/core/src/generator/named_txs.rs b/crates/core/src/generator/named_txs.rs index 72ad365..3bdcc1b 100644 --- a/crates/core/src/generator/named_txs.rs +++ b/crates/core/src/generator/named_txs.rs @@ -34,13 +34,13 @@ pub struct NamedTxRequestBuilder { #[derive(Clone, Debug)] pub enum ExecutionRequest { - Tx(NamedTxRequest), + Tx(Box), Bundle(Vec), } impl From for ExecutionRequest { fn from(tx: NamedTxRequest) -> Self { - Self::Tx(tx) + Self::Tx(Box::new(tx)) } } diff --git a/crates/core/src/spammer/mod.rs b/crates/core/src/spammer/mod.rs index 77c0ec7..334264d 100644 --- a/crates/core/src/spammer/mod.rs +++ b/crates/core/src/spammer/mod.rs @@ -14,7 +14,7 @@ pub use tx_callback::{LogCallback, NilCallback, OnTxSent}; #[derive(Clone, Debug)] pub enum ExecutionPayload { - SignedTx(TxEnvelope, NamedTxRequest), + SignedTx(Box, Box), SignedTxBundle(Vec, Vec), } diff --git a/crates/core/src/test_scenario.rs b/crates/core/src/test_scenario.rs index 71a615d..22b9ea4 100644 --- a/crates/core/src/test_scenario.rs +++ b/crates/core/src/test_scenario.rs @@ -387,9 +387,8 @@ where let mut bundle_txs = vec![]; for req in reqs { - let tx_req = req.tx.to_owned(); let (tx_req, signer) = self - .prepare_tx_request(&tx_req, gas_price) + .prepare_tx_request(&req.tx, gas_price) .await .map_err(|e| ContenderError::with_err(e, "failed to prepare tx"))?; @@ -404,10 +403,8 @@ where ExecutionPayload::SignedTxBundle(bundle_txs, reqs.to_owned()) } ExecutionRequest::Tx(req) => { - let tx_req = req.tx.to_owned(); - let (tx_req, signer) = self - .prepare_tx_request(&tx_req, gas_price) + .prepare_tx_request(&req.tx, gas_price) .await .map_err(|e| ContenderError::with_err(e, "failed to prepare tx"))?; @@ -437,7 +434,7 @@ where .unwrap_or_else(|| "N/A".to_owned()) ); - ExecutionPayload::SignedTx(tx_envelope, req.to_owned()) + ExecutionPayload::SignedTx(Box::new(tx_envelope), req.to_owned()) } }; payloads.push(payload); @@ -471,7 +468,7 @@ where let handles = match payload.to_owned() { ExecutionPayload::SignedTx(signed_tx, req) => { let res = rpc_client - .send_tx_envelope(AnyTxEnvelope::Ethereum(signed_tx.to_owned())) + .send_tx_envelope(AnyTxEnvelope::Ethereum(*signed_tx)) .await .expect("failed to send tx envelope"); let maybe_handle = callback_handler.on_tx_sent(