aien-sovereign-core-mv
AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
Brought by drakestapleton
aien-sovereign-core-mv / evidence / aienet0-tur-ledger-20261027 / README.md
| 1 | # Aienet-0 TUR escrow ledger: host evidence (2026-10-27) |
| 2 | |
| 3 | Label: **HOST_TESTED**. One machine (DGX Spark, Linux 7.0.0-1019-nvidia aarch64), no GPU, no network. |
| 4 | Not EXERCISED across two machines; that is the job-path lane's evidence. |
| 5 | |
| 6 | Source commit: `5bd01b6` on `feat/tur-ledger-r1` (the files below are byte-identical at the PR head). |
| 7 | |
| 8 | | Input | sha256 | |
| 9 | |---|---| |
| 10 | | seeded omc (omega-mv `seed/out/omc`, pin e5b32567) | `2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f` | |
| 11 | | `om/vendor/sha256.om` | `323a71e762c0809f07f53c0e6438023e9111ce2acdeda5cb31eef92f2946f000` | |
| 12 | | `om/tur-ledger/tur-ledger.om` | `ad3b61ac7859250e51a9709a7c6d1751f512db7e3606a0ef962b5677634f09e4` | |
| 13 | | `om/tur-ledger/check.sh` | `8632b0c33379bc92c27ad9b5dbd0281df9c433f8f96cde4bc2ba5743fb0fd4db` | |
| 14 | | `tests/turing-network/tur_r0_oracle.om` (#791) | `92b790d4f63ac01c55ca8e8dd0aab5fbebbef5babbe06e30d24c225cf8c23b6f` | |
| 15 | | built binary (`/tmp/an0/bin/tur-ledger`, 37996 bytes) | `6ea978c7f0ae080c6bb0d0254f9fa56b78da2e74d577c092a98cd50bd945be4a` | |
| 16 | |
| 17 | Tools: strace 6.8, util-linux flock 2.39.3, GNU coreutils sha256sum/timeout. |
| 18 | |
| 19 | ## Files |
| 20 | |
| 21 | | File | Command | Result | |
| 22 | |---|---|---| |
| 23 | | `check.out` | `OMC=<seed omc> TUR_LEDGER_OUT=/tmp/an0/bin/tur-ledger bash om/tur-ledger/check.sh` | exit 0, `SUITE PASS` (50 checks), 7 of 7 mutants killed, `TUR_LEDGER gate: PASS` | |
| 24 | | `tur_r0_check.out` | `OMC=<seed omc> sh tests/turing-network/check.sh` | exit 0, `TUR_R0 gate: PASS` (the oracle this ledger follows) | |
| 25 | | `fsync-and-journal.out` | oracle settle under `strace -e trace=pwrite64,fsync,write`, the replayed settle, `audit`, the journal, and each line's HASH recomputed with `sha256sum` | `pwrite64(3, ...)` then `fsync(3) = 0` then `write(1, "settled ...")`; 4 of 4 lines verify | |
| 26 | |
| 27 | `SHA256SUMS` covers the three output files. |
| 28 | |
| 29 | ## What each guard's mutant proves |
| 30 | |
| 31 | Each mutant is the source with one guard removed by `sed`; the same suite must then fail. |
| 32 | |
| 33 | | Mutant | Guard removed | Failing checks in `check.out` | |
| 34 | |---|---|---| |
| 35 | | no-fsync | `fsync` of the journal before the reply | fsync.before-ack | |
| 36 | | no-lock | `flock(LOCK_EX)` for the whole command | concurrent.reserve-20, lock.blocks-while-held | |
| 37 | | no-exactly-once | the settled-JOB branch of settle | oracle.zero-replay, once.*, concurrent.settle-*, crash.kill9 | |
| 38 | | no-hash-chain | HASH and PREV checks during replay | torn.bad-hash-last-line, corrupt.amount-edited | |
| 39 | | no-conservation | the conservation check after replay | conserve.payout-over-escrow, conserve.refused-for-every-command | |
| 40 | | no-escrow-rule | `PAYP + PAYV + BACK = AMOUNT` on live settle | oracle.change-mismatch and the oracle balances | |
| 41 | | no-torn-recovery | torn-tail truncation of the last line | torn.bad-hash-last-line | |
| 42 | |
| 43 | ## Limits |
| 44 | |
| 45 | - The kill -9 run (200 commands, 95 killed, 80 of them after the record was durable) shows that a |
| 46 | process kill at any point leaves a journal that audits clean and settles nothing twice. A kill |
| 47 | cannot tear a single `pwrite`, so torn tails are tested by injecting them (three shapes), not by |
| 48 | power loss. Power-loss durability rests on `fsync` before the reply (strace order), not on a test. |
| 49 | - Arithmetic values come from the #791 oracle (requester 70, provider 27, verifier 3, observer 0, |
| 50 | escrow 0 of 100) and from differential runs (crash journal byte-identical to the control journal). |
| 51 | |
| 52 | ## Authentication v2 addendum (2026-10-28, Core #793) |
| 53 | |
| 54 | The sections above and their three receipts describe unsigned v1. They are preserved byte for |
| 55 | byte and do not qualify admission or authorization. This addendum fixes the findings in |
| 56 | [the full #792 review](https://github.com/aien-dev/aien-sovereign-core-mv/pull/792#issuecomment-6466130214) |
| 57 | forward from main `1604a72b248aba8b0e41e5379814372d8fd59304`. |
| 58 | |
| 59 | **HOST_TESTED**, same Linux ARM64 host, no GPU, production key, live model, network service, |
| 60 | wallet or cryptocurrency. Source: `om/tur-ledger/tur-ledger.om`; native signature verification: |
| 61 | `om/vendor/ec.om`, copied unchanged from omega-mv |
| 62 | `6999fa9e6dae4847c155ef4eacaece74f491d3ca:om/tls/ec.om`, sha256 |
| 63 | `909f37c797e187bd0663bde9f57c75d6ce41eb2c9726a6b50d6fc714e424c060`. |
| 64 | Seeded compiler sha256: |
| 65 | `d6290c7663c2b4bafb59eb3fdf812476e977f4c144def71095c6248ef9b96b84`. |
| 66 | OpenSSL **3.0.13 (30 Jan 2024)** only creates test signatures; it is not linked into, invoked by |
| 67 | or needed to run the ledger. Disposable test private keys were generated in private tmpfs and |
| 68 | removed by the gate. No signer or key-management implementation is shipped here. |
| 69 | |
| 70 | The journal genesis and trusted `authority` config pin the issuer, a distinct verifier, ledger |
| 71 | identity, policy and exact requester/provider/verifier owner-account map. Every external |
| 72 | mutation has a canonical-record issuer signature. Settle additionally requires the verifier to |
| 73 | sign the **same complete authorization**, including reservation commitment, published quote, |
| 74 | exact payout split and signed-job/result/AN0V digests. This follows the design review's decisive |
| 75 | point: "The verifier must sign the complete settlement authorization, including reservation |
| 76 | commitment and payout split, not just result digests." Distinct keys alone are not operational |
| 77 | independence. Complete unauthorized records refuse replay rather than becoming recoverable tails. |
| 78 | Version-1 journals refuse unchanged; reconciliation requires an explicitly provisioned new |
| 79 | ledger identity, never silent migration. |
| 80 | |
| 81 | ### New receipts |
| 82 | |
| 83 | `auth-v2-SHA256SUMS` covers only the new receipts and current source inputs. The original |
| 84 | `SHA256SUMS`, `check.out`, `tur_r0_check.out` and `fsync-and-journal.out` are unchanged. |
| 85 | |
| 86 | | Receipt / command | Observed | |
| 87 | |---|---| |
| 88 | | `auth-v2-before.out`: `OMC=/tmp/ledger-auth-omega/seed/out/omc TUR_LEDGER_AUTH_ONLY=/tmp/ledger-auth-before bash om/tur-ledger/check.sh` | Exit 1: **FAIL auth.unsigned-prefund**, actual ledger exit 0, expected 2; journal changed. Before binary `6ea978c7f0ae080c6bb0d0254f9fa56b78da2e74d577c092a98cd50bd945be4a`, built from main's v1 source and original SHA unit using the same compiler. | |
| 89 | | `auth-v2-after.out`: same command with `TUR_LEDGER_AUTH_ONLY=/tmp/ledger-auth-bin-final` | Exit 0: **PASS auth.unsigned-prefund**, ledger exit 2, unchanged journal. Exactly the same assertion. | |
| 90 | | `auth-v2-check.out`: `OMC=/tmp/ledger-auth-omega/seed/out/omc CRASH_N=200 MUTANT_CRASH_N=0 TUR_LEDGER_OUT=/tmp/ledger-auth-bin bash om/tur-ledger/check.sh` | Exit 0: **SUITE PASS**, **10/10 mutants killed**, **TUR_LEDGER gate: PASS**. Mutant crash trials omitted explicitly; honest-binary crash trials executed. | |
| 91 | |
| 92 | The suite exercised unsigned prefund/reserve/settle/refund refusal; wrong issuer and verifier |
| 93 | keys; altered amount, job, quote, result, signed-job and AN0V digest refusal; account spoofing; |
| 94 | issuer-key substitution for verifier; validly re-signed changed evidence conflicting with an |
| 95 | already-settled job; complete unsigned/wrong-key journal tails; v1 refusal and changed policy. |
| 96 | Each rejection asserts the journal hash is unchanged. The concurrent double-debit control |
| 97 | accepted exactly one reserve with only one unit funded. Honest settle paid provider 27 once; |
| 98 | the same signed semantics replayed as `already-settled`. |
| 99 | |
| 100 | A deterministic strace SIGKILL at stdout-write entry occurred **after fsync, before acknowledgement**; |
| 101 | the gate observed exit 137, successful fsync, an already-settled retry and provider balance 27. |
| 102 | The additional random-delay kill run killed all 200 attempted processes before a new durable |
| 103 | write (durable-before-kill 0). Each was audited and retried, final balances matched the control. |
| 104 | Journal bytes did not match the independently signed control because ECDSA signatures differ. |
| 105 | Do not read this run as 200 post-fsync kills: that boundary is the separate deterministic control. |
| 106 | Injected torn tails test framing recovery, not hardware power loss. |
| 107 | |
| 108 | The full gate compiled source hash |
| 109 | `960f4bb581e3c63cb193ef164736cf5394441ff580515be563b60cc42a53f4af`. |
| 110 | Only its build-instruction and exit-code comments were corrected afterwards: final source |
| 111 | `b188d4c8324eb1d99f9d5e0d08549c54358afca369171974433b456f59ae4ca6`. |
| 112 | Recompilation and `cmp /tmp/ledger-auth-bin /tmp/ledger-auth-bin-final` exited 0; both binaries |
| 113 | hash `d12d05cda56604410b8716602a7e3988a0e90901d28294f04f6ea7d8081f435c`. |
| 114 | The unsigned-after receipt uses that final binary. |
| 115 | |
| 116 | The shared SHA unit changed only its private `hs` state name to `hstate` and its explanatory |
| 117 | header, avoiding a name collision with the vendored EC parameter. Compiling `om/effects/world.om` |
| 118 | with original versus renamed SHA produced byte-identical binaries: |
| 119 | `08e1a63d722250d93dbec0574f902458262eb5e64b0b5e63b2f0eb70f9e3af0d`. |
| 120 | Both executions on `abc`, authorization 2, intent 3, returned 0, state DONE and record digest |
| 121 | `6281e53eed299bdb5467ccbfa7f87ae78c547a08660b9971df362c1680f048d1`. |
| 122 | This is a consumer smoke/parity check, not a claim that its separately pinned full Rust suite ran. |
| 123 | |
| 124 | ### Scope boundary |
| 125 | |
| 126 | There is no `scripts/aienet0/settle-run.sh` or Core ledger RPC in this Core revision. |
| 127 | The external signer must verify the actual signed-job/MJR1/AN0V artifacts and quote/policy before |
| 128 | issuing these typed authorizations. The ledger verifies canonical bytes and signatures, not |
| 129 | those artifact parsers. Mutated-AN0V-digest refusal is **not** an external AN0V parser test; |
| 130 | lost CLI acknowledgement is **not** interrupted-RPC qualification. The application contract is |
| 131 | documented in `om/tur-ledger/README.md`; no compiler or shared guide language feature changed. |
| 132 | No deployment, malicious-filesystem-write/rollback resistance or public economic authority is claimed. |
| 133 | |
| 134 | ## Capacity-discharge addendum (2026-10-28, Core #794) |
| 135 | |
| 136 | An additional review finding was reproduced: the old shared append guard required |
| 137 | four unused key slots even for settlement/refund, which allocate no keys. With a |
| 138 | full production-size signed journal, both commands returned exit 14 and left |
| 139 | existing escrow open. This affects the authenticated source at Core `6a0bfc0` too, |
| 140 | not only the original unsigned implementation. |
| 141 | |
| 142 | Capacity admission now belongs to the two allocating operations. Prefund counts |
| 143 | its new PID and a missing requester; reserve counts its new job and missing |
| 144 | provider/verifier accounts. Both refuse before append if those slots cannot fit. |
| 145 | Existing settlement/refund and authorized identical retries need no new slot. |
| 146 | |
| 147 | The native source exercised for this correction is |
| 148 | `f47d8c6374f5e8a49068cc5372e97582e3eb81e87c5e53a661ea62ebb4279713`; |
| 149 | the production binary is |
| 150 | `afd2fbe7b68a9f5fe44ff67b28830ab2499a482b1a922b237bc1877716a3ef93`. |
| 151 | `capacity-v2-before.out` shows the small-table regression failing before the fix. |
| 152 | `capacity-v2-check.out` records the complete fixed gate: SUITE PASS, twelve |
| 153 | mutants killed, clean capacity refusals, settlement and refund at capacity, |
| 154 | last-slot admission, unchanged duplicate retries, and the existing 200 kill/retry |
| 155 | trials. As in the earlier run, all random-delay kills preceded a new durable |
| 156 | write; the deterministic post-fsync/pre-ack kill remains a separate control. |
| 157 | |
| 158 | `capacity-v2-full.*` preserves a replayable production-size fixture: 65,536 |
| 159 | occupied key slots, valid issuer signatures on all prefunds/reservations and two |
| 160 | open reservations. The old binary returned 14 for both discharge commands; |
| 161 | the fixed binary refused new prefund/reserve with unchanged journal and then |
| 162 | successfully settled one job and refunded the other. These are synthetic |
| 163 | capacity-test authorizations, not receipts for real work or economic credits. |
| 164 | The compressed public journal and signed command vectors contain no private keys. |
| 165 | `capacity-v2-notes.txt` records provisioning, exact replay commands, hashes, |
| 166 | outputs and evidence limits; `capacity-v2-SHA256SUMS` seals these new receipts. |
| 167 | Original receipts and earlier authentication receipts remain unchanged. |
| 168 | |
| 169 | The companion actual-artifact caller migration is |
| 170 | [protocols #67](https://github.com/aien-dev/aien-protocols-mv/pull/67), stacked |
| 171 | on #65. It exercises genuine MJR1 forgery and AN0V countersignature refusal before |
| 172 | the test signers authorize a payout. It does not add a Core RPC or independent |
| 173 | operator qualification. |
| 174 | |
| 175 | ## Independent audit corrections (2026-10-28, Core #794) |
| 176 | |
| 177 | The later audit found additional ledger defects in the authenticated implementation. |
| 178 | `audit-v2-before-final.out` exercises the frozen pre-audit source and exits 1; |
| 179 | `audit-v2-after.out` exercises the corrected source and exits 0. The frozen source |
| 180 | is retained as `audit-v2-before.om.at-run` for reproducible negative controls. |
| 181 | |
| 182 | | Finding | Before | After | |
| 183 | |---|---|---| |
| 184 | | A1, failed fsync then unsynced duplicate | Failed append left a record; retry and all four duplicate kinds could acknowledge without journal fsync | Repeated injected failures return 3 without acknowledgement and restore the original file; every duplicate must sync the actual journal fd and directory before success | |
| 185 | | A2, full key table | Existing settlement and refund returned 14 | New allocations refuse 14 unchanged; existing discharge succeeds even with all 65,536 production slots occupied | |
| 186 | | A3, missing authorities | Original unsigned prefund accepted; settlement lacked issuer/verifier authorization | Native canonical-record issuer/verifier signatures, pinned config/genesis and explicit v1 refusal; the authorization controls still pass | |
| 187 | | A10, complete corrupt final record | Audit could discard an acknowledged settlement as torn and permit refund | Newline-terminated corrupt records refuse 5 unchanged, including a validly signed body with only a bad final hash; only unterminated tails recover | |
| 188 | | A11, fused argv fields | Whitespace inside an argument was silently re-split into accepted fields | Each actual argument is checked before joining; all three fused-field controls refuse 2 unchanged | |
| 189 | | A12, terminal reserve retry | Returned `already-reserved` after settlement or refund | Open retry still succeeds; terminal retries refuse 10 unchanged | |
| 190 | |
| 191 | Final native source: |
| 192 | `8e16f25dd7be21d9dea94252b4ad0ab3b30ac107e4445ed81224d29982e1aadd`. |
| 193 | Final native binary: |
| 194 | `0338edb18a1fba9ecd7fa8ae294045184bfeb2e72530340017ce719acc682768`. |
| 195 | `audit-v2-check.out` records the complete final gate: SUITE PASS, seventeen |
| 196 | guard mutants killed and TUR_LEDGER gate: PASS. It retains 200 random-delay |
| 197 | kill/audit/retry trials (all before a new durable write) and the separate |
| 198 | deterministic post-fsync/pre-stdout kill; these are not RPC or power-loss tests. |
| 199 | |
| 200 | `audit-v2-full-capacity.results.tsv` replays the preserved public production-size |
| 201 | fixture using that final binary: prefund/reserve refuse 14 unchanged, settle and |
| 202 | refund return 0, and `audit-v2-full-capacity.out` reports open 0, settled 1, |
| 203 | refunded 1, balances equal prefunded and escrow 0. No fixture signatures were |
| 204 | reissued and no private keys are included. |
| 205 | |
| 206 | `audit-v2-notes.txt` records commands, individual controls, mutants, pins and |
| 207 | limitations; `audit-v2-SHA256SUMS` seals these later receipts separately. |
| 208 | `audit-v2-omega-tools.txt` records mounted Omega lookups and a sandboxed guard |
| 209 | negative control, explicitly distinguishing that older server pin from the |
| 210 | newer compiler used for the actual ledger gate. The existing application README |
| 211 | was updated; no shared language/compiler/harness contract changed. |