aien-protocols-mv
Canonical specifications, wire protocols, and schemas for the AIEN sovereign ecosystem
Brought by drakestapleton
aien-protocols-mv / specs / aienet / jobpath / PROFILE.md
| 1 | # Aienet-0 P0 job path profile (matmul_u32 over MJB1/MJR1) |
| 2 | |
| 3 | Status: IMPLEMENTED and EXERCISED on two machines (DGX Spark requester and |
| 4 | verifier, MacBook Air M2 worker) on 2026-10-28. Evidence: |
| 5 | `evidence/aienet0-20261028/`. Profile version 1. |
| 6 | |
| 7 | This profile is the job half of the Aienet-0 P0 interop profile |
| 8 | (`specs/aienet/P0_INTEROP_PROFILE.md`, PR #63). It reuses MJB1/MJR1 and the |
| 9 | `aien-microjob` reader, validator and `DagRun` receipt ledger (PR #53), |
| 10 | with the audit corrections below, and the Open Humanity signed, encrypted transport |
| 11 | (`aien-dev/open-humanity`, `oh-core::transport`). It adds no wallet, no |
| 12 | currency, no compiler and no remote execution: the worker runs one |
| 13 | allowlisted, integer-exact function and nothing else. |
| 14 | |
| 15 | Code: `crates/aien-microjob/src/aienet0.rs` (profile records and checks), |
| 16 | `specs/aienet/jobpath/matmul_u32_recompute.om` (the verifier's independent |
| 17 | recompute, built by `build.sh` with the pinned seed-born `omc`), and in |
| 18 | open-humanity `crates/oh-core/src/carrier.rs`, |
| 19 | `crates/oh-coordinator/src/bin/aienet0-run.rs`, |
| 20 | `crates/oh-volunteer/src/bin/aienet0-serve.rs`. |
| 21 | |
| 22 | ## Roles and pins |
| 23 | |
| 24 | | Role | Machine | Keys it holds | Keys it pins out of band | |
| 25 | |---|---|---|---| |
| 26 | | submitter + verifier (`aienet0-run`) | Spark | transport Ed25519 seed, submitter P-256, verifier P-256 | worker transport Ed25519, executor P-256 | |
| 27 | | worker (`aienet0-serve`) | enrolled machine | transport Ed25519 seed, executor P-256 | coordinator transport Ed25519, submitter P-256 | |
| 28 | |
| 29 | Nothing is trusted on first use. Every key a peer presents is compared with |
| 30 | the pinned key before anything that depends on it. |
| 31 | |
| 32 | ## The job: `matmul_u32` |
| 33 | |
| 34 | The only allowlisted kind. Payload and digest are Core PR #662 |
| 35 | `crates/aien-hetjob/src/task.rs` byte for byte. |
| 36 | |
| 37 | - Payload, 15 bytes: kind `0x01`, `m`, `k`, `n` (u16 BE), `seed` (u64 BE). |
| 38 | - `A` (`m x k`) then `B` (`k x n`) are drawn from splitmix64(`seed`), each |
| 39 | output truncated to u32. `C = A x B` mod 2^32. |
| 40 | - Output digest: SHA-256(`"AIEN-HETJOB-MATMUL-U32-V1"` || m || k || n || seed |
| 41 | || C as u32 BE, row-major). |
| 42 | - Bounds: each of `m`, `k`, `n` in 1..=256. |
| 43 | |
| 44 | ## Bundle `AN0B` (requester to worker) |
| 45 | |
| 46 | | Offset | Bytes | Field | |
| 47 | |---|---|---| |
| 48 | | 0 | 4 | `AN0B` | |
| 49 | | 4 | 1 | version `1` | |
| 50 | | 5 | 1 | reserved `0` | |
| 51 | | 6 | 2 | payload length (u16 BE, <= 256) | |
| 52 | | 8 | 4 | document length (u32 BE) | |
| 53 | | 12 | 33 | submitter P-256 key (compressed) | |
| 54 | | 45 | 64 | submitter signature (P-256, low-S, r||s) | |
| 55 | | 109 | plen | payload | |
| 56 | | 109+plen | dlen | MJB1 document | |
| 57 | |
| 58 | The signature covers `"AIENET0-MJB1-SUBMIT-V1\0"` || `dag_digest(document)` |
| 59 | || SHA-256(payload). MJB1 itself carries no submitter signature; this |
| 60 | detached signature is the profile's answer to that gap, and the MJB1 |
| 61 | `approval_ref` names it: SHA-256(`"AIENET0-APPROVAL-V1\0"` || submitter key || |
| 62 | nonce). |
| 63 | |
| 64 | The document is one MJB1 node: kind COMPUTE, op MATMUL, verifier RECOMPUTE, |
| 65 | effect COMPUTE, retry NEVER, one attempt, one CONTENT operand whose digest is |
| 66 | SHA-256(payload), no deps, time 120000 ms, work = fuel = m·k·n, memory = |
| 67 | 4(mk + kn + mn) bytes, `expires_at` = issue time + 3600 s. |
| 68 | |
| 69 | ## Worker admission (`admit_bundle`, then the replay set) |
| 70 | |
| 71 | In order, each a distinct refusal: |
| 72 | |
| 73 | 1. Well-formed bundle (`AN0_BAD_BUNDLE`). |
| 74 | 2. Submitter key equals the pinned key and its signature verifies |
| 75 | (`AN0_BAD_SUBMITTER`). |
| 76 | 3. MJB1 decodes and validates (`MJB_*`); header and node are not expired |
| 77 | at the receiver's clock (`MJB_BAD_EXPIRY`). |
| 78 | 4. Exactly one node of the allowlisted shape above (`AN0_NOT_ALLOWLISTED`). |
| 79 | 5. The operand names this payload (`AN0_PAYLOAD_MISMATCH`). |
| 80 | 6. The payload kind is `matmul_u32` (`AN0_NOT_ALLOWLISTED`). |
| 81 | 7. Dimensions within bounds, node work/fuel/memory caps cover the job, and |
| 82 | the header fuel budget covers the job (`AN0_OVER_BUDGET`). |
| 83 | 8. `dag_digest` never admitted before (`AN0_REPLAY`). The worker appends it |
| 84 | to `state/seen` and fsyncs before executing, so a crash cannot re-run it. |
| 85 | |
| 86 | The worker then runs the kernel and returns an MJR1 COMPLETED receipt signed |
| 87 | by its executor key, with `verifier_verdict` = SHA-256( |
| 88 | `"AIENET0-RECOMPUTE-MATCH-V1\0"` || dag_digest || job_id || output digest), |
| 89 | `source_hash` = SHA-256 of the worker binary and `policy_hash` = SHA-256 of |
| 90 | its admission policy text. |
| 91 | |
| 92 | ## Verifier (`aienet0-run`) |
| 93 | |
| 94 | 1. `check_receipt`: the receipt passes `DagRun::admit` + `apply` with only the |
| 95 | pinned executor key trusted, is new, and leaves the node DONE (`MJB_*`, |
| 96 | `AN0_REPLAYED_RECEIPT`). |
| 97 | 2. Recompute: the Omega program, pinned by SHA-256 of its binary |
| 98 | (`AN0_RECOMPUTE_UNPINNED`), reads the payload and prints the digest. |
| 99 | 3. `countersign`: the receipt's output digest equals the recompute |
| 100 | (`AN0_RECOMPUTE_MISMATCH`) and its verdict commitment equals the rebuilt |
| 101 | one (`AN0_VERDICT_MISMATCH`); then the verifier signs. |
| 102 | 4. Writes `<dag>.an0b`, `<dag>.mjr1`, `<dag>.mjv` (tmp, fsync, rename, dir |
| 103 | fsync; an existing output is refused) and prints |
| 104 | `VERIFIED <dag_id> <mjr1_sha256> <mjr1_path>`. |
| 105 | |
| 106 | MJR1 has one signature slot, used by the executor. The verifier's signature |
| 107 | is the detached record below. |
| 108 | |
| 109 | ## Escrow order (TUR ledger, aien-sovereign-core #792) |
| 110 | |
| 111 | `aienet0-run bundle` signs a job without sending it and prints |
| 112 | `BUNDLE <dag_id> <path>`; escrow is reserved on that dag_id; `aienet0-run run |
| 113 | --resend <path>` then sends exactly those bytes. The worker's replay set |
| 114 | holds only bundles it has admitted, so the first send is not a replay. On |
| 115 | `VERIFIED <dag_id> <mjr1_sha256> ...` the requester settles |
| 116 | `settle <dag_id> <mjr1_sha256> PAYP PAYV BACK` once (a repeat is |
| 117 | `already-settled` and writes nothing); on any other outcome it refunds and |
| 118 | never settles. `scripts/aienet0/settle-run.sh` in open-humanity is that |
| 119 | sequence; evidence in `evidence/aienet0-20261028/settlement/`. |
| 120 | |
| 121 | ## Countersignature `AN0V` (236 bytes) |
| 122 | |
| 123 | | Offset | Bytes | Field | |
| 124 | |---|---|---| |
| 125 | | 0 | 4 | `AN0V` | |
| 126 | | 4 | 1 | version `1` | |
| 127 | | 5 | 3 | reserved `0` | |
| 128 | | 8 | 32 | SHA-256 of the MJR1 receipt | |
| 129 | | 40 | 32 | dag_digest | |
| 130 | | 72 | 32 | recomputed output digest | |
| 131 | | 104 | 32 | verdict commitment | |
| 132 | | 136 | 33 | verifier P-256 key | |
| 133 | | 169 | 3 | reserved `0` | |
| 134 | | 172 | 64 | signature over `"AIENET0-MJR1-VERIFY-V1\0"` || bytes 0..172 | |
| 135 | |
| 136 | `check_countersign` (and `aienet0-run check`) re-verifies a stored triple |
| 137 | against pinned keys and rebuilds the verdict commitment from the MJR1 DAG, |
| 138 | job id and output digest. Both the AN0V commitment and MJR1 |
| 139 | `verifier_verdict` must equal it, otherwise `AN0_BAD_COUNTERSIGN`. |
| 140 | A settlement ledger keys its `settle` on the dag_id and the MJR1 SHA-256. |
| 141 | |
| 142 | ## Runner checks |
| 143 | |
| 144 | `bash specs/aienet/jobpath/check-harness.sh` tests the runners with |
| 145 | deterministic fault injection, not the matmul kernel. `parity.sh RECOMPUTE` |
| 146 | must build the Rust oracle successfully and accept only one lowercase-hex |
| 147 | payload/digest pair and a lowercase-hex recompute digest. Missing tools, |
| 148 | failed processes and malformed output exit 2; behavioral mismatches exit 1. |
| 149 | `OMEGA_MV=... mutants.sh OMC` requires the pinned compiler and SHA unit, |
| 150 | establishes unmutated parity first, and counts an Omega mutant killed only |
| 151 | on parity exit 1, never an invalid setup. Missing Omega prerequisites print |
| 152 | `OM-MUTANTS NOT_RUN` and fail nonzero. Historical evidence below remains |
| 153 | unchanged; current checks do not retroactively validate it. |
| 154 | |
| 155 | ## Carrier (open-humanity `oh-core::carrier`) |
| 156 | |
| 157 | Frames inside one pinned, encrypted Open Humanity session (X25519 + |
| 158 | ChaCha20-Poly1305, Ed25519 identities): tag u8, body length u32 BE, body. |
| 159 | Tag 1 bundle (<= 109 + 256 + 192 + 64·448 bytes), tag 2 receipt (exactly 404 |
| 160 | bytes), tag 3 refusal text (<= 512 bytes). An unknown tag or out-of-bound |
| 161 | length is refused before the body is read. The volunteer dials; each side |
| 162 | refuses a peer whose transport key is not the pinned one before sending any |
| 163 | payload. |
| 164 | |
| 165 | ## Exit codes |
| 166 | |
| 167 | | Code | `aienet0-run` | `aienet0-serve` | |
| 168 | |---|---|---| |
| 169 | | 0 | VERIFIED | receipt sent | |
| 170 | | 2 | usage or key file | usage or key file | |
| 171 | | 10 | transport (incl. unpinned worker key) | transport (incl. unpinned coordinator key) | |
| 172 | | 11 | worker refused (refusal frame) | job refused (refusal frame sent) | |
| 173 | | 12 | receipt refused | - | |
| 174 | | 13 | recompute unpinned, failed or mismatched | - | |
| 175 | | 14 | verdict commitment mismatch | - | |
| 176 | | 15 | I/O, output exists | I/O | |
| 177 | |
| 178 | ## Evidence classes |
| 179 | |
| 180 | - HOST_TESTED: `evidence/aienet0-20261028/host-tested/` (both ends on the |
| 181 | Spark), `parity.log`, `xcheck662.log`, both mutant logs. |
| 182 | - EXERCISED: `evidence/aienet0-20261028/exercised/` (Spark coordinator, |
| 183 | MacBook Air worker over the LAN). Not a hardware qualification. |
| 184 | |
| 185 | The Spark's nftables input policy drops LAN TCP except an allowlisted port |
| 186 | set; the EXERCISED run used port 14323 from that existing set |
| 187 | (`ip saddr 192.168.1.0/24 tcp dport 14318-14323 accept`). No firewall rule was |
| 188 | changed. |