Skip to content

Conversation

@DeVikingMark
Copy link
Contributor

Problem

forge script --verify without --broadcast fails with "Deployment not found for chain" error because it tries to load non-existent deployment files.

Solution

  • Remove problematic condition that attempts to resume when --verify is used without --broadcast
  • Add validation to require --broadcast when using --verify
  • Provide clear error message: "The --verify flag requires --broadcast to be specified"

Changes

  • crates/script/src/lib.rs: Fix logic and add validation
  • crates/forge/tests/cli/script.rs: Add test case

Fixes #11726

Comment on lines 252 to 256
if compiled.args.verify && !compiled.args.should_broadcast() {
eyre::bail!(
"The --verify flag requires --broadcast to be specified. Verification without broadcasting is not meaningful."
);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

you can do this with requires on verify: https://docs.rs/clap/latest/clap/struct.Arg.html#method.requires

@onbjerg onbjerg self-assigned this Sep 23, 2025
Copy link
Contributor

@onbjerg onbjerg left a comment

Choose a reason for hiding this comment

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

Please look into the failing tests:)

@onbjerg
Copy link
Contributor

onbjerg commented Oct 6, 2025

Ping @DeVikingMark, some of the tests are failing because the help output of forge script changed as a result of the changes in this PR :) Can you take a look so we can get this merged?

Comment on lines 3255 to 3269
[..] → new Counter@0x5FbDB2315678afecb367f032d93F642f64180aa3
[96345] → new Counter@0x5FbDB2315678afecb367f032d93F642f64180aa3
└─ ← [Return] 481 bytes of code
[..] Counter::increment()
[22418] Counter::increment()
Copy link
Contributor

Choose a reason for hiding this comment

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

please change this to dots again (the gas usage isn't relevant):)

@onbjerg
Copy link
Contributor

onbjerg commented Oct 20, 2025

tests are still failing ptal

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

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

bug(forge script): passing --verify without --broadcast results in: Deployment not found for chain <chain_id>

3 participants