Skip to main content

Module assertions

Module assertions 

Source
Expand description

Reusable checks over the artefacts a turn produces.

Every helper returns a typed AssertionFailure instead of panicking, so it composes inside a proptest, inside an exploration model, or inside a production self-check. Call sites in #[test] code usually end in .expect(...); call sites in library code can branch on the failure.

The checks cover the properties spec §27.2 asks for by name:

  • no high-risk command executes without a trusted origin (I12);
  • no receipt claims an outcome the ledger does not back (I16);
  • a projection carries exactly one phase (§8.4);
  • one case resolves to the same phase in two projections, which is what “one phase” means for a case rather than for a view (I3);
  • two renderings of the same turn produce the same ordered blocks, which is what “reload returns the same blocks” means (§27.4, scenario 18).

Enums§

AssertionFailure
A check did not hold.

Functions§

identical_blocks
Checks that two assistant turns carry identical blocks in identical order.
no_high_risk_without_trusted_origin
Checks that no command in batch executes above RiskClass::ReversibleLowRisk, or under any confirmation policy, without a trusted origin.
origin_satisfies_policy
Checks one envelope against one policy (I12).
receipts_backed_by_events
Checks that every receipt cites at least one event and only events the commit really produced (I16).
same_phase_in
Checks that one case resolves to the same phase in two projections (I3).
single_phase
Checks that a projection carries exactly one phase (§8.4).