Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Enhance Call Tracer Performance and Code Reliability #3125

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 7 additions & 19 deletions client/evm-tracing/src/formatters/call_tracer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,19 +266,16 @@ impl super::ResponseFormatter for Formatter {
pub struct CallTracerCall {
pub from: H160,

/// Indices of parent calls. Used to build the Etherscan nested response.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub trace_address: Option<Vec<u32>>,

/// Remaining gas in the runtime.
pub gas: U256,
/// Gas used by this context.
pub gas_used: U256,

#[serde(flatten)]
pub inner: CallTracerInner,

#[serde(skip_serializing_if = "Vec::is_empty")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub calls: Vec<Call>,
}

Expand All @@ -291,32 +288,23 @@ pub enum CallTracerInner {
to: H160,
#[serde(serialize_with = "bytes_0x_serialize")]
input: Vec<u8>,
/// "output" or "error" field
#[serde(flatten)]
res: CallResult,

#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
value: Option<U256>,

#[serde(skip_serializing_if = "Vec::is_empty")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
logs: Vec<Log>,
},
Create {
#[serde(rename = "type", serialize_with = "opcode_serialize")]
call_type: Vec<u8>,
#[serde(serialize_with = "bytes_0x_serialize")]
input: Vec<u8>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
to: Option<H160>,
#[serde(
skip_serializing_if = "Option::is_none",
serialize_with = "option_bytes_0x_serialize"
)]
#[serde(default, skip_serializing_if = "Option::is_none", serialize_with = "option_bytes_0x_serialize")]
output: Option<Vec<u8>>,
#[serde(
skip_serializing_if = "Option::is_none",
serialize_with = "option_string_serialize"
)]
#[serde(default, skip_serializing_if = "Option::is_none", serialize_with = "option_string_serialize")]
error: Option<Vec<u8>>,
value: U256,
},
Expand Down