Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-architecture-mv/blob/main/evidence/QUANTUM_EFFICIENCY/2026-10-22/additional-pinned-source.txt # aien-architecture-mv Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-architecture-mv / evidence / QUANTUM_EFFICIENCY / 2026-10-22 / additional-pinned-source.txt` 188 lines ยท 7886 bytes Raw Blame History 1 PINNED aienos-repo `18e276590424593647cd7c39c6d16c2f9f8d6027` native/store/store_engine.c RC 0 2 65: 3 66:/* read_application_object, streamed one unit at a time through ws->unit. 4 67: * Like Rust, every unit is read first in order (a read failure is RE_IO 5 68: * whatever the bytes are), and only then is the extent judged. If out is 6 69: * set the semantic bytes are copied there (caller checked the size). If cmp 7 70: * is set, *differs reports whether the semantic bytes differ from cmp. */ 8 71:static int read_app_object(const st_dev *d, st_workspace *ws, const sv1_entry *e, uint8_t *out, 9 72: const uint8_t *cmp, int *differs) 10 73:{ 11 74: sha256_ctx ctx; 12 75: int graph = 0; 13 76: uint32_t units; 14 77: if (sv1_unit_count(e->byte_length, &units) || units != e->unit_count) 15 78: graph = 1; 16 79: if (!graph && sv1_object_id_begin(&ctx, e->kind, e->version, e->byte_length)) 17 80: graph = 1; 18 81: if (differs) 19 82: *differs = 0; 20 83: for (uint32_t i = 0; i < e->unit_count; i++) { 21 84: if (dev_read(d, e->first_unit + i, ws->unit)) 22 85: return RE_IO; 23 86: if (graph) 24 87: continue; 25 88: uint64_t start = (uint64_t)i * SV1_UNIT; 26 89: uint64_t take = e->byte_length > start ? e->byte_length - start : 0; 27 90: if (take > SV1_UNIT) 28 91: take = SV1_UNIT; 29 92: sha256_update(&ctx, ws->unit, (size_t)take); 30 93: if (!sv1_all_zero(ws->unit + take, SV1_UNIT - (size_t)take)) graph = 1; /* GUARD:object-padding */ 31 94: if (out) 32 95: sv1_copy(out + start, ws->unit, (size_t)take); 33 96: if (cmp && differs && !sv1_equal(cmp + start, ws->unit, (size_t)take)) 34 97: *differs = 1; 35 98: } 36 99: if (graph) 37 100: return RE_GRAPH; 38 101: uint8_t id[32]; 39 102: sha256_final(&ctx, id); 40 103: if (!sv1_equal(id, e->object_id, 32)) return RE_GRAPH; /* GUARD:object-hash */ 41 104: return RE_OK; 42 105:} 43 325: return ST_M_CORRUPT_RECOVERY_REQUIRED; 44 326: } 45 327: return ST_M_CORRUPT_RECOVERY_REQUIRED; 46 328:} 47 329: 48 330:static int write_object(const st_dev *d, st_workspace *ws, uint64_t first, uint32_t units, 49 331: const uint8_t *bytes, uint64_t len) 50 332:{ 51 333: for (uint32_t i = 0; i < units; i++) { 52 334: uint64_t start = (uint64_t)i * SV1_UNIT; 53 335: uint64_t take = len > start ? len - start : 0; 54 336: if (take > SV1_UNIT) 55 337: take = SV1_UNIT; 56 338: sv1_zero(ws->unit, SV1_UNIT); 57 339: sv1_copy(ws->unit, bytes + start, (size_t)take); 58 340: if (dev_write(d, first + i, ws->unit)) 59 341: return ST_E_IO; 60 342: } 61 343: return 0; 62 344:} 63 345: 64 346:typedef struct { 65 PINNED aienos-repo `18e276590424593647cd7c39c6d16c2f9f8d6027` native/net/x25519.c RC 0 66 40:static void sub(fe o, const fe a, const fe b) { for (int i = 0; i < 16; i++) o[i] = a[i] - b[i]; } 67 41: 68 42:static void mul(fe o, const fe a, const fe b) 69 43:{ 70 44: int64_t t[31]; 71 45: for (int i = 0; i < 31; i++) t[i] = 0; 72 46: for (int i = 0; i < 16; i++) 73 47: for (int j = 0; j < 16; j++) t[i + j] += a[i] * b[j]; 74 48: for (int i = 0; i < 15; i++) t[i] += 38 * t[i + 16]; 75 49: for (int i = 0; i < 16; i++) o[i] = t[i]; 76 50: carry(o); 77 51: carry(o); 78 52:} 79 53: 80 54:static void sqr(fe o, const fe a) { mul(o, a, a); } 81 55: 82 56:/* o = i^(p-2) = 1/i. The exponent is public, so its branches are too. */ 83 57:static void invert(fe o, const fe in) 84 58:{ 85 59: fe c; 86 60: memcpy(c, in, sizeof c); 87 PINNED aienos-repo `18e276590424593647cd7c39c6d16c2f9f8d6027` native/sig/`ed25519`.c RC 0 88 540: aienos_sha512_update(&c, pk, 32); 89 541: aienos_sha512_update(&c, msg, msg_len); 90 542: aienos_sha512_final(&c, kh); 91 543: aienos_sig_sc_reduce(ks, kh); 92 544: 93 545: ge_scalarmult(&sB, &k.B, sig + 32, &k); 94 546: ge_scalarmult(&kA, &A, ks, &k); 95 547: ge_neg(&kA, &kA); 96 548: ge_add(&chk, &sB, &kA, &k); /* [S]B - [k]A, must equal R */ 97 549: ge_tobytes(enc, &chk); 98 550: if (!aienos_sig_ct_equal(enc, sig, 32)) return AIENOS_SIG_ERR_INVALID; /* GUARD:r-check */ 99 551: return AIENOS_SIG_OK; 100 552:} 101 PINNED omega `a8ffd2b912c84197d08f963b05f9c7d8b30a3f8a` src/crumbline/cl_search.c RC 0 102 70: size_t npending; 103 71: uint32_t pending_since; 104 72: uint8_t hyps[MAX_HYP][CL_DIGEST_BYTES]; 105 73: size_t nhyp; 106 74: uint32_t max_queries; 107 75: bool stop, solved, first_submit_done; 108 76:} S; 109 77: 110 78:static void emit(S *s, const ClEvent *ev) { 111 79: if (s->sink && s->sink->emit) s->sink->emit(s->sink->ctx, ev); 112 80:} 113 81: 114 82:static void hash_vals(const uint64_t *v, uint32_t w, uint64_t *h1, uint64_t *h2) { 115 83: uint64_t a = 0x9E3779B97F4A7C15ULL, b = 0xC2B2AE3D27D4EB4FULL; 116 84: for (uint32_t i = 0; i < w; ++i) { 117 85: a = (a ^ v[i]) * 0x100000001B3ULL; 118 86: a ^= a >> 29; 119 87: b = (b + v[i]) * 0xFF51AFD7ED558CCDULL; 120 88: b ^= b >> 33; 121 89: } 122 90: *h1 = a; 123 91: *h2 = b; 124 92:} 125 93: 126 94:/* true if an equivalent state with cost <= insns already exists */ 127 95:static bool equiv_seen(S *s, uint64_t h1, uint64_t h2, uint32_t insns) { 128 240: 129 241: const uint64_t *probes = cl_probe_inputs(); 130 242: Node *root = &s.nodes[0]; 131 243: root->id = 0; 132 244: root->parent = UINT32_MAX; 133 245: root->op = UINT16_MAX; 134 246: for (uint32_t k = 0; k < s.n; ++k) s.vals[k] = s.inputs[k]; 135 247: for (uint32_t k = 0; k < W_PROBES; ++k) s.vals[s.n + k] = probes[k]; 136 248: uint64_t h1, h2; 137 249: hash_vals(s.vals, s.w, &h1, &h2); 138 250: equiv_seen(&s, h1, h2, 0); 139 251: s.count = 1; 140 252: 141 253: uint32_t next_id = 1; 142 254: size_t level_start = 0, level_end = 1; 143 255: int best_matches = -1; 144 256: uint32_t best_node = 0, best_parent = 0; 145 257: uint16_t best_op = 0; 146 258: uint32_t robust_need = cfg.robust_min_pct ? (s.n * cfg.robust_min_pct + 99) / 100 : UINT32_MAX; 147 259: 148 260: for (uint32_t depth = 1; depth <= cfg.max_depth && !s.stop; ++depth) { 149 261: size_t level_kept = 0; 150 262: for (size_t pi = level_start; pi < level_end && !s.stop; ++pi) { 151 263: res->expansions++; 152 264: for (size_t oi = 0; oi < bank->count && !s.stop; ++oi) { 153 265: if (res->generated >= cfg.max_candidates) { 154 266: s.stop = true; 155 267: break; 156 268: } 157 269: res->generated++; 158 270: const Node *parent = &s.nodes[pi]; 159 271: const ClOp *op = &bank->ops[oi]; 160 272: ClEvent ev = {CL_EV_EXPAND, CL_PRUNE_NONE, CL_VERIFY_NOT_REACHED, CL_FIT_NONE, (uint16_t)oi, 161 273: parent->id, next_id++, 0, 0}; 162 274: uint32_t nsteps = parent->nsteps + op->steps.n; 163 275: uint32_t insns = parent->insns + op_insns(op); 164 276: if (nsteps > CL_MAX_STEPS) { 165 277: ev.prune = CL_PRUNE_STEP_CAP; 166 278: emit(&s, &ev); 167 279: continue; 168 280: } 169 281: if (insns + 1 > cfg.max_program_insns) { 170 282: ev.prune = CL_PRUNE_COST; 171 283: res->pruned_cost++; 172 284: emit(&s, &ev); 173 285: continue; 174 286: } 175 287: const uint64_t *pv = &s.vals[pi * s.w]; 176 288: for (uint32_t k = 0; k < s.w; ++k) scratch[k] = cl_steps_eval(&op->steps, pv[k]); 177 289: ev.exec_cost = s.w; 178 290: hash_vals(scratch, s.w, &h1, &h2); 179 291: if (equiv_seen(&s, h1, h2, insns)) { 180 292: ev.prune = CL_PRUNE_EQUIV; 181 293: res->pruned_equiv++; 182 294: emit(&s, &ev); 183 295: continue; 184 296: } 185 297: res->evaluated++; 186 298: uint32_t mismatch = 0; 187 299: for (uint32_t k = 0; k < s.n; ++k) 188 300: if ((scratch[k] & s.mask) != crumb->out[k][0]) mismatch++;