Skip to content

Commit

Permalink
added blockoverride field in geth tracing call options (#2603)
Browse files Browse the repository at this point in the history
* added blockoverride field in geth tracing call options

* fix examples errors
  • Loading branch information
lakshya-sky committed Sep 25, 2023
1 parent 908ecb5 commit cdb7802
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
25 changes: 24 additions & 1 deletion ethers-core/src/types/trace/geth.rs
Expand Up @@ -199,6 +199,28 @@ pub struct GethDebugTracingOptions {
pub timeout: Option<String>,
}

/// Bindings for block overrides in `debug_traceCall` options
///
/// See <https://github.com/ethereum/go-ethereum/pull/24871>
#[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<U64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub difficulty: Option<U256>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub time: Option<U64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub gas_limit: Option<U64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub coinbase: Option<Address>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub random: Option<H256>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub base_fee: Option<U256>,
}

/// Bindings for additional `debug_traceCall` options
///
/// See <https://geth.ethereum.org/docs/rpc/ns-debug#debug_tracecall>
Expand All @@ -209,7 +231,8 @@ pub struct GethDebugTracingCallOptions {
pub tracing_options: GethDebugTracingOptions,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub state_overrides: Option<spoof::State>,
// TODO: Add blockoverrides options
#[serde(default, skip_serializing_if = "Option::is_none")]
pub block_overrides: Option<BlockOverrides>,
}

/// Provides types and methods for constructing an `eth_call`
Expand Down
1 change: 1 addition & 0 deletions examples/transactions/examples/trace_call.rs
Expand Up @@ -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:?}");
Expand Down

0 comments on commit cdb7802

Please sign in to comment.