Skip to content

Commit

Permalink
Filters out invalid transaction trace entries (#771)
Browse files Browse the repository at this point in the history
* ignore consecutive call list new events

* Remove empty entries in `proxy::v1`

* Remove empty entries in `proxy::formats`

Co-authored-by: tgmichel <telmo@purestake.com>
  • Loading branch information
nanocryk and tgmichel authored Sep 2, 2021
1 parent 98d18ca commit f0c775b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion primitives/rpc/debug/src/proxy/formats/trace_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ impl super::TraceResponseBuilder for Response {
type Listener = Listener;
type Response = Vec<TransactionTrace>;

fn build(listener: Listener) -> Option<Vec<TransactionTrace>> {
fn build(mut listener: Listener) -> Option<Vec<TransactionTrace>> {
// Remove empty BTreeMaps pushed to `entries`.
// I.e. InvalidNonce or other pallet_evm::runner exits
listener.entries.retain(|x| !x.is_empty());
let mut traces = Vec::new();
for (eth_tx_index, entry) in listener.entries.iter().enumerate() {
let mut tx_traces: Vec<_> = entry
Expand Down
5 changes: 4 additions & 1 deletion primitives/rpc/debug/src/proxy/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ impl CallListProxy {

/// Format the RPC output for multiple transactions. Each call-stack represents a single
/// transaction/EVM execution.
pub fn into_tx_traces(self) -> Vec<BlockTrace> {
pub fn into_tx_traces(&mut self) -> Vec<BlockTrace> {
// Remove empty BTreeMaps pushed to `entries`.
// I.e. InvalidNonce or other pallet_evm::runner exits
self.entries.retain(|x| !x.is_empty());
let mut traces = Vec::new();
for (eth_tx_index, entry) in self.entries.iter().enumerate() {
let mut tx_traces: Vec<_> = entry
Expand Down

0 comments on commit f0c775b

Please sign in to comment.