loom_snapshot 0.1.2

Deterministic, cross-language world-state snapshot + replay anchor for the Loom Engine.
Documentation
  • Coverage
  • 100%
    13 out of 13 items documented0 out of 8 items with examples
  • Size
  • Source code size: 20.74 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 433.55 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 6s Average build duration of successful builds.
  • all releases: 6s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • sadhaka/loom-engine
    6 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • sadhaka

loom_snapshot - deterministic, cross-language world-state snapshot hash (Rust core).

The native sibling of the TS world-state-snapshot.ts. v3.0 Phase 1 of the Living Persistent World: a world state reduces to a state_hash that is BYTE-IDENTICAL across TypeScript, Python, and Rust, so a snapshot at a known event index can be persisted compactly, verified against the HMAC event chain on resume, and compared across languages to prove no surface diverged.

REUSE, not re-implementation. The hash rides loom_events' audited, golden-vector-pinned primitives: state_hash = hmac_sha256_hex(key, field(SNAPSHOT_DOMAIN) + field(canonical_json(state))) so it inherits cross-language byte-parity for free and adds no new canonical or crypto surface. Parity is proven by the shared golden vector (test_vectors/v3_0_snapshot_canonical.json), which is generated by the real TS and asserted here byte-for-byte.

DESIGN (reconciled with the Pantheon, matches the TS module):

  • The state_hash is a PURE content hash; the event index is version metadata stored alongside in WorldStateSnapshot, never folded into the hash.
  • ONE sort rule everywhere: UTF-16 code units. Object keys are sorted by canonical_json (UTF-16); normalize_tags sorts tags by the SAME comparator (encode_utf16), NOT Rust's native str Ord (UTF-8 bytes).
  • Fail-closed: canonical_json returns Err(CanonError) on any non-canonical value (non-integer / -0 / unsafe-int / __proto__ / over-depth) before a hash is produced.

Domain separation: SNAPSHOT_DOMAIN is distinct from the event-chain record ("loom.chain.rec/1") and seal ("loom.chain.seal/1") domains, so a snapshot hash can never be reinterpreted as a chain-record signature.