Skip to content

Commit

Permalink
addd tx_hash placeholer
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzamontiel committed Nov 27, 2024
1 parent 09a30aa commit 85cd473
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion client/evm-tracing/src/formatters/blockscout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::types::{
single::{Call, TransactionTrace},
CallResult, CallType, CreateResult,
};
use ethereum_types::{H160, U256};
use ethereum_types::{H160, H256, U256};
use parity_scale_codec::{Decode, Encode};
use serde::Serialize;

Expand Down Expand Up @@ -73,6 +73,7 @@ pub enum BlockscoutCallInner {
#[derive(Clone, Eq, PartialEq, Debug, Encode, Decode, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct BlockscoutCall {
pub tx_hash: H256,
pub from: H160,
/// Indices of parent calls.
pub trace_address: Vec<u32>,
Expand Down
6 changes: 5 additions & 1 deletion client/evm-tracing/src/formatters/call_tracer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::listeners::call_list::Listener;
use crate::types::serialization::*;
use serde::Serialize;

use ethereum_types::{H160, U256};
use ethereum_types::{H160, H256, U256};
use parity_scale_codec::{Decode, Encode};
use sp_std::{cmp::Ordering, vec::Vec};

Expand All @@ -44,13 +44,15 @@ impl super::ResponseFormatter for Formatter {
let mut result: Vec<Call> = entry
.into_iter()
.map(|(_, it)| {
let tx_hash= it.tx_hash;
let from = it.from;
let trace_address = it.trace_address.clone();
let value = it.value;
let gas = it.gas;
let gas_used = it.gas_used;
let inner = it.inner.clone();
Call::CallTracer(CallTracerCall {
tx_hash: tx_hash,
from: from,
gas: gas,
gas_used: gas_used,
Expand Down Expand Up @@ -256,6 +258,8 @@ impl super::ResponseFormatter for Formatter {
#[derive(Clone, Eq, PartialEq, Debug, Encode, Decode, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CallTracerCall {
pub tx_hash: H256,

pub from: H160,

/// Indices of parent calls. Used to build the Etherscan nested response.
Expand Down
7 changes: 7 additions & 0 deletions client/evm-tracing/src/listeners/call_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use crate::formatters::blockscout::BlockscoutCall as Call;
use crate::formatters::blockscout::BlockscoutCallInner as CallInner;
use crate::types::{single::Log, CallResult, CallType, ContextType, CreateResult};
use ethereum_types::H256;
use ethereum_types::{H160, U256};
use evm_tracing_events::{
runtime::{Capture, ExitError, ExitReason, ExitSucceed},
Expand Down Expand Up @@ -154,6 +155,7 @@ impl Listener {
.to_vec(),
);
Call {
tx_hash: H256::zero(),
from: context.from,
trace_address: context.trace_address,
subtraces: context.subtraces,
Expand All @@ -175,6 +177,7 @@ impl Listener {
};

Call {
tx_hash: H256::zero(),
value: context.value,
trace_address: context.trace_address,
subtraces: context.subtraces,
Expand Down Expand Up @@ -204,6 +207,7 @@ impl Listener {
);

let entry = Call {
tx_hash: H256::zero(),
from: H160::repeat_byte(0),
trace_address: vec![],
subtraces: 0,
Expand Down Expand Up @@ -501,6 +505,7 @@ impl Listener {
self.insert_entry(
self.entries_next_index,
Call {
tx_hash: H256::zero(),
from: address, // this contract is self destructing
trace_address,
subtraces: 0,
Expand Down Expand Up @@ -600,6 +605,7 @@ impl Listener {
};

Call {
tx_hash: H256::zero(),
from: context.from,
trace_address: context.trace_address,
subtraces: context.subtraces,
Expand Down Expand Up @@ -631,6 +637,7 @@ impl Listener {
};

Call {
tx_hash: H256::zero(),
value: context.value,
trace_address: context.trace_address,
subtraces: context.subtraces,
Expand Down

0 comments on commit 85cd473

Please sign in to comment.