Skip to content

Commit

Permalink
Merge pull request #138 from flashbots/brock/chores
Browse files Browse the repository at this point in the history
chore: clippy + cleanup
  • Loading branch information
zeroXbrock authored Mar 4, 2025
2 parents 6200c6b + 16fbf98 commit b3673d3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
5 changes: 4 additions & 1 deletion crates/cli/src/commands/spam.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,10 @@ async fn get_max_spam_cost<D: DbOps + Send + Sync + 'static, S: Seeder + Send +
.iter()
.map(|ex_payload| match ex_payload {
ExecutionPayload::SignedTx(_envelope, tx_req) => 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::<Vec<_>>(),
})
.collect::<Vec<_>>()
.concat();
Expand Down
4 changes: 2 additions & 2 deletions crates/core/src/generator/named_txs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ pub struct NamedTxRequestBuilder {

#[derive(Clone, Debug)]
pub enum ExecutionRequest {
Tx(NamedTxRequest),
Tx(Box<NamedTxRequest>),
Bundle(Vec<NamedTxRequest>),
}

impl From<NamedTxRequest> for ExecutionRequest {
fn from(tx: NamedTxRequest) -> Self {
Self::Tx(tx)
Self::Tx(Box::new(tx))
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/spammer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub use tx_callback::{LogCallback, NilCallback, OnTxSent};

#[derive(Clone, Debug)]
pub enum ExecutionPayload {
SignedTx(TxEnvelope, NamedTxRequest),
SignedTx(Box<TxEnvelope>, Box<NamedTxRequest>),
SignedTxBundle(Vec<TxEnvelope>, Vec<NamedTxRequest>),
}

Expand Down
11 changes: 4 additions & 7 deletions crates/core/src/test_scenario.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))?;

Expand All @@ -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"))?;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit b3673d3

Please sign in to comment.