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

Improve forge script --json output and handling of --silent #7817

Open
zerosnacks opened this issue Apr 30, 2024 · 0 comments
Open

Improve forge script --json output and handling of --silent #7817

zerosnacks opened this issue Apr 30, 2024 · 0 comments
Labels
T-feature Type: feature

Comments

@zerosnacks
Copy link
Member

Component

Forge

Describe the feature you would like

Currently when passing the --json flag the following is returned:

#[derive(Serialize, Deserialize)]
struct JsonResult {
logs: Vec<String>,
gas_used: u64,
returns: HashMap<String, NestedValue>,
}

It would be beneficial to return more information, as defined by ScriptResult

#[derive(Default)]
pub struct ScriptResult {
pub success: bool,
pub logs: Vec<Log>,
pub traces: Traces,
pub debug: Option<Vec<DebugArena>>,
pub gas_used: u64,
pub labeled_addresses: HashMap<Address, String>,
pub transactions: Option<BroadcastableTransactions>,
pub returned: Bytes,
pub address: Option<Address>,
pub breakpoints: Breakpoints,
}

In turn it would also be useful to define a JSON schema for the output (#7813)

I've also noticed that alongside the JSON a lot of other lines are written to stdout making it difficult to cleanly capture the output. If --silent is passed and the --json flag is enabled only the JSON should be returned. It appears --silent is currently only applied to the compilation output during the build phase.

Additional context

No response

@zerosnacks zerosnacks added the T-feature Type: feature label Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-feature Type: feature
Projects
None yet
Development

No branches or pull requests

1 participant