Skip to content

feat: prepare invariant campaigns for sharding#14905

Merged
grandizzy merged 13 commits into
foundry-rs:masterfrom
0xKarl98:invariant-campaign-refactor
May 26, 2026
Merged

feat: prepare invariant campaigns for sharding#14905
grandizzy merged 13 commits into
foundry-rs:masterfrom
0xKarl98:invariant-campaign-refactor

Conversation

@0xKarl98
Copy link
Copy Markdown
Contributor

@0xKarl98 0xKarl98 commented May 25, 2026

On first step for OSS-273 ,

Adds the minimal structure needed to treat an invariant contract as one logical campaign that can later be split across workers.

The execution path is still single-worker. This PR only introduces the campaign/worker/result boundary so future PRs can partition runs across --jobs workers and merge worker outputs back into one contract-level invariant result without changing user-facing behavior

cc @grandizzy @mattsse @figtracer @mablr

Comment thread crates/evm/evm/src/executors/invariant/campaign.rs
Comment thread crates/evm/evm/src/executors/invariant/campaign.rs Outdated
Comment thread crates/evm/evm/src/executors/invariant/error.rs Outdated
Comment thread crates/evm/evm/src/executors/invariant/error.rs Outdated
Comment thread crates/evm/evm/src/executors/invariant/campaign.rs Outdated
@0xKarl98 0xKarl98 requested review from figtracer and mablr May 25, 2026 14:10
@0xKarl98
Copy link
Copy Markdown
Contributor Author

@mablr @figtracer have addressed your concerns , ptal again

Comment thread crates/evm/evm/src/executors/invariant/campaign.rs Outdated
@0xKarl98 0xKarl98 marked this pull request as draft May 25, 2026 15:34
@0xKarl98 0xKarl98 marked this pull request as ready for review May 26, 2026 02:00
@0xKarl98 0xKarl98 requested a review from figtracer May 26, 2026 02:00
mattsse
mattsse previously approved these changes May 26, 2026
Copy link
Copy Markdown
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

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

since we're here let's first cleanup the suite test outcome, e.g. when running with show-progress there's still the invariant anchor which is no longer needed, see below - there are multiple invariant fns defined in each contract (see https://github.com/grandizzy/invariant-output to test / try)

Image

Then same on output, the invariant_stakingSolvent should be replaced by contract name maybe?

Image

Also, the BuggyBank contract with 4 invariants, designed with 3 passing and one failed:

  • ✅ invariant_actorsRegistered
  • ✅ invariant_bankHoldsNoEth
  • ✅ invariant_countersMatchHandlerActivity
  • ❌ invariant_ledgerConserved (fails by design)

the output is misleading and quite hard to interpret as all invariants are marked failed. It also shows the invariant table metrics several times instead only one time as in case of success.

image

@0xKarl98 0xKarl98 requested a review from grandizzy May 26, 2026 06:13
grandizzy
grandizzy previously approved these changes May 26, 2026
Copy link
Copy Markdown
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

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

lgtm!

Comment thread crates/evm/evm/src/executors/invariant/campaign.rs Outdated
@0xKarl98 0xKarl98 dismissed stale reviews from grandizzy and mattsse via 6c55135 May 26, 2026 06:36
@grandizzy grandizzy requested review from grandizzy and mattsse May 26, 2026 06:43
@grandizzy grandizzy enabled auto-merge (squash) May 26, 2026 06:43
Copy link
Copy Markdown
Collaborator

@mablr mablr left a comment

Choose a reason for hiding this comment

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

Nice

@grandizzy grandizzy merged commit 9b8eb09 into foundry-rs:master May 26, 2026
19 checks passed
@github-project-automation github-project-automation Bot moved this to Done in Foundry May 26, 2026
@0xKarl98 0xKarl98 deleted the invariant-campaign-refactor branch May 26, 2026 10:07
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.

5 participants