Skip to content

feat(forge/script): decode execution traces when --json is enabled #10109

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

0xpanoramix
Copy link

@0xpanoramix 0xpanoramix commented Mar 18, 2025

Motivation

This PR resolves #10019.

More precisely, it ensures that the execution traces are decoded when the --json flag is enabled for the forge script command.
With those changes, the command prints all the decoded values and not just null.

Solution

I forced the decoding of the traces after the execution has completed, right before the result object is encoded in JSON and printing to the stdout.

Note: I updated the existing CLI test.

PR Checklist

  • Added Tests

decode_trace_arena(trace, decoder).await?;
}

let result_with_decoded_traces = &ScriptResult {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a #[derive(Clone)] to ScriptResult, clone it and then modify result.traces directly

Copy link
Author

@0xpanoramix 0xpanoramix Apr 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, changed in 8f6d3b9.

@DaniPopes
Copy link
Member

Thanks, just one nit. Sorry for the late review.

@0xpanoramix 0xpanoramix requested a review from DaniPopes April 30, 2025 08:51
@0xpanoramix 0xpanoramix force-pushed the 0xpanoramix/decode-traces-for-json-script-output branch from 5390c66 to a2cc43b Compare May 23, 2025 13:40
Copy link
Member

@zerosnacks zerosnacks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! pending final check by @DaniPopes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Ready For Review
Development

Successfully merging this pull request may close these issues.

feat(forge script): add --json output support
3 participants