Skip to content

Commit

Permalink
fix: omit output if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Aug 10, 2023
1 parent 4de1ff0 commit 44e8ed4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/revm/revm-inspectors/src/tracing/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ impl CallTraceNode {
gas: U256::from(self.trace.gas_limit),
gas_used: U256::from(self.trace.gas_used),
input: self.trace.data.clone().into(),
output: Some(self.trace.output.clone().into()),
output: (!self.trace.output.is_empty()).then(|| self.trace.output.clone().into()),
error: None,
revert_reason: None,
calls: Default::default(),
Expand Down
3 changes: 3 additions & 0 deletions crates/rpc/rpc-types/src/eth/trace/geth/call.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use reth_primitives::{serde_helper::num::from_int_or_hex, Address, Bytes, H256, U256};
use serde::{Deserialize, Serialize};

/// The response object for `debug_traceTransaction` with `"tracer": "callTracer"`
///
/// <https://github.com/ethereum/go-ethereum/blob/91cb6f863a965481e51d5d9c0e5ccd54796fd967/eth/tracers/native/call.go#L44>
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]

Check failure on line 7 in crates/rpc/rpc-types/src/eth/trace/geth/call.rs

View workflow job for this annotation

GitHub Actions / clippy

mismatched types

error[E0308]: mismatched types --> crates/rpc/rpc-types/src/eth/trace/geth/call.rs:7:48 | 7 | #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] | ^^^^^^^^^ expected `&Option<_>`, found `&Bytes` ... 16 | #[serde(default, skip_serializing_if = "Option::is_none")] | ----------------- arguments to this function are incorrect | = note: expected reference `&std::option::Option<_>` found reference `&reth_primitives::Bytes` note: method defined here --> /rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/core/src/option.rs:642:18 = note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
pub struct CallFrame {
Expand All @@ -11,6 +13,7 @@ pub struct CallFrame {
pub gas_used: U256,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub to: Option<Address>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub input: Bytes,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub output: Option<Bytes>,
Expand Down

0 comments on commit 44e8ed4

Please sign in to comment.