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-protocols-mv/blob/main/specs/execution-transcript/tools/make-corpus.sh # aien-protocols-mv Canonical specifications, wire protocols, and schemas for the AIEN sovereign ecosystem 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-protocols-mv / specs / execution-transcript / tools / make-corpus.sh` 587 lines ยท 37435 bytes Raw Blame History 1 #!/bin/bash 2 # make-corpus.sh: regenerate the TRN1 (execution transcript) 3 # shared conformance corpus (contract 0.2.0: wire schemas 1 and 3). 4 # Language-neutral spec: ../TRN1_TRANSCRIPT_SPEC.md. 5 # 6 # Usage: make-corpus.sh OUT_DIR (normally specs/execution-transcript/vectors) 7 # 8 # Every vector is built byte by byte here from the spec tables, with digests 9 # from coreutils sha256sum. Nothing is produced by the C reference verifier, 10 # so the corpus and the verifier are two independent readings of the spec; 11 # tools/check-corpus.sh makes them agree. 12 # 13 # Groups (all listed in OUT_DIR/expected.txt, pairs in OUT_DIR/compare.txt): 14 # gNNN.trn golden transcripts (accepted) 15 # pNNN.trn edge positives (accepted) 16 # fNNN.trn forged replays: valid chain, different history (accepted alone, 17 # DIVERGENCE when compared with their golden) 18 # mNNN.trn mutated transcripts (refused with a named code and event) 19 # jNNN.trn contract 0.2.0: accepted by TRN1, refused by the causal join 20 # (expected join refusals in OUT_DIR/join.txt, NOT_RUN here) 21 # Shell only: no Python, no tools beyond coreutils. 22 set -eu 23 export LC_ALL=C 24 OUT=${1:?OUT_DIR} 25 mkdir -p "$OUT" 26 rm -f "$OUT"/*.trn "$OUT"/expected.txt "$OUT"/compare.txt "$OUT"/join.txt "$OUT"/.gitattributes 27 # Vectors are exact bytes (digests cover every byte), so git must never apply 28 # line-ending or text conversion to them. This file is part of the corpus and 29 # is checked by check-corpus.sh like any vector. 30 printf '*.trn binary\n' >"$OUT/.gitattributes" 31 32 # ---- hex helpers (all integers little-endian) --------------------------- 33 # le BYTES VALUE: VALUE as BYTES little-endian bytes, in hex 34 le() { 35 local n=$1 v=$2 h out="" i 36 if [ "$n" -lt 8 ]; then v=$((v & ((1 << (8 * n)) - 1))); fi 37 h=$(printf "%0$((2 * n))x" "$v") 38 for ((i = 2 * n - 2; i >= 0; i -= 2)); do out+=${h:i:2}; done 39 printf '%s' "$out" 40 } 41 h8() { le 1 "$1"; } 42 h16() { le 2 "$1"; } 43 h32() { le 4 "$1"; } 44 h64() { le 8 "$1"; } 45 zeros() { local i out=""; for ((i = 0; i < $1; i++)); do out+=00; done; printf '%s' "$out"; } 46 # txt STRING: the bytes of STRING in hex 47 txt() { printf '%s' "$1" | od -An -v -tx1 | tr -d ' \n'; } 48 # bin HEX: write raw bytes 49 bin() { local e; e=$(printf '%s' "$1" | sed 's/../\\x&/g'); printf '%b' "$e"; } 50 # sha HEX: SHA-256 of the bytes, in hex 51 sha() { bin "$1" | sha256sum | cut -c1-64; } 52 # dig STRING: a fixed 32-byte digest used as test data 53 dig() { printf '%s' "$1" | sha256sum | cut -c1-64; } 54 # flip HEX BYTE_OFFSET: HEX with the low bit of that byte inverted 55 flip() { 56 local h=$1 o=$(($2 * 2)) b 57 b=$(printf '%02x' $((0x${h:o:2} ^ 1))) 58 printf '%s' "${h:0:o}$b${h:o+2}" 59 } 60 61 # ---- transcript builder --------------------------------------------------- 62 # A transcript is built in the shell variables T (hex so far), PREV (digest of 63 # the last record or header), SEQ, and OFF[i]/LEN[i] (byte offset and length 64 # of record i, 1-based), so byte-level mutants can find records. 65 SUB_TRANSCRIPT=0 SUB_WORLD=1 SUB_CORTEX=2 SUB_JSPACE=3 SUB_KERNEL=4 SUB_ARGUS=5 66 SUB_RUNTIME=7 SUB_SCHED=8 SUB_KV=9 SUB_EXTERNAL=10 67 # start PRODUCER RUN_ID_HEX [SCHEMA] [FLAGS] [RESERVED_HEX] 68 start() { 69 T="TRN1" 70 T=$(txt TRN1)$(h16 "${3:-1}")$(h16 "${4:-0}")$2$(h16 "$1")${5:-$(zeros 6)} 71 PREV=$(sha "$T") 72 SEQ=0 73 OFF=() LEN=() 74 } 75 # rec TYPE SUB IDENT_HEX ANNOT_HEX [SEQ] [PREV] [RESERVED] [IDENT_LEN] 76 rec() { 77 local s=${5:-$((SEQ + 1))} p=${6:-$PREV} il=${8:-$((${#3} / 2))} r 78 r=$(h16 "$1")$(h16 "$2")$(h32 "$il")$(h32 $((${#4} / 2)))$(h32 "${7:-0}")$(h64 "$s")$p$3$4 79 SEQ=$((SEQ + 1)) 80 OFF[SEQ]=$((${#T} / 2)) 81 LEN[SEQ]=$((${#r} / 2)) 82 T+=$r 83 PREV=$(sha "$r") 84 } 85 end() { rec 65535 $SUB_TRANSCRIPT "$(h64 $((SEQ + 1)))$(zeros 8)" "${1:-}"; } 86 save() { bin "$T" >"$OUT/$1"; } 87 88 # ---- record identity builders (spec section 5) ------------------------------ 89 sched() { printf '%s' "$(h64 "$1")$(h64 "$2")$(h64 "$3")$(h64 "$4")"; } 90 branch_create() { printf '%s' "$(h64 "$1")$(h64 "$2")$(h64 "$3")"; } 91 branch_destroy() { printf '%s' "$(h64 "$1")$(h64 "$2")$(h32 "$3")$(zeros 4)"; } 92 rng_seed() { printf '%s' "$(h64 "$1")$2"; } 93 rng_draw() { printf '%s' "$(h64 "$1")$(h64 "$2")$(h64 "$3")"; } 94 artifact() { printf '%s' "$(h32 "$1")$(zeros 4)$(h64 "$2")$3"; } 95 # cap_transition CAP OP GEN_BEFORE GEN_AFTER PRINCIPAL ISSUER [RESERVED3_HEX] 96 cap_transition() { printf '%s' "$(h32 "$1")$(h8 "$2")${7:-000000}$(h64 "$3")$(h64 "$4")$(h32 "$5")$(h32 "$6")"; } 97 cortex_read() { printf '%s' "$(h32 "$1")$(h32 "$2")$(h64 "$3")$(h64 "$4")$5"; } 98 effect_intent() { printf '%s' "$(h64 "$1")$(h32 "$2")$(h32 "$3")$(h64 "$4")$5"; } 99 effect_commit() { printf '%s' "$(h64 "$1")$(h32 "$2")$(zeros 4)$3"; } 100 # external_input SOURCE INPUT_SEQ CONTENT_HEX [DIGEST_HEX] 101 external_input() { printf '%s' "$(h32 "$1")$(zeros 4)$(h64 "$2")${4:-$(sha "$3")}$3"; } 102 clock_read() { printf '%s' "$(h32 "$1")$(zeros 4)$(h64 "$2")"; } 103 crash_boundary() { printf '%s' "$(h64 "$1")$(h64 "$2")$3"; } 104 checkpoint() { printf '%s' "$(h32 "$1")$(zeros 4)$2"; } 105 # Omega RxCrumb canonical bytes (rx_world.c crumb_hash, after the tag): 106 # crumb_canon ID KIND REACTION FACULTY WAKE COALESCED INPUTS_HEX CAPS_HEX OUTPUTS_HEX REASON PARENTS_HEX 107 # where INPUTS_HEX etc. already start with their u32 count. 108 crumb_canon() { printf '%s' "$(h64 "$1")$(h32 "$2")$(h32 "$3")$(h32 "$4")$(h64 "$5")$(h64 "$6")$7$8$9$(h32 "${10}")${11}"; } 109 objv() { printf '%s' "$(h32 "$1")$(h32 "$2")$(h64 "$3")$(h64 "$4")"; } # obj id, obj gen, version, mask 110 capv() { printf '%s' "$(h32 "$1")$(h64 "$2")$(h32 "$3")"; } # cap id, 64-bit generation, issuer 111 crumb_digest() { sha "$(txt AIEN_RX_CAUSAL_V1)$1"; } 112 # rx_crumb CANON [DIGEST]: RX_CRUMB identity = digest || canonical bytes 113 rx_crumb() { printf '%s' "${2:-$(crumb_digest "$1")}$1"; } 114 crumb_annot() { printf '%s' "$(h32 "$1")$(h64 "$2")$(h64 "$3")$(h64 "$4")"; } # worker, t_start, t_end, episode 115 # ARGUS: 128-byte ArgusEvent wire bytes (aienos native/argus/argus_event.c encode_raw) 116 # argus_ev SEQUENCE KIND CLASS OUTCOME PRINCIPAL CAP_ID CAP_GEN 117 argus_ev() { 118 printf '%s' "$(h8 1)$(h8 "$3")$(h16 "$2")$(h8 0)$(h8 "$4")$(h16 0)$(h64 "$1")$(h64 "$1")$(h32 "$5")$(h32 0)$(h32 "$6")$(h32 0)$(h64 "$7")$(h64 1)$(h64 0)$(dig "machine A1")$(dig "evidence $1")" 119 } 120 # argus_rec EVENT_HEX CHAINED BEFORE_HEX [AFTER_HEX] [RESERVED7_HEX] 121 argus_rec() { 122 local after=${4:-} 123 if [ -z "$after" ]; then 124 if [ "$2" != 0 ]; then after=$(sha "$3$1"); else after=$3; fi 125 fi 126 printf '%s' "$1$(h8 "$2")${5:-$(zeros 7)}$3$after" 127 } 128 ARGUS_AFTER="" 129 sched_annot() { printf '%s' "$(h32 "$1")$(h64 "$2")"; } # worker, wall time (not compared) 130 131 # ---- manifests ------------------------------------------------------------ 132 { 133 echo "# TRN1 shared conformance corpus. Spec: TRN1_TRANSCRIPT_SPEC.md (contract 0.1.0, wire schema 1)." 134 echo "# Line: ok records=N run=<64 hex> final=<64 hex>" 135 echo "# or: refuse event=" 136 echo "# codes: -1 MAGIC -2 VERSION -3 LENGTH -4 NONCANONICAL -5 UNKNOWN -6 SHAPE" 137 echo "# -7 GAP -8 CHAIN -9 DIGEST -10 TRUNCATED" 138 echo "# Generated by tools/make-corpus.sh; do not edit by hand." 139 } >"$OUT/expected.txt" 140 { 141 echo "# TRN1 replay comparison pairs. Spec section 8." 142 echo "# Line: MATCH through N" 143 echo "# or: DIVERGENCE event=N expected=<64 hex> actual=<64 hex> subsystem=" 144 echo "# or: refuse expected|actual event=N" 145 echo "# Generated by tools/make-corpus.sh; do not edit by hand." 146 } >"$OUT/compare.txt" 147 ok() { echo "$1 ok records=$2 run=$3 final=$PREV" >>"$OUT/expected.txt"; } 148 refuse() { echo "$1 refuse $2 event=$3" >>"$OUT/expected.txt"; } 149 pair() { echo "$1 $2 $3" >>"$OUT/compare.txt"; } 150 # Compared digest of record I of the transcript in T (spec section 8). 151 cmpd() { 152 local i=$1 o=$((OFF[$1] * 2)) il 153 il=$((0x$(printf '%s' "${T:o+14:2}${T:o+12:2}${T:o+10:2}${T:o+8:2}"))) 154 sha "$(txt AIEN_TRN1_CMP)${T:o:8}${T:o+32:16}${T:o+8:8}${T:o+112:il*2}" 155 } 156 # cut FILE_HEX START_BYTE COUNT: bytes [START, START+COUNT) 157 cut_hex() { printf '%s' "${1:$(($2 * 2)):$(($3 * 2))}"; } 158 159 # =========================================================================== 160 # g001: Omega World run (producer omega-world). Every record kind a World 161 # writes today, including two real RxCrumbs (create, then commit with parent). 162 # =========================================================================== 163 RUN1=$(dig "run g001") 164 C1=$(crumb_canon 1 1 `4294967295` 0 0 0 "$(h32 0)" "$(h32 0)" "$(h32 1)$(objv 5 1 3 255)" 0 "$(h32 0)") 165 C1D=$(crumb_digest "$C1") 166 C2=$(crumb_canon 2 3 3 1 1 0 "$(h32 1)$(objv 5 1 3 255)" "$(h32 1)$(capv 4 9 1)" "$(h32 1)$(objv 6 1 1 1)" 0 "$(h32 1)$(h64 1)$C1D") 167 g001() { # g001 [worker-time skew for replay annotations] [run id] 168 local w=${1:-0} 169 start $SUB_WORLD "${2:-$RUN1}" 170 rec 4 $SUB_WORLD "$(rng_seed 1 "$(dig "seed g001")")" "" 171 rec 2 $SUB_JSPACE "$(branch_create 7 0 1)" "" 172 rec 1 $SUB_WORLD "$(sched 1 3 0 0)" "$(sched_annot $((2 + w)) $((1000 + w * 77)))" 173 rec 8 $SUB_CORTEX "$(cortex_read 5 1 3 255 "$(dig "cortex obj5 v3")")" "" 174 rec 15 $SUB_WORLD "$(rx_crumb "$C1")" "$(crumb_annot $((1 + w)) $((2000 + w)) $((2100 + w)) 1)" 175 rec 15 $SUB_WORLD "$(rx_crumb "$C2")" "$(crumb_annot $((2 + w)) $((2200 + w)) $((2900 + w)) 1)" 176 rec 7 $SUB_KERNEL "$(cap_transition 4 2 9 10 3 1)" "" 177 rec 9 $SUB_WORLD "$(effect_intent 1 2 4 10 "$(dig "effect 1 request")")" "" 178 rec 10 $SUB_WORLD "$(effect_commit 1 0 "$(dig "effect 1 result")")" "" 179 rec 14 $SUB_WORLD "$(checkpoint 1 "$(dig "world state after g001")")" "" 180 } 181 g001; end; save g001.trn; ok g001.trn 11 "$RUN1" 182 G1=$T 183 G1CMP=(); for i in $(seq 1 11); do G1CMP[i]=$(cmpd "$i"); done 184 185 # g005: replay of g001 on another schedule. Different run id, workers and 186 # wall times (annotations); same identities. Verifies alone and MATCHes g001. 187 RUN5=$(dig "run g005 replay of g001") 188 g001 3 "$RUN5"; end; save g005.trn; ok g005.trn 11 "$RUN5" 189 pair g001.trn g005.trn "MATCH through 11" 190 pair g001.trn g001.trn "MATCH through 11" 191 192 # =========================================================================== 193 # g002: Aienux ARGUS stream (producer aienos-argus). Two chained events, one 194 # malformed event recorded but not chained (argus_core step 0), a revoke. 195 # =========================================================================== 196 RUN2=$(dig "run g002") 197 E1=$(argus_ev 1 10 2 1 3 4 9) 198 E2=$(argus_ev 2 11 2 1 3 4 10) 199 E3=$(argus_ev 3 12 2 9 3 4 10) 200 Z32=$(zeros 32) 201 A1=$(sha "$Z32$E1"); A2=$(sha "$A1$E2") 202 start $SUB_ARGUS "$RUN2" 203 rec 16 $SUB_ARGUS "$(argus_rec "$E1" 1 "$Z32")" "" 204 rec 16 $SUB_ARGUS "$(argus_rec "$E2" 1 "$A1")" "" 205 rec 16 $SUB_ARGUS "$(argus_rec "$E3" 0 "$A2")" "" 206 rec 7 $SUB_KERNEL "$(cap_transition 4 4 10 11 3 1)" "" 207 rec 14 $SUB_ARGUS "$(checkpoint 2 "$A2")" "" 208 end; save g002.trn; ok g002.trn 6 "$RUN2" 209 G2=$T 210 pair g002.trn g002.trn "MATCH through 6" 211 212 # =========================================================================== 213 # g003: the remaining record types (producer sovcore-runtime), including a 214 # recovered crash boundary and external input with and without content. 215 # =========================================================================== 216 RUN3=$(dig "run g003") 217 IN1=$(txt "hello transcript") 218 g003() { 219 start $SUB_RUNTIME "$RUN3" 220 rec 11 $SUB_EXTERNAL "$(external_input 1 1 "$IN1")" "" 221 rec 11 $SUB_EXTERNAL "$(external_input 1 2 "" "$(dig "input 2 stored elsewhere")")" "" 222 rec 12 $SUB_RUNTIME "$(clock_read 1 42)" "" 223 rec 5 $SUB_RUNTIME "$(rng_draw 1 0 12345)" "" 224 rec 6 $SUB_RUNTIME "$(artifact 1 9 "$(dig "artifact 9")")" "" 225 rec 2 $SUB_KV "$(branch_create 2 1 1)" "" 226 rec 3 $SUB_KV "$(branch_destroy 2 1 -1)" "" 227 rec 13 $SUB_RUNTIME "$(crash_boundary 2 7 "$(dig "recovered state epoch 2")")" "" 228 rec 1 $SUB_SCHED "$(sched 1 1 0 0)" "$(sched_annot 0 5)" 229 rec 14 $SUB_KV "$(checkpoint 3 "$(dig "kv pages after g003")")" "" 230 } 231 g003; end; save g003.trn; ok g003.trn 11 "$RUN3" 232 G3=$T 233 234 # g004: the smallest transcript, END only. 235 RUN4=$(dig "run g004") 236 start $SUB_KERNEL "$RUN4"; end; save g004.trn; ok g004.trn 1 "$RUN4" 237 238 # =========================================================================== 239 # Edge positives. 240 # =========================================================================== 241 # p001: largest external input content (4096 bytes) and a large annotation. 242 BIG=$(for i in $(seq 1 256); do printf '%s' "`000102030405060708090a0b0c0d0e0f`"; done) 243 start $SUB_RUNTIME "$(dig "run p001")" 244 rec 11 $SUB_EXTERNAL "$(external_input 2 1 "$BIG")" "$BIG$BIG" 245 end; save p001.trn; ok p001.trn 2 "$(dig "run p001")" 246 # p002: crumb at Omega's limits: 8 inputs, 8 caps, 8 outputs, and parents that 247 # carry no digest (p = 0 and p >= id), as crumb_hash writes them. 248 INS=$(h32 8); CAPS=$(h32 8); OUTS=$(h32 8) 249 for i in 1 2 3 4 5 6 7 8; do INS+=$(objv "$i" 1 "$i" 255); CAPS+=$(capv "$i" $((1 << 40)) 0); OUTS+=$(objv $((i + 8)) 2 1 1); done 250 CP=$(crumb_canon 5 3 2 1 4 2 "$INS" "$CAPS" "$OUTS" -3 "$(h32 4)$(h64 0)$(h64 4)$C1D$(h64 5)$(h64 9)") 251 start $SUB_WORLD "$(dig "run p002")" 252 rec 15 $SUB_WORLD "$(rx_crumb "$CP")" "$(crumb_annot 0 0 0 0)" 253 end; save p002.trn; ok p002.trn 2 "$(dig "run p002")" 254 255 # =========================================================================== 256 # Forged replays: each has a valid chain (accepted alone) but a different 257 # history than g001. Only comparison against the expected run finds them. 258 # =========================================================================== 259 div() { # div FILE EVENT SUBSYSTEM: record the DIVERGENCE pair against g001 260 pair g001.trn "$1" "DIVERGENCE event=$2 expected=${G1CMP[$2]} actual=$(cmpd "$2") subsystem=$3" 261 } 262 # f001 omission: record 3 (scheduler decision) dropped, renumbered, rechained. 263 start $SUB_WORLD "$RUN1" 264 rec 4 $SUB_WORLD "$(rng_seed 1 "$(dig "seed g001")")" "" 265 rec 2 $SUB_JSPACE "$(branch_create 7 0 1)" "" 266 rec 8 $SUB_CORTEX "$(cortex_read 5 1 3 255 "$(dig "cortex obj5 v3")")" "" 267 rec 15 $SUB_WORLD "$(rx_crumb "$C1")" "$(crumb_annot 1 2000 2100 1)" 268 rec 15 $SUB_WORLD "$(rx_crumb "$C2")" "$(crumb_annot 2 2200 2900 1)" 269 rec 7 $SUB_KERNEL "$(cap_transition 4 2 9 10 3 1)" "" 270 rec 9 $SUB_WORLD "$(effect_intent 1 2 4 10 "$(dig "effect 1 request")")" "" 271 rec 10 $SUB_WORLD "$(effect_commit 1 0 "$(dig "effect 1 result")")" "" 272 rec 14 $SUB_WORLD "$(checkpoint 1 "$(dig "world state after g001")")" "" 273 end; save f001.trn; ok f001.trn 10 "$RUN1"; div f001.trn 3 omega-world 274 # f002 reorder: records 3 and 4 swapped, rechained. 275 start $SUB_WORLD "$RUN1" 276 rec 4 $SUB_WORLD "$(rng_seed 1 "$(dig "seed g001")")" "" 277 rec 2 $SUB_JSPACE "$(branch_create 7 0 1)" "" 278 rec 8 $SUB_CORTEX "$(cortex_read 5 1 3 255 "$(dig "cortex obj5 v3")")" "" 279 rec 1 $SUB_WORLD "$(sched 1 3 0 0)" "$(sched_annot 2 1000)" 280 rec 15 $SUB_WORLD "$(rx_crumb "$C1")" "$(crumb_annot 1 2000 2100 1)" 281 rec 15 $SUB_WORLD "$(rx_crumb "$C2")" "$(crumb_annot 2 2200 2900 1)" 282 rec 7 $SUB_KERNEL "$(cap_transition 4 2 9 10 3 1)" "" 283 rec 9 $SUB_WORLD "$(effect_intent 1 2 4 10 "$(dig "effect 1 request")")" "" 284 rec 10 $SUB_WORLD "$(effect_commit 1 0 "$(dig "effect 1 result")")" "" 285 rec 14 $SUB_WORLD "$(checkpoint 1 "$(dig "world state after g001")")" "" 286 end; save f002.trn; ok f002.trn 11 "$RUN1"; div f002.trn 3 omega-world 287 # f003: different RNG seed (first record). 288 start $SUB_WORLD "$RUN1" 289 rec 4 $SUB_WORLD "$(rng_seed 1 "$(dig "seed g001 other")")" "" 290 end; save f003.trn; ok f003.trn 2 "$RUN1"; div f003.trn 1 omega-world 291 # f004: crumb 2 used capability generation 8 instead of 9 (digest recomputed). 292 C2X=$(crumb_canon 2 3 3 1 1 0 "$(h32 1)$(objv 5 1 3 255)" "$(h32 1)$(capv 4 8 1)" "$(h32 1)$(objv 6 1 1 1)" 0 "$(h32 1)$(h64 1)$C1D") 293 start $SUB_WORLD "$RUN1" 294 rec 4 $SUB_WORLD "$(rng_seed 1 "$(dig "seed g001")")" "" 295 rec 2 $SUB_JSPACE "$(branch_create 7 0 1)" "" 296 rec 1 $SUB_WORLD "$(sched 1 3 0 0)" "$(sched_annot 2 1000)" 297 rec 8 $SUB_CORTEX "$(cortex_read 5 1 3 255 "$(dig "cortex obj5 v3")")" "" 298 rec 15 $SUB_WORLD "$(rx_crumb "$C1")" "$(crumb_annot 1 2000 2100 1)" 299 rec 15 $SUB_WORLD "$(rx_crumb "$C2X")" "$(crumb_annot 2 2200 2900 1)" 300 end; save f004.trn; ok f004.trn 7 "$RUN1"; div f004.trn 6 omega-world 301 # f005: one extra clock read before END. 302 g001; rec 12 $SUB_WORLD "$(clock_read 1 99)" ""; end; save f005.trn; ok f005.trn 12 "$RUN1"; div f005.trn 11 transcript 303 # f006: run stopped early (END after record 5). 304 start $SUB_WORLD "$RUN1" 305 rec 4 $SUB_WORLD "$(rng_seed 1 "$(dig "seed g001")")" "" 306 rec 2 $SUB_JSPACE "$(branch_create 7 0 1)" "" 307 rec 1 $SUB_WORLD "$(sched 1 3 0 0)" "$(sched_annot 2 1000)" 308 rec 8 $SUB_CORTEX "$(cortex_read 5 1 3 255 "$(dig "cortex obj5 v3")")" "" 309 rec 15 $SUB_WORLD "$(rx_crumb "$C1")" "$(crumb_annot 1 2000 2100 1)" 310 end; save f006.trn; ok f006.trn 6 "$RUN1"; div f006.trn 6 omega-world 311 312 # =========================================================================== 313 # Byte-level mutants of g001 (damage after writing: nothing rechained). 314 # =========================================================================== 315 g001 >/dev/null; end # refresh OFF/LEN for g001 316 mb() { bin "$1" >"$OUT/$2"; } 317 R() { printf '%s' "${OFF[$1]}"; } 318 # m001 omission: record 3 removed. 319 mb "${G1:0:$(($(R 3) * 2))}${G1:$(($(R 4) * 2))}" m001.trn; refuse m001.trn -7 3 320 # m002 reorder: records 3 and 4 swapped. 321 mb "${G1:0:$(($(R 3) * 2))}$(cut_hex "$G1" "$(R 4)" "${LEN[4]}")$(cut_hex "$G1" "$(R 3)" "${LEN[3]}")${G1:$(($(R 5) * 2))}" m002.trn; refuse m002.trn -7 3 322 # m003 bit flip in record 4 identity (cortex read digest): next record's prev breaks. 323 mb "$(flip "$G1" $(($(R 4) + 56 + 30)))" m003.trn; refuse m003.trn -8 5 324 # m004 bit flip in record 3 annotation (worker id): annotations are chained too. 325 mb "$(flip "$G1" $(($(R 3) + 56 + 32)))" m004.trn; refuse m004.trn -8 4 326 # m005 bit flip in record 2 prev field. 327 mb "$(flip "$G1" $(($(R 2) + 24 + 5)))" m005.trn; refuse m005.trn -8 2 328 # m006 bit flip in record 6 seq. 329 mb "$(flip "$G1" $(($(R 6) + 16)))" m006.trn; refuse m006.trn -7 6 330 # m007 bit flip in header run id. 331 mb "$(flip "$G1" 9)" m007.trn; refuse m007.trn -8 1 332 # m008 bit flip in magic. 333 mb "$(flip "$G1" 0)" m008.trn; refuse m008.trn -1 0 334 # m009 truncation inside record 5. 335 mb "${G1:0:$((($(R 5) + 70) * 2))}" m009.trn; refuse m009.trn -3 5 336 # m010 truncation at a record boundary: END lost. 337 mb "${G1:0:$(($(R 11) * 2))}" m010.trn; refuse m010.trn -10 11 338 # m011 truncation inside the file header. 339 mb "${G1:0:40}" m011.trn; refuse m011.trn -3 0 340 # m012 empty file. 341 : >"$OUT/m012.trn"; refuse m012.trn -3 0 342 # m013 truncation inside END. 343 mb "${G1:0:$((${#G1} - 6))}" m013.trn; refuse m013.trn -3 11 344 # m014 trailing byte after END. 345 mb "${G1}00" m014.trn; refuse m014.trn -3 12 346 # m015 duplicate: record 3 written twice. 347 mb "${G1:0:$(($(R 4) * 2))}$(cut_hex "$G1" "$(R 3)" "${LEN[3]}")${G1:$(($(R 4) * 2))}" m015.trn; refuse m015.trn -7 4 348 # m016 bit flip inside crumb 1 canonical bytes (record 5): its own crumb digest no longer matches. 349 mb "$(flip "$G1" $(($(R 5) + 56 + 32 + 12)))" m016.trn; refuse m016.trn -9 5 350 # m017 bit flip in END prev. 351 mb "$(flip "$G1" $(($(R 11) + 24)))" m017.trn; refuse m017.trn -8 11 352 # m018 bit flip in END record count. 353 mb "$(flip "$G1" $(($(R 11) + 56)))" m018.trn; refuse m018.trn -7 11 354 355 # =========================================================================== 356 # Built mutants: rechained, so only the named check can catch them. 357 # =========================================================================== 358 H() { start "${1:-$SUB_WORLD}" "$(dig "run $2")" "${3:-1}" "${4:-0}" "${5:-}"; } 359 # Header checks. 360 H $SUB_WORLD m020 2; end; save m020.trn; refuse m020.trn -2 0 # unknown future schema 361 H $SUB_WORLD m021 0; end; save m021.trn; refuse m021.trn -2 0 # schema 0 362 H $SUB_WORLD m022 1 1; end; save m022.trn; refuse m022.trn -4 0 # header flags set 363 H 0 m023; end; save m023.trn; refuse m023.trn -5 0 # producer 0 364 H 11 m024; end; save m024.trn; refuse m024.trn -5 0 # producer unknown 365 H $SUB_WORLD m025 1 0 "`000000000100`"; end; save m025.trn; refuse m025.trn -4 0 # header reserved 366 # Record header checks. 367 H $SUB_WORLD m030; rec 17 $SUB_WORLD "$(clock_read 1 1)" ""; end; save m030.trn; refuse m030.trn -5 1 # unknown type 368 H $SUB_WORLD m031; rec 12 11 "$(clock_read 1 1)" ""; end; save m031.trn; refuse m031.trn -5 1 # unknown subsystem 369 H $SUB_WORLD m032; rec 12 $SUB_WORLD "$(clock_read 1 1)" "" "" "" 1; end; save m032.trn; refuse m032.trn -4 1 # record reserved 370 H $SUB_WORLD m033; rec 12 $SUB_WORLD "$(clock_read 1 1)" "" 2; end; save m033.trn; refuse m033.trn -7 1 # seq skips (omission at start) 371 H $SUB_WORLD m034; rec 12 $SUB_WORLD "$(clock_read 1 1)" "" "" "$(dig other)"; end; save m034.trn; refuse m034.trn -8 1 # wrong prev 372 # Check order: unknown type wins over a bad seq. 373 H $SUB_WORLD m035; rec 17 $SUB_WORLD "$(clock_read 1 1)" "" 9; end; save m035.trn; refuse m035.trn -5 1 374 # Check order: a bad seq wins over a bad prev. 375 H $SUB_WORLD m036; rec 12 $SUB_WORLD "$(clock_read 1 1)" "" 9 "$(dig other)"; end; save m036.trn; refuse m036.trn -7 1 376 # Identity longer than the limit, fully present: LENGTH, not SHAPE. 377 HUGE=$(head -c 65537 /dev/zero | od -An -v -tx1 | tr -d ' \n') 378 H $SUB_WORLD m037; rec 1 $SUB_WORLD "$HUGE" ""; end; save m037.trn; refuse m037.trn -3 1 379 # Shape checks. 380 H $SUB_WORLD m040; rec 1 $SUB_WORLD "$(sched 1 3 0 0 | cut -c1-62)" ""; end; save m040.trn; refuse m040.trn -6 1 # SCHED 31 bytes 381 H $SUB_WORLD m041; rec 65535 $SUB_WORLD "$(h64 1)$(zeros 8)" ""; save m041.trn; refuse m041.trn -6 1 # END not subsystem 0 382 H $SUB_WORLD m042; rec 12 $SUB_TRANSCRIPT "$(clock_read 1 1)" ""; end; save m042.trn; refuse m042.trn -6 1 # subsystem 0 off END 383 H $SUB_WORLD m043; rec 7 $SUB_KERNEL "$(cap_transition 4 7 9 10 3 1)" ""; end; save m043.trn; refuse m043.trn -6 1 # cap op 7 384 H $SUB_WORLD m044; rec 13 $SUB_RUNTIME "$(crash_boundary 2 1 "$(dig x)")" ""; end; save m044.trn; refuse m044.trn -6 1 # last durable >= own seq 385 H $SUB_WORLD m045; rec 11 $SUB_EXTERNAL "$(external_input 1 1 "$BIG"00)" ""; end; save m045.trn; refuse m045.trn -6 1 # content 4097 386 H $SUB_WORLD m046; rec 15 $SUB_WORLD "$(dig short | cut -c1-40)" ""; end; save m046.trn; refuse m046.trn -6 1 # crumb identity < 32 bytes 387 CB9=$(crumb_canon 3 3 1 1 0 0 "$(h32 9)$(for i in 1 2 3 4 5 6 7 8 9; do objv "$i" 1 1 1; done)" "$(h32 0)" "$(h32 0)" 0 "$(h32 0)") 388 H $SUB_WORLD m047; rec 15 $SUB_WORLD "$(rx_crumb "$CB9")" ""; end; save m047.trn; refuse m047.trn -6 1 # 9 inputs (digest valid) 389 CBP=$(crumb_canon 3 3 1 1 0 0 "$(h32 0)" "$(h32 0)" "$(h32 0)" 0 "$(h32 1)$(h64 1)") 390 H $SUB_WORLD m048; rec 15 $SUB_WORLD "$(rx_crumb "$CBP")" ""; end; save m048.trn; refuse m048.trn -6 1 # parent 1 < id 3 without its digest 391 H $SUB_ARGUS m049; rec 16 $SUB_ARGUS "$(argus_rec "$E1" 2 "$Z32" "$(sha "$Z32$E1")")" ""; end; save m049.trn; refuse m049.trn -6 1 # chained flag 2 392 H $SUB_WORLD m050; end "00"; save m050.trn; refuse m050.trn -6 1 # END with annotation 393 # Reserved fields inside identities. 394 H $SUB_WORLD m055; rec 7 $SUB_KERNEL "$(cap_transition 4 2 9 10 3 1 000100)" ""; end; save m055.trn; refuse m055.trn -4 1 395 H $SUB_WORLD m056; rec 65535 $SUB_TRANSCRIPT "$(h64 1)$(h64 1)" ""; save m056.trn; refuse m056.trn -4 1 396 H $SUB_ARGUS m057; rec 16 $SUB_ARGUS "$(argus_rec "$E1" 1 "$Z32" "" `00000000000001`)" ""; end; save m057.trn; refuse m057.trn -4 1 397 # END count. 398 H $SUB_WORLD m058; rec 12 $SUB_WORLD "$(clock_read 1 1)" ""; rec 65535 $SUB_TRANSCRIPT "$(h64 5)$(zeros 8)" ""; save m058.trn; refuse m058.trn -7 2 399 # Embedded digests. 400 CBAD=$(crumb_canon 1 1 `4294967295` 0 0 0 "$(h32 0)" "$(h32 0)" "$(h32 1)$(objv 5 1 3 254)" 0 "$(h32 0)") 401 H $SUB_WORLD m060; rec 15 $SUB_WORLD "$(rx_crumb "$CBAD" "$C1D")" ""; end; save m060.trn; refuse m060.trn -9 1 # crumb digest stale 402 H $SUB_WORLD m061; rec 11 $SUB_EXTERNAL "$(external_input 1 1 "$(txt "hello transcripT")" "$(sha "$IN1")")" ""; end; save m061.trn; refuse m061.trn -9 1 # input content altered 403 H $SUB_ARGUS m062; rec 16 $SUB_ARGUS "$(argus_rec "$E1" 1 "$Z32" "$(dig wrong)")" ""; end; save m062.trn; refuse m062.trn -9 1 # chain_after wrong 404 H $SUB_ARGUS m063; rec 16 $SUB_ARGUS "$(argus_rec "$E1" 1 "$Z32")" ""; rec 16 $SUB_ARGUS "$(argus_rec "$E2" 1 "$Z32")" ""; end; save m063.trn; refuse m063.trn -9 2 # ARGUS event dropped between records 1 and 2 405 H $SUB_ARGUS m064; rec 16 $SUB_ARGUS "$(argus_rec "$E3" 0 "$Z32" "$A1")" ""; end; save m064.trn; refuse m064.trn -9 1 # unchained event moved the chain 406 # ARGUS stream with an event omitted, then rechained by the writer: the ARGUS 407 # continuity check still catches it (g002 without record 2). 408 start $SUB_ARGUS "$RUN2" 409 rec 16 $SUB_ARGUS "$(argus_rec "$E1" 1 "$Z32")" "" 410 rec 16 $SUB_ARGUS "$(argus_rec "$E3" 0 "$A2")" "" 411 end; save m065.trn; refuse m065.trn -9 2 412 413 # Compare against refused files. 414 pair g001.trn m001.trn "refuse actual -7 event=3" 415 pair m008.trn g001.trn "refuse expected -1 event=0" 416 417 418 # =========================================================================== 419 # Contract 0.2.0 (wire schema 3): causal and resource records, types 17, 18, 420 # 19 and 21 (section 5.5). Type 20 is reserved and still refused. Sources: 421 # aien-architecture docs/hardening/causal-id-join-v0.md (`fa46a26`) sections 422 # 2.1, 3.1 to 3.3, 3.5 and 4; docs/hardening/resource-contract-v0.md 423 # (`ddc17b7`) section 4. Everything below is appended, so every 0.1.0 vector 424 # and manifest line above keeps its bytes. 425 # =========================================================================== 426 V2=3 # wire schema of contract 0.2.x 427 { 428 echo "# Contract 0.2.0 (wire schema 3) vectors: causal and resource records, types 17 to 21." 429 } >>"$OUT/expected.txt" 430 { 431 echo "# Contract 0.2.0 (wire schema 3) pairs." 432 } >>"$OUT/compare.txt" 433 { 434 echo "# TRN1 0.2.0 join expectations (causal-id-join-v0 section 4, aien-architecture `fa46a26`)." 435 echo "# Every file here VERIFIES under TRN1 (see expected.txt); the join must refuse it." 436 echo "# Line: JOIN_REFUSED reason= run=<64 hex> event=" 437 echo "# The join set is that one file alone. No join implementation lives in this" 438 echo "# repository: these lines are NOT_RUN until a joiner (omega cut O3/O4," 439 echo "# sovereign-core cut C1) checks them. The reference verifier does not read this file." 440 echo "# Generated by tools/make-corpus.sh; do not edit by hand." 441 } >"$OUT/join.txt" 442 jrefuse() { echo "$1 JOIN_REFUSED reason=$2 run=$3 event=$4" >>"$OUT/join.txt"; } 443 444 # cause_id SUBSYSTEM LOCAL_KIND LOCAL ROOT_HEX (causal-id-join-v0 section 2.1) 445 cause_id() { sha "$(txt AIEN_CAUSE_V0)$(h16 "$1")$(h32 "$2")$(h64 "$3")$4"; } 446 # cause_rec CAUSE MODE LOCAL_KIND LOCAL ROOT_HEX (type 17, 80 bytes) 447 cause_rec() { printf '%s' "$1$(h32 "$2")$(h32 "$3")$(h64 "$4")$5"; } 448 # receipt_bind CAUSE FORMAT [RESERVED] (type 18, 40 bytes) 449 receipt_bind() { printf '%s' "$1$(h32 "$2")$(h32 "${3:-0}")"; } 450 # run_link RELATION PARENT_BRANCH PARENT_CREATE_CMP [RESERVED] (type 19, 48 bytes) 451 run_link() { printf '%s' "$(h32 "$1")$(h32 "${4:-0}")$(h64 "$2")$3"; } 452 # resource OP REASON FIELD UNIT CAUSE CONTRACT DECLARED USED [RESERVED] (type 21, 96 bytes) 453 resource() { printf '%s' "$(h8 "$1")$(h8 "$2")$(h16 "$3")$(h32 "${9:-0}")$(h64 "$4")$5$6$(h64 "$7")$(h64 "$8")"; } 454 MINT=1 ADOPT=2 CREF=3 455 456 ROOT6=$(dig "sovcore request 1 bytes") 457 CA=$(cause_id $SUB_RUNTIME 3 1 "$ROOT6") # minted by sovcore-runtime, local_kind 3, local 1 458 CON6=$(dig "contract reaction 1") 459 460 # g006: one sovcore request, start to receipt (producer sovcore-runtime). 461 # MINT, a charge, a referenced branch, a referenced effect, a refund, and a 462 # receipt bind whose receipt digest is in the annotation. 463 RUN6=$(dig "run g006") 464 g006() { # g006 RUN_ID RECEIPT_DIGEST 465 start $SUB_RUNTIME "$1" $V2 466 rec 17 $SUB_RUNTIME "$(cause_rec "$CA" $MINT 3 1 "$ROOT6")" "" 467 rec 21 $SUB_RUNTIME "$(resource 1 0 0 1 "$CA" "$CON6" 0 0)" "" 468 rec 17 $SUB_RUNTIME "$(cause_rec "$CA" $CREF 0 0 "$Z32")" "" 469 rec 2 $SUB_KV "$(branch_create 2 0 1)" "" 470 rec 17 $SUB_RUNTIME "$(cause_rec "$CA" $CREF 0 0 "$Z32")" "" 471 rec 9 $SUB_RUNTIME "$(effect_intent 1 2 4 10 "$(dig "effect g006 request")")" "" 472 rec 10 $SUB_RUNTIME "$(effect_commit 1 0 "$(dig "effect g006 result")")" "" 473 rec 21 $SUB_RUNTIME "$(resource 2 0 0 1 "$CA" "$CON6" 0 0)" "" 474 rec 18 $SUB_RUNTIME "$(receipt_bind "$CA" 3)" "$2" 475 } 476 g006 "$RUN6" "$(dig "receipt g006")"; end; save g006.trn; ok g006.trn 10 "$RUN6" 477 G6=$T 478 G6CMP=(); for i in $(seq 1 10); do G6CMP[i]=$(cmpd "$i"); done 479 pair g006.trn g006.trn "MATCH through 10" 480 481 # g008: replay of g006: other run id, other receipt digest (annotation). MATCHes. 482 RUN8=$(dig "run g008 replay of g006") 483 g006 "$RUN8" "$(dig "receipt g008")"; end; save g008.trn; ok g008.trn 10 "$RUN8" 484 pair g006.trn g008.trn "MATCH through 10" 485 486 # g007: a child World transcript. RUN_LINK as record 1 names g006's 487 # BRANCH_CREATE (record 4, branch 2); the cause is ADOPTed (annotation: origin 488 # run id, origin seq), then a cancel because the parent was cancelled. 489 RUN7=$(dig "run g007 child of g006") 490 start $SUB_RUNTIME "$RUN7" $V2 491 rec 19 $SUB_RUNTIME "$(run_link 1 2 "${G6CMP[4]}")" "$RUN6$(h64 4)" 492 rec 17 $SUB_RUNTIME "$(cause_rec "$CA" $ADOPT 3 1 "$Z32")" "$RUN6$(h64 1)" 493 rec 21 $SUB_RUNTIME "$(resource 4 2 1 2 "$CA" "$(dig "contract reaction 2")" 5 0)" "" 494 end; save g007.trn; ok g007.trn 4 "$RUN7" 495 496 # p003: top of every valid range: local_kind 4 (train run), REFUSE reason 4, 497 # CANCEL reason 3, OVERRUN, OVER_OBSERVED on field 10 with a measured value in 498 # the annotation, receipt format 1. 499 CB=$(cause_id $SUB_SCHED 4 7 "$(dig "generation 0 digest")") 500 start $SUB_SCHED "$(dig "run p003")" $V2 501 rec 17 $SUB_SCHED "$(cause_rec "$CB" $MINT 4 7 "$(dig "generation 0 digest")")" "" 502 rec 21 $SUB_SCHED "$(resource 3 4 7 3 "$CB" "$(dig "contract p003")" 8 0)" "" 503 rec 21 $SUB_SCHED "$(resource 4 3 1 3 "$CB" "$(dig "contract p003")" 9 0)" "" 504 rec 21 $SUB_SCHED "$(resource 5 0 9 3 "$CB" "$(dig "contract p003")" 16 17)" "" 505 rec 21 $SUB_SCHED "$(resource 6 0 10 3 "$CB" "$(dig "contract p003")" 100 0)" "$(h64 140)" 506 rec 18 $SUB_SCHED "$(receipt_bind "$CB" 1)" "$(dig "receipt p003")" 507 end; save p003.trn; ok p003.trn 7 "$(dig "run p003")" 508 509 # Forged 0.2 histories: valid chains (accepted alone), caught by comparison 510 # with g006 and by the join (join.txt). 511 div6() { pair g006.trn "$1" "DIVERGENCE event=$2 expected=${G6CMP[$2]} actual=$(cmpd "$2") subsystem=$3"; } 512 CAX=$(flip "$CA" 0) 513 # f007 cause bit flip in the charge (record 2), rechained. 514 start $SUB_RUNTIME "$RUN6" $V2 515 rec 17 $SUB_RUNTIME "$(cause_rec "$CA" $MINT 3 1 "$ROOT6")" "" 516 rec 21 $SUB_RUNTIME "$(resource 1 0 0 1 "$CAX" "$CON6" 0 0)" "" 517 end; save f007.trn; ok f007.trn 3 "$RUN6"; div6 f007.trn 2 sovcore-runtime 518 jrefuse f007.trn REF_UNKNOWN "$RUN6" 2 519 # f008 reorder: the charge written before its MINT, rechained. 520 start $SUB_RUNTIME "$RUN6" $V2 521 rec 21 $SUB_RUNTIME "$(resource 1 0 0 1 "$CA" "$CON6" 0 0)" "" 522 rec 17 $SUB_RUNTIME "$(cause_rec "$CA" $MINT 3 1 "$ROOT6")" "" 523 end; save f008.trn; ok f008.trn 3 "$RUN6"; div6 f008.trn 1 sovcore-runtime 524 # The MINT comes after a record that names its cause: CAUSE_PLACEMENT at the 525 # MINT (step 4 runs before step 7; aien-architecture#102 Q7). 526 jrefuse f008.trn CAUSE_PLACEMENT "$RUN6" 2 527 # f009 omission: g006 without its CAUSE MINT, renumbered, rechained. 528 start $SUB_RUNTIME "$RUN6" $V2 529 rec 21 $SUB_RUNTIME "$(resource 1 0 0 1 "$CA" "$CON6" 0 0)" "" 530 rec 17 $SUB_RUNTIME "$(cause_rec "$CA" $CREF 0 0 "$Z32")" "" 531 rec 2 $SUB_KV "$(branch_create 2 0 1)" "" 532 end; save f009.trn; ok f009.trn 4 "$RUN6"; div6 f009.trn 1 sovcore-runtime 533 jrefuse f009.trn REF_UNKNOWN "$RUN6" 1 534 535 # Join-only refusals (single file, TRN1 accepts each). 536 J() { start $SUB_RUNTIME "$(dig "run $1")" $V2; } 537 jr() { jrefuse "$1.trn" "$2" "$(dig "run $1")" "$3"; } 538 J j001; rec 17 $SUB_RUNTIME "$(cause_rec "$CAX" $MINT 3 1 "$ROOT6")" ""; rec 21 $SUB_RUNTIME "$(resource 1 0 0 1 "$CAX" "$CON6" 0 0)" "" 539 end; save j001.trn; ok j001.trn 3 "$(dig "run j001")"; jr j001 CAUSE_DIGEST 1 # minted cause does not recompute 540 J j002; rec 17 $SUB_RUNTIME "$(cause_rec "$CA" $MINT 3 1 "$ROOT6")" ""; rec 21 $SUB_RUNTIME "$(resource 1 0 0 1 "$CA" "$CON6" 0 0)" "" 541 rec 17 $SUB_RUNTIME "$(cause_rec "$CA" $MINT 3 1 "$ROOT6")" ""; rec 21 $SUB_RUNTIME "$(resource 2 0 0 1 "$CA" "$CON6" 0 0)" "" 542 end; save j002.trn; ok j002.trn 5 "$(dig "run j002")"; jr j002 DOUBLE_MINT 3 # same cause minted twice 543 J j003; rec 17 $SUB_RUNTIME "$(cause_rec "$CA" $MINT 3 1 "$ROOT6")" ""; rec 9 $SUB_RUNTIME "$(effect_intent 1 2 4 10 "$(dig "effect g006 request")")" "" 544 end; save j003.trn; ok j003.trn 3 "$(dig "run j003")"; jr j003 REF_MISSING 2 # effect intent with no CAUSE REF before it 545 J j004; rec 17 $SUB_RUNTIME "$(cause_rec "$CA" $MINT 3 1 "$ROOT6")" ""; rec 21 $SUB_RUNTIME "$(resource 1 0 0 1 "$CA" "$CON6" 0 0)" "" 546 rec 10 $SUB_RUNTIME "$(effect_commit 9 0 "$(dig "effect 9 result")")" "" 547 end; save j004.trn; ok j004.trn 4 "$(dig "run j004")"; jr j004 COMMIT_ORPHAN 3 # commit with no intent 548 J j005; rec 17 $SUB_RUNTIME "$(cause_rec "$CA" $MINT 3 1 "$ROOT6")" ""; rec 21 $SUB_RUNTIME "$(resource 1 0 0 1 "$CA" "$CON6" 0 0)" "" 549 rec 18 $SUB_RUNTIME "$(receipt_bind "$CAX" 3)" "$(dig "receipt j005")" 550 end; save j005.trn; ok j005.trn 4 "$(dig "run j005")"; jr j005 RECEIPT_CAUSE 3 # receipt bound to a cause not open 551 552 # Built 0.2 refusals: rechained, so only the named check can catch them. 553 V() { H "${1:-$SUB_RUNTIME}" "$2" $V2; } 554 CM=$(cause_rec "$CA" $MINT 3 1 "$ROOT6") 555 RS=$(resource 1 0 0 1 "$CA" "$CON6" 0 0) 556 H $SUB_RUNTIME m070; rec 17 $SUB_RUNTIME "$CM" ""; end; save m070.trn; refuse m070.trn -5 1 # valid 0.2 CAUSE under a schema 1 header 557 V "" m071; rec 20 $SUB_RUNTIME "$(zeros 160)" ""; end; save m071.trn; refuse m071.trn -5 1 # type 20 reserved in 0.2.0 558 V "" m072; rec 17 $SUB_RUNTIME "${CM:0:158}" ""; end; save m072.trn; refuse m072.trn -6 1 # CAUSE 79 bytes 559 V "" m073; rec 21 $SUB_RUNTIME "$(h8 1)$(h8 0)$(h16 0)$(h32 0)$(h64 1)$(h64 7)$CON6$(h64 0)$(h64 0)" ""; end; save m073.trn; refuse m073.trn -6 1 # RESOURCE with the old 8-byte cause (72 bytes) 560 V "" m074; rec 17 $SUB_RUNTIME "$(cause_rec "$CA" 4 3 1 "$ROOT6")" ""; end; save m074.trn; refuse m074.trn -6 1 # mode 4 561 V "" m075; rec 17 $SUB_RUNTIME "$(cause_rec "$CA" $MINT 0 1 "$ROOT6")" ""; end; save m075.trn; refuse m075.trn -6 1 # MINT local_kind 0 562 V "" m076; rec 17 $SUB_RUNTIME "$(cause_rec "$CA" $ADOPT 5 1 "$Z32")" ""; end; save m076.trn; refuse m076.trn -6 1 # ADOPT local_kind 5 563 V "" m077; rec 17 $SUB_RUNTIME "$(cause_rec "$CA" $MINT 3 0 "$ROOT6")" ""; end; save m077.trn; refuse m077.trn -6 1 # MINT local 0 564 V "" m078; rec 17 $SUB_RUNTIME "$(cause_rec "$CA" $ADOPT 3 1 "$ROOT6")" ""; end; save m078.trn; refuse m078.trn -4 1 # ADOPT root digest not zero 565 V "" m079; rec 17 $SUB_RUNTIME "$(cause_rec "$CA" $CREF 0 0 "$(flip "$Z32" 31)")" ""; end; save m079.trn; refuse m079.trn -4 1 # REF root digest not zero 566 V "" m080; rec 18 $SUB_RUNTIME "$(receipt_bind "$CA" 4)" ""; end; save m080.trn; refuse m080.trn -6 1 # receipt format 4 567 V "" m081; rec 18 $SUB_RUNTIME "$(receipt_bind "$CA" 3 1)" ""; end; save m081.trn; refuse m081.trn -4 1 # receipt bind reserved 568 V "" m082; rec 19 $SUB_RUNTIME "$(run_link 2 2 "${G6CMP[4]}")" ""; end; save m082.trn; refuse m082.trn -6 1 # relation 2 569 V "" m083; rec 19 $SUB_RUNTIME "$(run_link 1 2 "${G6CMP[4]}" 1)" ""; end; save m083.trn; refuse m083.trn -4 1 # run link reserved 570 V "" m084; rec 17 $SUB_RUNTIME "$CM" ""; rec 19 $SUB_RUNTIME "$(run_link 1 2 "${G6CMP[4]}")" ""; end; save m084.trn; refuse m084.trn -6 2 # RUN_LINK not record 1 571 V "" m085; rec 21 $SUB_RUNTIME "$(resource 7 0 0 1 "$CA" "$CON6" 0 0)" ""; end; save m085.trn; refuse m085.trn -6 1 # op 7 572 V "" m086; rec 21 $SUB_RUNTIME "$(resource 3 5 0 1 "$CA" "$CON6" 0 0)" ""; end; save m086.trn; refuse m086.trn -6 1 # REFUSE reason 5 573 V "" m087; rec 21 $SUB_RUNTIME "$(resource 1 1 0 1 "$CA" "$CON6" 0 0)" ""; end; save m087.trn; refuse m087.trn -6 1 # CHARGE with a reason 574 V "" m088; rec 21 $SUB_RUNTIME "$(resource 5 0 11 1 "$CA" "$CON6" 0 0)" ""; end; save m088.trn; refuse m088.trn -6 1 # field 11 575 V "" m089; rec 21 $SUB_RUNTIME "$(resource 1 0 0 1 "$CA" "$CON6" 0 0 1)" ""; end; save m089.trn; refuse m089.trn -4 1 # resource reserved 576 V "" m090; rec 17 $SUB_RUNTIME "$(cause_rec "$CA" $CREF 9 0 "$ROOT6")" ""; end; save m090.trn; refuse m090.trn -6 1 # check order: SHAPE before NONCANONICAL 577 578 # Byte damage on g006 (not rechained). 579 g006 "$RUN6" "$(dig "receipt g006")" >/dev/null; end # refresh OFF/LEN for g006 580 # m091 cause bit flip inside the charge (record 2): record 3's prev breaks. 581 mb "$(flip "$G6" $(($(R 2) + 56 + 16)))" m091.trn; refuse m091.trn -8 3 582 # m092 reorder: records 1 (MINT) and 2 (charge) swapped. 583 mb "${G6:0:$(($(R 1) * 2))}$(cut_hex "$G6" "$(R 2)" "${LEN[2]}")$(cut_hex "$G6" "$(R 1)" "${LEN[1]}")${G6:$(($(R 3) * 2))}" m092.trn; refuse m092.trn -7 1 584 # CAUSE REF carries local_kind 0 and local 0 exactly (aien-architecture#102 Q3). 585 V "" m093; rec 17 $SUB_RUNTIME "$(cause_rec "$CA" $CREF 3 0 "$Z32")" ""; end; save m093.trn; refuse m093.trn -6 1 # REF local_kind 3 586 V "" m094; rec 17 $SUB_RUNTIME "$(cause_rec "$CA" $CREF 0 5 "$Z32")" ""; end; save m094.trn; refuse m094.trn -6 1 # REF local 5 587 echo "corpus written to $OUT: $(ls "$OUT"/*.trn | wc -l) transcripts"