Skip to content

fix(config): accept legacy invariant assert_all key#14988

Closed
BROCCOLO1D wants to merge 1 commit into
foundry-rs:masterfrom
BROCCOLO1D:fix/invariant-assert-all-config-warning
Closed

fix(config): accept legacy invariant assert_all key#14988
BROCCOLO1D wants to merge 1 commit into
foundry-rs:masterfrom
BROCCOLO1D:fix/invariant-assert-all-config-warning

Conversation

@BROCCOLO1D

Copy link
Copy Markdown
Contributor

Summary

  • Allows the legacy invariant.assert_all config key in warning validation for both standalone and profile-scoped invariant sections.
  • Adds a regression test covering existing configs that still set assert_all.

Why

invariant.assert_all was introduced as a public config key in #12587, then later removed from the serialized invariant config when invariant campaigns became contract-level. Existing projects now see an unknown-key warning on every forge command even though the config was previously valid.

Changes

  • Adds section-local backward-compatible config keys to the warning provider.
  • Registers assert_all as a backward-compatible invariant key.
  • Tests that [invariant] and [profile.default.invariant] usages do not emit unknown-key warnings.

Validation

  • cargo fmt --check
  • git diff --check
  • cargo test -p foundry-config no_unknown_key_warning_for_legacy_invariant_assert_all
  • cargo test -p foundry-config unknown_key_warning
  • cargo check -p foundry-config

Scope

  • Warning validation only; this does not reintroduce a behavior toggle for invariant campaigns.

Closes #14987

@mablr mablr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for your help @BROCCOLO1D.

But I'm unsure we want assert_all to be accepted as "legacy" since it lived about ten days? Moreover this doesn't address the gas snapshot problem later #14987 (comment)

@BROCCOLO1D

Copy link
Copy Markdown
Contributor Author

Closing this based on maintainer feedback: accepting assert_all as a legacy key does not look like the right direction, and the gas snapshot regression is being handled separately in #14990. Happy to revisit if a compatibility shim is still desired.

@BROCCOLO1D BROCCOLO1D closed this May 31, 2026
@github-project-automation github-project-automation Bot moved this to Done in Foundry May 31, 2026
@BROCCOLO1D BROCCOLO1D deleted the fix/invariant-assert-all-config-warning branch June 1, 2026 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Warning: Found unknown assert_all config key in section invariant defined in foundry.toml.

2 participants