Add atomic conserved energy and elemental inventory ledger
This commit is contained in:
@@ -86,3 +86,34 @@ competing consumers, long-run rounding, overflow/NaN rejection, cross-tier escro
|
||||
and independently recomputed seeded totals. Baseline metabolism, efficiencies,
|
||||
light attenuation, stoichiometry, heat fidelity and starvation rules remain open.
|
||||
Conservation alone does not guarantee a stable or enjoyable ecosystem.
|
||||
|
||||
## Implemented M2.1 boundary
|
||||
|
||||
[ADR-0024](../adr/0024-conserved-inventory-ledger.md) scopes the initial
|
||||
`evo::accounting` library. Its ledger is independent of particle world state.
|
||||
Opening inventories are explicit; later operations only transfer quantities.
|
||||
Energy is in integer picojoules, disjoint C/N/P/other masses in femtograms.
|
||||
Other contains all unmodeled matter; this is not a complete biochemical basis.
|
||||
All quantities and global per-channel sums must fit u64. No float conversion,
|
||||
division or fractional-rate handling is exposed yet, so there is no rounding loss.
|
||||
|
||||
```cpp
|
||||
// include/evo/accounting/ledger.hpp (contract sketch)
|
||||
auto ledger = Ledger::create(opening_inventories);
|
||||
auto result = ledger->transfer(action_id, ordered_legs);
|
||||
```
|
||||
|
||||
Each leg transfers the same bundle between distinct reservoir IDs. Atomic commit
|
||||
covers the entire ordered transaction and its monotonic action watermark. A
|
||||
rejected transaction consumes nothing, including its ID. A duplicate/older
|
||||
accepted ID is rejected. This is in-memory replay protection, not durable
|
||||
exactly-once delivery. The owner assigns deterministic order; competing consumers
|
||||
are first-funded, with no implicit fair-share or random priority rule.
|
||||
|
||||
Reservoir meaning is caller-owned: source, reserve, substrate, structure, corpse,
|
||||
heat or escrow. The primitive does not enforce chemical reactions or prevent a
|
||||
caller from misclassifying heat as usable energy. M2.2 must provide restricted
|
||||
process operations and finite flux budgets. Never treat conservation as biological
|
||||
validity. There is no import/mint API, organism lifecycle, persisted ledger codec
|
||||
or cross-ledger transaction in M2.1. Persistent integration must checkpoint both
|
||||
inventories and action watermark atomically; M1 snapshots do not include them.
|
||||
|
||||
Reference in New Issue
Block a user