From cdb7802c3764b091c6e40ee4150864762b0574fa Mon Sep 17 00:00:00 2001 From: Darshan Kathiriya <8559992+lakshya-sky@users.noreply.github.com> Date: Mon, 25 Sep 2023 15:59:10 -0300 Subject: [PATCH] added blockoverride field in geth tracing call options (#2603) * added blockoverride field in geth tracing call options * fix examples errors --- ethers-core/src/types/trace/geth.rs | 25 +++++++++++++++++++- examples/transactions/examples/trace_call.rs | 1 + 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ethers-core/src/types/trace/geth.rs b/ethers-core/src/types/trace/geth.rs index 8ea58e11b..eea460edc 100644 --- a/ethers-core/src/types/trace/geth.rs +++ b/ethers-core/src/types/trace/geth.rs @@ -199,6 +199,28 @@ pub struct GethDebugTracingOptions { pub timeout: Option, } +/// Bindings for block overrides in `debug_traceCall` options +/// +/// See +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Default)] +#[serde(rename_all = "camelCase")] +pub struct BlockOverrides { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub number: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub difficulty: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub gas_limit: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub coinbase: Option
, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub random: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub base_fee: Option, +} + /// Bindings for additional `debug_traceCall` options /// /// See @@ -209,7 +231,8 @@ pub struct GethDebugTracingCallOptions { pub tracing_options: GethDebugTracingOptions, #[serde(default, skip_serializing_if = "Option::is_none")] pub state_overrides: Option, - // TODO: Add blockoverrides options + #[serde(default, skip_serializing_if = "Option::is_none")] + pub block_overrides: Option, } /// Provides types and methods for constructing an `eth_call` diff --git a/examples/transactions/examples/trace_call.rs b/examples/transactions/examples/trace_call.rs index 849f564b4..62ee4ae05 100644 --- a/examples/transactions/examples/trace_call.rs +++ b/examples/transactions/examples/trace_call.rs @@ -27,6 +27,7 @@ async fn main() -> Result<()> { ..Default::default() }, state_overrides: None, + block_overrides: None, }; let traces = client.debug_trace_call(tx, Some(block), options).await?; println!("{traces:?}");