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

Filters out invalid transaction trace entries #771

Merged
merged 3 commits into from
Sep 2, 2021
Merged
Show file tree
Hide file tree
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
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