Skip to content

fix(script): allow --verify without --broadcast, preserving console logs#13453

Open
omair445 wants to merge 1 commit intofoundry-rs:masterfrom
omair445:fix/verify-console-logs
Open

fix(script): allow --verify without --broadcast, preserving console logs#13453
omair445 wants to merge 1 commit intofoundry-rs:masterfrom
omair445:fix/verify-console-logs

Conversation

@omair445
Copy link
Copy Markdown

Problem

When running forge script with --verify but without --broadcast, console.log output was suppressed. The --verify flag had a hard requires = "broadcast" constraint in clap, and was also included in should_broadcast(), meaning it couldn't be used standalone for dry-run simulation.

Developers debugging their scripts with --verify expected to see console logs regardless of whether they were actually broadcasting.

Fix

  • Remove the requires = "broadcast" constraint from the --verify arg so it can be passed independently
  • Remove self.verify from should_broadcast() so that --verify alone follows the normal simulation path (traces + console logs + "SIMULATION COMPLETE" message)
  • When both --verify and --broadcast are used together, behavior is unchanged

Test

Updated the existing test to verify that --verify without --broadcast now succeeds and prints console logs.

Fixes #11009

Previously, `--verify` required `--broadcast` and was included in
`should_broadcast()`, which meant passing `--verify` alone was rejected
by clap. This caused confusion when developers wanted to do a dry-run
with `--verify` and still see their console.log output.

Remove the `requires = "broadcast"` constraint from `--verify` and
exclude it from `should_broadcast()` so that `--verify` without
`--broadcast` follows the normal simulation path — printing traces,
return values, and console logs as expected.

Fixes foundry-rs#11009
@omair445
Copy link
Copy Markdown
Author

Hey everyone, I am very very sorry I got stuck in work-related stuff and haven't been able to follow up on this. I am happy if anyone else can take care of this from here or if the maintainers want to push the final bits. Apologies again for the delay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

forge script --verify suppresses console logs if not broadcasted

1 participant