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/spark-rsi-mv/blob/main/tests/reuse-eval/receipt-fields.om # spark-rsi-mv Native Rust recursive self-improvement engine with paired bootstrap evaluation and cryptographic ledger 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 `spark-rsi-mv / tests / reuse-eval / receipt-fields.om` 464 lines ยท 8614 bytes Raw Blame History 1 note units: sha256 stats turing receipt 2 note SPDX-License-Identifier: Apache-2.0 3 note receipt-fields: the receipt layout. Inputs: an index with known holdout words, three 4 note acq-1-R.mansha files, a stats.sum with known words, a contract file. The receipt must equal 5 note RTEXP byte for byte except the two 64-hex values marked ?: the evaluator binary digest 6 note (checked against SHA-256 of /proc/self/exe computed here) and the receipt identity digest 7 note (recomputed here from the documented length-prefixed field list). policy_sha256 and 8 note stats_summary_sha256 are SHA-256 values computed independently (Python hashlib, development 9 note only). Then the refusals: MANSHA differing from a rebuild (9), a missing rebuild file (8), 10 note an uppercase commit (2), a stats.sum with a wrong magic (7), a summary whose holdout digest 11 note differs from the index (11), a DEV summary (11), a DEV index (10), a summary with another 12 note request count (11). 13 note argv[1] = temporary directory (default /tmp/reuse-test-evalstats-rc-). 14 note Exit 0 = pass; otherwise the failing check's code. 15 16 text RTK "/tmp/reuse-test-evalstats-rc-\nsplit\nrun\nstats\ncontract.md\nreceipt.txt\nindex\nacq-1-0.mansha\nacq-1-1.mansha\nacq-1-2.mansha\nstats.sum\n/proc/self/exe\n" 17 text RTCON "REUSE-1 test contract v1.0\n" 18 text RTC "`0123456789abcdef0123456789abcdef01234567`" 19 text RTCU "0123456789ABCDEF0123456789abcdef01234567" 20 text RTM "`5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a`" 21 text RTM2 "`5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5b`" 22 text RTH "`0102030405060708090a0b0c0d0e0f1011111111111111111918171615141312`" 23 text RTP "`0e6940071a1f189c69a3faa6d9ca6dc78f92f8520c4548f2c6a878c89e4e9e98`" 24 text RTS "`dd51cbe03f9a9c7e61a4d471f9312ee703b2910541daf12bbd7c9b5790dfe192`" 25 text RTD "spark-rsi.reuse1-receipt.v2-unsigned" 26 text RTEXP "receipt=REUSE-1 format_version=2 kind=evaluation status=UNSIGNED\nsignature=UNSIGNED reason=no_om_p256_signer (REUSE-1 7.5, spark-rsi #67 signer is Rust)\nsubject_commit=`0123456789abcdef0123456789abcdef01234567`\nsubject_mansha=`5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a`\nholdout_set_sha256=`0102030405060708090a0b0c0d0e0f1011111111111111111918171615141312`\npolicy_sha256=`0e6940071a1f189c69a3faa6d9ca6dc78f92f8520c4548f2c6a878c89e4e9e98`\nevaluator_binary_sha256=????????????????????????????????????????????????????????????????\nstats_summary_sha256=`dd51cbe03f9a9c7e61a4d471f9312ee703b2910541daf12bbd7c9b5790dfe192`\nholdouts_total=189504 holdouts_passed=189500\ncounts groups=24 sessions=192 requests=18000 queries=9024 reps=3 arms=8 wrong_refusals=1\ndecision=INVESTIGATE reason_bits=512\nbudget split=FINAL runs_allowed=1 runs_used=1 seed=burned\nindependence=UNISOLATED\nreceipt_identity_sha256=????????????????????????????????????????????????????????????????\n" 27 28 global RTRB uchar 4096 29 global RTRL ulong 1 30 global RTEV uchar 64 31 global RTID uchar 64 32 33 fn rtoff k ulong to ulong 34 i = ulong 0 35 c = ulong 0 36 while lt c k bound 100000 37 if eq get RTK i 10 38 c = add c 1 39 end 40 i = add i 1 41 end 42 ret i 43 end 44 45 fn rtkp k ulong to void 46 i = rtoff k 47 while ne get RTK i 10 bound 4096 48 stpc get RTK i 49 i = add i 1 50 end 51 end 52 53 fn rtroot to void 54 put STPL 0 0 55 for i ulong get RTRL 0 56 stpc get RTRB i 57 end 58 end 59 60 fn rtpath k ulong f ulong to void 61 rtroot 62 stpc 47 63 rtkp k 64 if gt f 0 65 stpc 47 66 rtkp f 67 end 68 end 69 70 fn rtinit to int 71 put RTRL 0 0 72 if ge argcnt 2 73 n = argread 1 RTRB 0 4000 74 if gt n 0 75 put RTRL 0 ulong n 76 end 77 end 78 if eq get RTRL 0 0 79 put STPL 0 0 80 rtkp 0 81 stpu ulong getpid 82 for i ulong get STPL 0 83 put RTRB i get STPB i 84 end 85 put RTRL 0 get STPL 0 86 end 87 rtroot 88 r = makedir STPB 0 get STPL 0 448 89 if and ne r 0 ne r -17 90 ret 1 91 end 92 for k ulong 3 93 rtpath add k 1 0 94 r = makedir STPB 0 get STPL 0 448 95 if and ne r 0 ne r -17 96 ret 2 97 end 98 end 99 ret 0 100 end 101 102 note the mansha text (m 0 = RTM, 1 = RTM2) and a newline into STOB 103 fn rtmsh m ulong to void 104 put STOP 0 0 105 for i ulong 64 106 if eq m 0 107 stoc get RTM i 108 else 109 stoc get RTM2 i 110 end 111 end 112 stoc 10 113 end 114 115 note the split index: split id sp, 24 groups of 750 requests, 192 sessions, 9024 QUERYs 116 fn rtindex sp ulong to int 117 put STOP 0 0 118 stow `3544386032354079058` 119 stow 1 120 stow sp 121 stow 24 122 stow 192 123 stow 18000 124 stow 9024 125 stow `72623859790382856` 126 stow `651345242494996240` 127 stow `1229782938247303441` 128 stow `1808220633999610642` 129 for k ulong 5 130 stow 0 131 end 132 for g ulong 24 133 stow 750 134 end 135 rtpath 1 6 136 if ne stwfile 0 137 ret 3 138 end 139 ret 0 140 end 141 142 fn rtfiles to int 143 r = rtindex 4 144 if ne r 0 145 ret r 146 end 147 for k ulong 3 148 rtmsh 0 149 rtpath 2 add 7 k 150 if ne stwfile 0 151 ret 4 152 end 153 end 154 r = rtsum `3544386041195737426` 4 0 155 if ne r 0 156 ret r 157 end 158 put STOP 0 0 159 for i ulong len RTCON 160 stoc get RTCON i 161 end 162 rtpath 4 0 163 ret stwfile 164 end 165 166 note stats.sum with split id sp; hx is added to holdout word 7 (0 = the index's digest) 167 fn rtsum magic ulong sp ulong hx ulong to int 168 put STOP 0 0 169 stow magic 170 stow 1 171 stow 2 172 stow 512 173 stow 24 174 stow 192 175 stow 18000 176 stow 9024 177 stow 3 178 stow sp 179 stow 0 180 stow 10000 181 stow 189504 182 stow 189500 183 stow 4 184 stow 1 185 stow 0 186 stow 0 187 stow add `72623859790382856` hx 188 stow `651345242494996240` 189 stow `1229782938247303441` 190 stow `1808220633999610642` 191 for k ulong 234 192 stow 0 193 end 194 rtpath 3 10 195 if ne stwfile 0 196 ret 5 197 end 198 ret 0 199 end 200 201 note slots for rcrun; commit from RTC (u = 0) or RTCU (u = 1) 202 fn rtslots u ulong to void 203 rtpath 1 0 204 stbfromp 0 205 rtpath 2 0 206 stbfromp 1 207 rtpath 3 0 208 stbfromp 2 209 rtpath 4 0 210 stbfromp 3 211 put STPL 0 0 212 for i ulong 40 213 if eq u 0 214 stpc get RTC i 215 else 216 stpc get RTCU i 217 end 218 end 219 stbfromp 4 220 put STPL 0 0 221 for i ulong 64 222 stpc get RTM i 223 end 224 stbfromp 5 225 rtpath 5 0 226 stbfromp 6 227 end 228 229 note 64 hex of TUD into RTEV (e = 0) or RTID (e = 1) 230 fn rthex e ulong to void 231 h = stkoff SKDIG 232 for j ulong 4 233 v = get TUD j 234 for k ulong 8 235 b = and shr v mul k 8 255 236 p = add mul j 16 mul k 2 237 c1 = get STK add h shr b 4 238 c2 = get STK add h and b 15 239 if eq e 0 240 put RTEV p c1 241 put RTEV add p 1 c2 242 else 243 put RTID p c1 244 put RTID add p 1 c2 245 end 246 end 247 end 248 end 249 250 note appends u64 LE length n then the bytes of text t (0 RTD, 1 RTC, 2 RTM, 3 RTH, 4 RTP, 5 RTEV, 6 RTS) 251 fn rtlp t ulong to void 252 n = ulong 64 253 if eq t 0 254 n = len RTD 255 end 256 if eq t 1 257 n = 40 258 end 259 tule n 8 260 for i ulong n 261 if eq t 0 262 tub ulong get RTD i 263 end 264 if eq t 1 265 tub ulong get RTC i 266 end 267 if eq t 2 268 tub ulong get RTM i 269 end 270 if eq t 3 271 tub ulong get RTH i 272 end 273 if eq t 4 274 tub ulong get RTP i 275 end 276 if eq t 5 277 tub ulong get RTEV i 278 end 279 if eq t 6 280 tub ulong get RTS i 281 end 282 end 283 end 284 285 note the identity digest recomputed from the documented field list 286 fn rtident to void 287 put TUFL 0 0 288 for t ulong 7 289 rtlp t 290 end 291 tule 8 8 292 tule 189504 8 293 tule 8 8 294 tule 189500 8 295 tule 8 8 296 tule 2 8 297 tule 8 8 298 tule 512 8 299 tusha 1000 0 0 get TUFL 0 300 rthex 1 301 end 302 303 note the receipt file equals RTEXP, with RTEV and RTID at the two ? runs 304 fn rtcmp to int 305 rtpath 5 0 306 n = stload 307 if ne n long len RTEXP 308 ret 20 309 end 310 q = ulong 0 311 for i ulong len RTEXP 312 e = get RTEXP i 313 g = get STFB i 314 if eq e 63 315 if lt q 64 316 e = get RTEV q 317 else 318 e = get RTID sub q 64 319 end 320 q = add q 1 321 end 322 if ne e g 323 ret 21 324 end 325 end 326 if ne q 128 327 ret 22 328 end 329 ret 0 330 end 331 332 fn rtrefuse to int 333 rtmsh 1 334 rtpath 2 8 335 if ne stwfile 0 336 ret 30 337 end 338 if ne rcrun 2 339 ret 31 340 end 341 if ne get STOB 20 57 342 ret 32 343 end 344 rtmsh 0 345 rtpath 2 8 346 r = stwfile 347 rtpath 2 9 348 u = unlink STPB 0 get STPL 0 349 if ne rcrun 2 350 ret 33 351 end 352 if ne get STOB 20 56 353 ret 34 354 end 355 rtmsh 0 356 rtpath 2 9 357 r = stwfile 358 rtslots 1 359 if ne rcrun 2 360 ret 35 361 end 362 if ne get STOB 20 50 363 ret 36 364 end 365 rtslots 0 366 r = rtsum `3544386041195737427` 4 0 367 if ne rcrun 2 368 ret 37 369 end 370 if ne get STOB 20 55 371 ret 38 372 end 373 ret rtfinal 374 end 375 376 note the refusal code printed by the last rcrun 377 fn rtcode to ulong 378 if ne get STOB 0 115 379 ret 999 380 end 381 v = ulong 0 382 for k ulong 4 383 c = get STOB add 20 k 384 if or lt c 48 gt c 57 385 break 386 end 387 v = add mul v 10 ulong sub c 48 388 end 389 ret v 390 end 391 392 note split and summary identity: a mismatched holdout digest, a DEV summary, DEV index, and 393 note a summary with another request count are refused (11, 11, 10, 11); restored = accepted 394 fn rtfinal to int 395 r = rtsum `3544386041195737426` 4 1 396 if or ne rcrun 2 ne rtcode 11 397 ret 39 398 end 399 r = rtsum `3544386041195737426` 3 0 400 if or ne rcrun 2 ne rtcode 11 401 ret 40 402 end 403 r = rtsum `3544386041195737426` 4 0 404 r = rtindex 3 405 if or ne rcrun 2 ne rtcode 10 406 ret 41 407 end 408 r = rtindex 4 409 if ne rcrun 0 410 ret 42 411 end 412 r = rtsumreq 413 if or ne rcrun 2 ne rtcode 11 414 ret 43 415 end 416 ret 0 417 end 418 419 note stats.sum as written by rtsum but with request count 17999 (word 6) 420 fn rtsumreq to int 421 r = rtsum `3544386041195737426` 4 0 422 rtpath 3 10 423 n = stload 424 put STOP 0 0 425 for k ulong 256 426 if eq k 6 427 stow 17999 428 else 429 stow stw mul k 8 430 end 431 end 432 rtpath 3 10 433 ret stwfile 434 end 435 436 fn main to int 437 r = rtinit 438 if ne r 0 439 ret r 440 end 441 r = rtfiles 442 if ne r 0 443 ret r 444 end 445 put STPL 0 0 446 rtkp 11 447 n = stload 448 if lt n 0 449 ret 10 450 end 451 tusha 1000 1 0 ulong n 452 rthex 0 453 rtident 454 rtslots 0 455 put STQT 0 1 456 if ne rcrun 0 457 ret 11 458 end 459 r = rtcmp 460 if ne r 0 461 ret r 462 end 463 ret rtrefuse 464 end