From 694945ab568cc6a1aec958e01fae5ac2a22eefdc Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Mon, 12 Feb 2024 21:34:27 +0100 Subject: [PATCH] chore: don't decode traces if they're not going to be included --- crates/forge/bin/cmd/test/mod.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/crates/forge/bin/cmd/test/mod.rs b/crates/forge/bin/cmd/test/mod.rs index 1a8cf9eed418..af8abc3493d3 100644 --- a/crates/forge/bin/cmd/test/mod.rs +++ b/crates/forge/bin/cmd/test/mod.rs @@ -416,9 +416,6 @@ impl TestArgs { // Decode the traces let mut decoded_traces = Vec::with_capacity(result.traces.len()); for (kind, arena) in &mut result.traces { - decoder.identify(arena, &mut local_identifier); - decoder.identify(arena, &mut etherscan_identifier); - // verbosity: // - 0..3: nothing // - 3: only display traces for failed tests @@ -433,10 +430,14 @@ impl TestArgs { } TraceKind::Deployment => false, }; - - if should_include { - decoded_traces.push(render_trace_arena(arena, &decoder).await?); + if !should_include { + continue; } + + decoder.identify(arena, &mut local_identifier); + decoder.identify(arena, &mut etherscan_identifier); + + decoded_traces.push(render_trace_arena(arena, &decoder).await?); } if !decoded_traces.is_empty() {