diff --git a/primitives/rpc/debug/src/proxy/formats/trace_filter.rs b/primitives/rpc/debug/src/proxy/formats/trace_filter.rs index 81e3f4db6f..ec2ad09b08 100644 --- a/primitives/rpc/debug/src/proxy/formats/trace_filter.rs +++ b/primitives/rpc/debug/src/proxy/formats/trace_filter.rs @@ -29,7 +29,10 @@ impl super::TraceResponseBuilder for Response { type Listener = Listener; type Response = Vec; - fn build(listener: Listener) -> Option> { + fn build(mut listener: Listener) -> Option> { + // 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 diff --git a/primitives/rpc/debug/src/proxy/v1/mod.rs b/primitives/rpc/debug/src/proxy/v1/mod.rs index 92efdcdda0..42d0a80b9d 100644 --- a/primitives/rpc/debug/src/proxy/v1/mod.rs +++ b/primitives/rpc/debug/src/proxy/v1/mod.rs @@ -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 { + pub fn into_tx_traces(&mut self) -> Vec { + // 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