From ce276c1f42677618546f4c07dc782a1dedd51ef7 Mon Sep 17 00:00:00 2001 From: Ryan Schneider Date: Tue, 19 Nov 2024 11:40:01 -0800 Subject: [PATCH 1/2] feat: Add more missing eth_callBundle arguments Previously https://github.com/alloy-rs/alloy/pull/978 missed `coinbase` and `timeout`. --- crates/rpc-types-mev/src/eth_calls.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/crates/rpc-types-mev/src/eth_calls.rs b/crates/rpc-types-mev/src/eth_calls.rs index 9c928b1d0bd..f7da7e5ba5b 100644 --- a/crates/rpc-types-mev/src/eth_calls.rs +++ b/crates/rpc-types-mev/src/eth_calls.rs @@ -18,9 +18,15 @@ pub struct EthCallBundle { pub block_number: u64, /// Either a hex encoded number or a block tag for which state to base this simulation on pub state_block_number: BlockNumberOrTag, + /// the coinbase to use for this bundle simulation + #[serde(default, skip_serializing_if = "Option::is_none")] + pub coinbase: Option
, /// the timestamp to use for this bundle simulation, in seconds since the unix epoch #[serde(default, with = "alloy_serde::quantity::opt", skip_serializing_if = "Option::is_none")] pub timestamp: Option, + /// the timeout to apply to execution of this bundle, in milliseconds + #[serde(default, with = "alloy_serde::quantity::opt", skip_serializing_if = "Option::is_none")] + pub timeout: Option, /// gas limit of the block to use for this simulation #[serde(default, with = "alloy_serde::quantity::opt", skip_serializing_if = "Option::is_none")] pub gas_limit: Option, @@ -96,12 +102,24 @@ impl EthCallBundle { self } + /// Sets the coinbase for the bundle. + pub fn with_coinbase(mut self, coinbase: Address) -> Self { + self.coinbase = Some(coinbase); + self + } + /// Sets the timestamp for the bundle. pub const fn with_timestamp(mut self, timestamp: u64) -> Self { self.timestamp = Some(timestamp); self } + /// Sets the timeout for the bundle. + pub fn with_timeout(mut self, timeout: u64) -> Self { + self.timeout = Some(timeout); + self + } + /// Sets the gas limit for the bundle. pub const fn with_gas_limit(mut self, gas_limit: u64) -> Self { self.gas_limit = Some(gas_limit); From 5388bfeda5187eb98425b613d4bc43082b844b6a Mon Sep 17 00:00:00 2001 From: Ryan Schneider Date: Tue, 19 Nov 2024 11:48:18 -0800 Subject: [PATCH 2/2] fixup(clippy): Apply missing `const` to new methods. --- crates/rpc-types-mev/src/eth_calls.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/rpc-types-mev/src/eth_calls.rs b/crates/rpc-types-mev/src/eth_calls.rs index f7da7e5ba5b..1a666770fe9 100644 --- a/crates/rpc-types-mev/src/eth_calls.rs +++ b/crates/rpc-types-mev/src/eth_calls.rs @@ -103,7 +103,7 @@ impl EthCallBundle { } /// Sets the coinbase for the bundle. - pub fn with_coinbase(mut self, coinbase: Address) -> Self { + pub const fn with_coinbase(mut self, coinbase: Address) -> Self { self.coinbase = Some(coinbase); self } @@ -115,7 +115,7 @@ impl EthCallBundle { } /// Sets the timeout for the bundle. - pub fn with_timeout(mut self, timeout: u64) -> Self { + pub const fn with_timeout(mut self, timeout: u64) -> Self { self.timeout = Some(timeout); self }