60 lines
3.8 KiB
Markdown
60 lines
3.8 KiB
Markdown
# Environmental community envelope v1 (M6.5c)
|
|
|
|
## Version 2 extension (M6.6, ADR-0056)
|
|
|
|
Format 2 requires rules 2; format 1 requires rules 1. The v1 layout below is
|
|
unchanged. In v2 append decay[10] to config (39 u64 total), consumer_terminal
|
|
to each progress (7 u64; anchor 37 u64), terminal[2] after each input's bite,
|
|
and consumer_transition plus decomposed[10] after each report's terminal_transition.
|
|
Each v2 receipt is 38 u64 (304 bytes). Fixed overhead is 712 bytes plus receipts
|
|
and nested resource bytes. Lifecycle flags are 0/1; decomposed uses source field
|
|
order. Both versions replay their own rules. V1 rejects nonzero extension fields
|
|
at creation/input validation; they are not silently omitted. No conversion API.
|
|
Terminal accounts may retain balances in v2; v1 retains its empty-terminal rule.
|
|
Caps are whole fg/pJ per tick, not rates requiring fractional carry. Remaining
|
|
corpse inventory resides in nested resource accounts, never duplicated here.
|
|
|
|
## Version 1 layout
|
|
|
|
Authority ADR-0055. All integers little-endian, no native struct serialization.
|
|
Header u64 magic 0x3150434f564541, u64 format=1, u64 total bytes. Maximum 1 MiB.
|
|
Then config, current progress, audit anchor, u64 receipt count, chronological
|
|
receipts, u64 coupled resource payload length, resource v1 bytes, trailing FNV-1a64
|
|
checksum of all previous bytes. FNV detects corruption, not hostile forgery.
|
|
|
|
Config fields are u64 in public declaration order: rules, world, frame, producer,
|
|
consumer, source, tick_microseconds, area_um2, irradiance_numerator/denominator,
|
|
efficiency, growth_numerator/denominator, growth_cost, recipe[5] (W/C/N/P/O),
|
|
intake[5] (C/N/P/O/E), assimilation, producer_min/max_mK, consumer_min/max_mK.
|
|
Site is the unique nested field site; it is not independently defaulted on restore.
|
|
Progress: tick, source_remainder, last_funded, efficiency_remainder,
|
|
growth_remainder, producer_terminal (0/1). Consumer has no terminal transition in
|
|
v1; its sole supported state is active, encoded by rules v1 rather than an unused flag.
|
|
Anchor: environment[10], producer[10], consumer[10], then progress.
|
|
Each receipt: input (temperature_mK, source_enabled 0/1, bite[5]), report
|
|
(tick,captured,retained,capture_heat,grown,unmet,source_status 0/1/2,
|
|
assimilated[5],waste[5],terminal_transition 0/1).
|
|
|
|
Require receipt count=min(tick,64), ticks contiguous ending at current tick, anchor
|
|
tick=current tick-count. Validate anchor capacities, per-element totals, source and
|
|
growth residuals, source interval watermark, lifecycle bounds. Replay retained inputs
|
|
from the audit anchor with immutable config and current capacities; every report
|
|
must match and final balances/progress must equal the nested checkpoint/current
|
|
progress. This audit copy is historical state, never another spendable inventory.
|
|
At tick0, progress and history are empty. No missing rate data is defaulted.
|
|
|
|
Only a pristine resource owner with one field site, one resident terrain chunk,
|
|
all ten fields, two ordered accounts and zero command history is admitted. Process
|
|
restore separately requires checkpoint command/adoption=tick and empty transfer
|
|
history. Bare resource snapshots are not process envelopes. No live migration API.
|
|
|
|
One-site staging uses fixed scalar arrays; replacing scalar field baselines allocates
|
|
nothing. Charge sizeof(process owner), owned resource resident bytes and 64KiB
|
|
process scratch plus the resource owner's separate 64KiB scratch before admission/restore. Query/snapshot caller buffers and allocator headers
|
|
are excluded. Snapshot construction temporarily holds nested bytes plus output,
|
|
bounded by 2MiB; host must provide that additional output allowance. No terrain clone
|
|
or codec buffer is allocated by advance. Restore replay is bounded to 64 steps.
|
|
|
|
Codec and transitions are single-owner, in-memory operations. No disk publication,
|
|
region lease, external energy import, player login or offline progression exists.
|