-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add debug_traceTransaction RPC (#165)
* remove DbcFinality * remove benchmarking.rs * fix * remove cli feature * fix runtime-benchmarks * add evm debug * fix * remove logs * update * update * fmt
- Loading branch information
Showing
71 changed files
with
8,273 additions
and
2,616 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[package] | ||
name = "dbc-client-evm-tracing" | ||
version = { workspace = true } | ||
authors = { workspace = true } | ||
edition = "2021" | ||
|
||
[dependencies] | ||
ethereum-types = { workspace = true, features = [ "std" ] } | ||
hex = { workspace = true, features = [ "serde" ] } | ||
serde = { workspace = true, features = [ "derive", "std" ] } | ||
serde_json = { workspace = true } | ||
|
||
dbc-primitives-rpc-evm-tracing-events = { workspace = true, features = [ "std" ] } | ||
dbc-primitives-rpc-debug = { workspace = true, features = [ "std" ] } | ||
|
||
# Substrate | ||
parity-scale-codec = { workspace = true, features = [ "std" ] } | ||
sp-std = { workspace = true, features = [ "std" ] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
use crate::{ | ||
listeners::call_list::Listener, | ||
types::{ | ||
serialization::*, | ||
single::{Call, TransactionTrace}, | ||
CallResult, CallType, CreateResult, | ||
}, | ||
}; | ||
use ethereum_types::{H160, U256}; | ||
use parity_scale_codec::{Decode, Encode}; | ||
use serde::Serialize; | ||
|
||
pub struct Formatter; | ||
|
||
impl super::ResponseFormatter for Formatter { | ||
type Listener = Listener; | ||
type Response = TransactionTrace; | ||
|
||
fn format(listener: Listener) -> Option<TransactionTrace> { | ||
if let Some(entry) = listener.entries.last() { | ||
return Some(TransactionTrace::CallList( | ||
entry.into_iter().map(|(_, value)| Call::Blockscout(value.clone())).collect(), | ||
)) | ||
} | ||
None | ||
} | ||
} | ||
|
||
#[derive(Clone, Eq, PartialEq, Debug, Encode, Decode, Serialize)] | ||
#[serde(rename_all = "lowercase", tag = "type")] | ||
pub enum BlockscoutCallInner { | ||
Call { | ||
#[serde(rename(serialize = "callType"))] | ||
/// Type of call. | ||
call_type: CallType, | ||
to: H160, | ||
#[serde(serialize_with = "bytes_0x_serialize")] | ||
input: Vec<u8>, | ||
/// "output" or "error" field | ||
#[serde(flatten)] | ||
res: CallResult, | ||
}, | ||
Create { | ||
#[serde(serialize_with = "bytes_0x_serialize")] | ||
init: Vec<u8>, | ||
#[serde(flatten)] | ||
res: CreateResult, | ||
}, | ||
SelfDestruct { | ||
#[serde(skip)] | ||
balance: U256, | ||
to: H160, | ||
}, | ||
} | ||
|
||
#[derive(Clone, Eq, PartialEq, Debug, Encode, Decode, Serialize)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct BlockscoutCall { | ||
pub from: H160, | ||
/// Indices of parent calls. | ||
pub trace_address: Vec<u32>, | ||
/// Number of children calls. | ||
/// Not needed for Blockscout, but needed for `crate::block` | ||
/// types that are build from this type. | ||
#[serde(skip)] | ||
pub subtraces: u32, | ||
/// Sends funds to the (payable) function | ||
pub value: U256, | ||
/// Remaining gas in the runtime. | ||
pub gas: U256, | ||
/// Gas used by this context. | ||
pub gas_used: U256, | ||
#[serde(flatten)] | ||
pub inner: BlockscoutCallInner, | ||
} |
Oops, something went wrong.