Fixtures
Fixtures are the reproducibility contract of the ecosystem:
Fixture + Environment + Seed + Operation sequence = Reproducible result
Every fixture is versioned machine-readable JSON ("kind", "version": 1)
whose shape is mirrored by JSON Schema files under schemas/. The loader
rejects unknown kinds and unsupported versions.
Fixture kinds
- account — a synthetic identity account (identity + name + account_id).
- token — asset code, ID, issuer, decimals, confidential/registration/ transferable policy.
- environment — a named (seed) configuration a scenario runs under.
- scenario — an environment plus an ordered list of steps:
create_account,create_named_account,create_native_asset,create_confidential_token,register,deposit,merge,transfer,withdraw,snapshot,restore,advance_ledger.
Failure scenarios declare "expected_error": "<code>" and are expected to
end in failure with exactly that code; any other error — or success where
failure was expected — makes the replay itself fail. This is also the shape
of future regression fixtures: bug → fixture → test → permanent
protection.
The canonical corpus
fixtures/
├── accounts/ alice, bob, carol, issuer, auditor
├── tokens/ confidential-token (CCT), native-test-asset (TEST)
├── balances/ confidential-balance state records
├── commitments/ commitment records
├── transactions/ transaction-record fixtures
├── successful/ deposit, transfer, withdrawal, full-lifecycle
└── failures/ insufficient-balance, unregistered-recipient,
double-registration
Environments are not separate files: every scenario fixture embeds the
environment it runs under, so a scenario file alone is a complete repro.
A loader test replays the entire corpus on every run, keeping every checked-in fixture loadable and runnable.
Replaying
#![allow(unused)]
fn main() {
let loaded = load_fixture("fixtures/successful/full-lifecycle.json")?;
if let LoadedFixture::Scenario(scenario) = loaded {
let outcome = run_scenario(&scenario)?; // ScenarioOutcome
}
}
ScenarioOutcome carries the resulting state fingerprint, step /
transaction / event counts, and — for failure fixtures — the error code.
Equal seeds produce equal outcomes (asserted); that is reproducibility in
practice. When a contributor reports “transfer scenario fails”, the fixture
file is the repro.