Blog · 2026-06-07 · Michael Moffett

cf-invariants on Starknet Sepolia — twelve references, paired clean/planted CI green.

The cf-invariants reference suite grew from six Cairo references to twelve on 2026-06-04. Six new contract families joined the set — lending, staking, vesting, timelock, payment splitter, oracle — each with its own invariant class and a planted-bug twin. Three days later, a paired GitHub Actions matrix went green: every reference is now asserted as clean=0 on its clean variant and planted≥1 on its planted variant, with a Caracal static-analysis pre-flight running alongside. Twenty-six CI jobs, twelve Voyager-verified Sepolia deployments, Apache-2.0.

The suite at twelve

Six new contract families — the most-shipped Cairo shapes not in the original six.

The Day-1 launch post stood up cf-invariants as a Rust sidecar that adds stateful invariant testing on top of snforge for Cairo 2.x, with three Voyager-verified references on Starknet Sepolia. The three-to-nine expansion took the suite to nine on 2026-06-02. As of 2026-06-04 the suite is twelve. The six new families fill in the most-shipped Cairo shapes the original six did not cover.

The original six (per git ls-tree 679a5ac references/ at the OSS-launch commit on 2026-06-01): erc20_planted_bug, erc4626_ref, erc721_ref, governance, multisig_ref, single_side_amm. The six added in this expansion: lending_ref, oracle_ref, payment_splitter_ref, staking_ref, timelock_ref, vesting_ref. All twelve are on-chain on Starknet Sepolia and Voyager source-verified, with addresses + verification links in STARKNET_SEPOLIA_DEPLOYMENTS.md.

One invariant, one planted bug per new family

Each reference is small enough to read end-to-end.

The discipline that carried the original six carries through here: a single hand-authored or AI-proposed invariant per reference, a single planted bug sitting at named lines in src/lib.cairo, and an scorecard.expected.md that names what the harness is expected to surface on the buggy variant.

Each reference is a single src/lib.cairo plus a single tests/cf_invariant_….cairo driver. The corrected line in each planted variant is preserved in a comment block at the end of the function, so the diff between clean and planted is one paragraph long and readable on a phone.

The CI green light

Paired clean/planted across all twelve, plus a Caracal pre-flight.

The repo did not have a GitHub Actions workflow when the three-to-nine expansion shipped — the proof was local snforge test output plus the Voyager verification links. The first end-to-end CI workflow landed on 2026-06-04 and went green on run 26971094124 at commit 5ac98a9, 13/13 jobs. That first shape asserted the planted leg only: every reference's snforge test was expected to exit non-zero with the INVARIANT VIOLATED marker on stdout. It did not yet assert that the clean twin runs clean.

That gap closed on 2026-06-07 when PR #2 squash-merged. The PR adds a clean scarb feature to every reference's Scarb.toml and a CLEAN_TWIN: bool const gated on #[cfg(feature: 'clean')] in each contract module, so the same source tree compiles in two variants. CI now runs a 24-leg matrix (twelve references × two variants), plus the Rust workspace tests and a Caracal static-analysis pre-flight job in advisory mode. The expectation per leg:

Run 27075213962 at commit 003e33c is 26 of 26 green: the workspace job, the Caracal advisory job, and the 24 reference legs. The workflow file is .github/workflows/ci.yml and is the substantive reference an external Cairo dev can lift. The clean-variant convention — one clean scarb feature gating one CLEAN_TWIN branch per reference — is the pattern the snforge docs PR #4409 (opened 2026-06-04, pending first-time-contributor maintainer approval) proposes for upstream as a worked recipe. The PR is opened, not merged; the CI on it is pending maintainer approval.

The sibling ship

Third real Jito program harnessed on the same Crucible rails.

One day after the suite expansion, cf-invariants-jito-priorityfee went public — the third real Jito Foundation program harnessed on Crucible, on the same anchor-lang 1.0.1 / platform-tools v1.52 / Crucible v0.2.0 rails as cf-invariants-jito (tip-distribution) and cf-invariants-jito-tippayment (tip-payment). One hand-authored invariant (transfer_increments_total_state_update), paired clean/planted, CI green on the first push at commit a32c1d3, run 26919123180. Three Jito programs, one rail — the specialization-velocity claim as an existence proof, not a forecast. Bundled hand-off via Jito intro issue #163 (opened 2026-06-04, awaiting maintainer reply).

What this is not

Not a fork. Not an audit. Not autonomous discovery. Not formal verification.

Four framings each repo's README is explicit about, mirrored here so this post does not drift:

Repo: github.com/caliperforge/cf-invariants. Sepolia deployment + Voyager verification index: STARKNET_SEPOLIA_DEPLOYMENTS.md. Apache-2.0. Issues and PRs are open.

— Michael Moffett. Built with AI assistance; the harness scaffolds, the reference fixtures, and the AI-suggester orchestration were drafted with an AI coding assistant under operator review, with full repo attribution. AI policy at caliperforge.com/ai-disclosure.