Skip to content
Playground(another site)

bynk.history.restates_invariant

Error A history property merely re-checks a guarantee a declared invariant/transition already enforces on every reached state (testing track slice 7, ADR 0155).

Every state a driven run reaches has already passed the agent's invariant and transition checks, so a history property that only asserts the same thing over run cannot fail. The compiler flags it, and the check is deliberately narrow, so a near-copy may pass. Assert something the per-state rules do not say, such as a protocol across steps: a spend is accepted only after a top-up.

Example

demo/wallet.bynk
invariant nonneg: balance >= 0
// tests/t.test.bynk
for all run: History[Wallet] { expect run.all((s) => s.new.balance >= 0) } // ✗ the invariant says this
for all run: History[Wallet] { expect run.all((s) => (s.call is Spend && s.accepted) implies run.upTo(s).any((p) => p.call is TopUp && p.accepted)) } // ✓ a protocol across steps

In the Book

See also

  • Every code in its category, History properties, on the diagnostic index.
  • bynk explain bynk.history.restates_invariant shows the same from the installed toolchain, without a network.