2.9 KiB
Primitive lives creation-state envelope v1
M11.2b, ADR-0100. Implemented by server::PrimitiveLives::snapshot/restore.
This is a bounded creation-state codec, not yet a published PostgreSQL checkpoint
profile. It supports funded births and their successful retries, not biological
stepping, death, mutation or logout timers. Such state requires a new version
before it is introduced; restoring this format never synthesizes progression.
All integers little endian; no native layouts. Signed coordinates are two's complement i32 micrometres. Inventory is energy followed by C/N/P/other, five u64.
| Header offset | Field |
|---|---|
| 0 | Eight ASCII bytes EVOLIFE1 |
| 8 | u32 format = 1 |
| 12 | u32 founder-life rules = 1 (genome schema 2, development 2) |
| 16, 24, 32, 40 | u64 world, region, frame, source identity |
| 48 | u64 quantum = 50000 microseconds |
| 56 | 40-byte explicit opening funding inventory |
| 96, 100, 104 | u32 site count, retained life count, archive byte length |
| 108 | u32 reserved = 0 |
After the 112-byte header:
- Sites: 8 bytes each, i32 x/y, lexicographic order, nonoverlapping founder squares.
- Life records in site/allocation order, 96 bytes each (offsets relative to record): account bytes (0, 16 bytes), action (16, u64), life/organism/genome/event/born tick (24/32/40/48/56, u64 each), source (64, u64), x/y (72/76, i32), realized growth and damage (80/84, u32), body/reserve reservoir IDs (88/92, u32).
2 + 2 * site_countinventory records: pool, heat, then body/reserve for each site. Unallocated pairs are zero. Saved balances are not replaced by defaults.- Complete canonical LineageArchive bytes, naming its contained schema 2 genomes when nonempty. Empty nursery history remains the archive's canonical empty form.
- u64 FNV-1a64 of every preceding byte (offset 14695981039346656037, multiplier 1099511628211, wrapping). This detects corruption, not forgery; durable publication must additionally protect the payload with SHA-256.
Sites 1..256, lives 0..sites, archive length bounded by biology::max_archive_bytes.
Exact length is 200 + 88 * sites + 96 * lives + archive_bytes; the upper byte
bound follows from those limits. All counts/lengths are checked before allocation.
Unknown format, rule or quantum is refused. Expected world/region/frame must match.
Restore reconstructs a detached nursery from its opening and retained births, checks each resolved life, compares every saved balance and the complete archive, then requires byte-identical re-encoding. Thus duplicated accounts/identities, unfunded bodies, altered reserves, growth, heat, source or archive cannot pass merely by resealing the checksum. No partial result is exposed on failure.
The host must still establish authority, choose the latest committed cut and reconcile durable life/action bindings before readiness. A valid older envelope is not evidence that it is the current world. No session grant is serialized.