Skip to content
Playground(another site)

bynk.invariant.cross_agent_reference

Error An invariant predicate references another agent; invariants are per-agent.

An invariant is checked inside one agent's commit, against that agent's own state. Reading another agent would mean a call out to it, whose value could change before the commit lands, so the claim could not be held. A property that spans agents belongs in a saga or a scenario. Keep the invariant to this agent's fields. The mirror rule for steps is bynk.transition.cross_agent_reference.

Example

invariant within_total: count <= Total("all").get() // ✗ reads another agent
invariant non_negative: count >= 0 // ✓ this agent's own state

In the Book

See also

  • Every code in its category, Other, on the diagnostic index.
  • bynk explain bynk.invariant.cross_agent_reference shows the same from the installed toolchain, without a network.