interplane-forge
INTERPLANE Forge
Brought by drakestapleton
interplane-forge / community / 30page.om
| 1 | note community/30page.om -- the pages: /community/ (what joining does, the one line, the rule, every |
| 2 | note published part with its record), /community/part/<id> (the developer view: every counted key |
| 3 | note with its time and fingerprints), and the record line the salvage part page shows. |
| 4 | |
| 5 | text cmbase "<div class=\"sl\"><p class=\"eyebrow\">INTERPLANE / COMMUNITY MACHINES</p>" |
| 6 | text cmclose "</div>" |
| 7 | text cmh1 "<h1>" |
| 8 | text cmh1e "</h1>" |
| 9 | text cmh2 "<h2>" |
| 10 | text cmh2e "</h2>" |
| 11 | text cmp "<p>" |
| 12 | text cmpe "</p>" |
| 13 | text cmpre "<pre>" |
| 14 | text cmtdist "dist/" |
| 15 | text cmtsums "SHA256SUMS" |
| 16 | text cmcmh "Community machines" |
| 17 | text cmolder "Earlier parts of the ledger, the refusal log and the alarm log (each set aside at 4 MiB):" |
| 18 | text cmpree "</pre>" |
| 19 | text cmcode "<code>" |
| 20 | text cmcodee "</code>" |
| 21 | text cmhref "<a href=\"" |
| 22 | text cmhrefe "\">" |
| 23 | text cmae "</a>" |
| 24 | text cmcard "<article class=\"sl-card\">" |
| 25 | text cmcarde "</article>" |
| 26 | text cmslug "community/" |
| 27 | text cmslpart "community/part/" |
| 28 | text cmslkey "community/key/" |
| 29 | text cmslmsg "community/msg/" |
| 30 | text cmslsal "salvage/" |
| 31 | text cmtitle "Run Interplane's checks on your own computer" |
| 32 | text cmintro "Anyone with an NVIDIA DGX Spark, or another 64-bit ARM computer running Linux, can lend it to Interplane. It asks for small public programs, builds each one and runs its example in a sealed box, and reports what it got. When several runners get the same bytes, everyone can see it here." |
| 33 | text cmjoinh "Join with one line" |
| 34 | text cmjoin "curl -fsSL https://interplane.io/community/join | sh" |
| 35 | text cmjoinp "It puts two files in a folder called .interplane-runner in your home folder, shows their SHA-256 fingerprints (compare them with the list at the bottom of this page), explains what will happen, and asks you to type yes before anything is registered. Nothing else needs to be installed." |
| 36 | text cmdoesh "What it does to your computer" |
| 37 | text cmdoes "<ul><li>It only makes outgoing requests to interplane.io. Nothing from outside can connect to your computer.</li><li>Each check takes at most 2 seconds of one CPU core to build and 2 to run, 128 MiB of address space (the most memory it can reserve), 1 MiB of output, and 3 seconds of clock time for each step.</li><li>You choose how many checks an hour: 30 to start, change it any time with <code>interplane-runner set rate N</code>, and 0 pauses.</li><li>Everything it keeps is in one folder, under 10 MiB. The secret half of its key never leaves your computer.</li><li>It does not start again by itself after a restart: run <code>interplane-runner start</code>.</li></ul>" |
| 38 | text cmneverh "What it can never do" |
| 39 | text cmnever "A checked program runs in a sealed box made by the Linux kernel: no network, none of your files, no environment variables, no GPU, no new processes. It can only read its example input and write its output. The runner runs nothing else from Interplane." |
| 40 | text cmstoph "Stop or leave" |
| 41 | text cmstop "~/.interplane-runner/bin/interplane-runner stop\n~/.interplane-runner/bin/interplane-runner leave" |
| 42 | text cmstopp "stop pauses it. leave stops it, tells Interplane, and deletes the folder." |
| 43 | text cmruleh "How results are counted" |
| 44 | text cmrule "Each runner is a key. One computer can hold several runners, and Interplane cannot tell from outside, so runners are counted, not machines. A key counts once for each revision of a part, however often it sends a result. Results agree when the built program, its output and its exit status are the same, byte for byte. Keys are free to make, so any number of agreeing keys is not called verified: agreement shows that the same bytes came back from every agreeing key, and if at least one of those keys is honest and used the pinned compiler, that runner really got them. It never changes what Interplane's own check says. Any disagreement is shown, and then the part is not presented as reproduced." |
| 45 | text cmpartsh "Published parts and their reruns" |
| 46 | text cmnopart "No part is published in the salvage yard yet." |
| 47 | text cmdevh "For developers" |
| 48 | text cmdev "The protocol, the runner's source and its gates are in the spark-connector repository. Every accepted message and every refusal is kept:" |
| 49 | text cmled "community/ledger\">ledger</a> · <a href=\"" |
| 50 | text cmrefl "community/refused\">refusals</a> · <a href=\"" |
| 51 | text cmsums "community/dl/SHA256SUMS\">SHA256SUMS</a></p>" |
| 52 | text cmfilesh "Files and fingerprints" |
| 53 | text cmr0 "Not run again by community runners yet." |
| 54 | text cmr1 "Ran again by " |
| 55 | text cmr2 " community runner" |
| 56 | text cmr2s " community runners" |
| 57 | text cmr3 ": " |
| 58 | text cmr4 " agree" |
| 59 | text cmr5 ", " |
| 60 | text cmr6 " disagree. While results disagree this part is not presented as reproduced." |
| 61 | text cmr7 " No single result has more runners than every other." |
| 62 | text cmplath "Which computers can join" |
| 63 | text cmplat "<ul><li>Linux on 64-bit ARM (aarch64), such as an NVIDIA DGX Spark: works. Interplane runs it on its own DGX Spark.</li><li>Linux on x86-64, most PCs and servers: not covered yet. The compiler cannot yet build the sealed box for x86-64; the gap is with the compiler's owner.</li><li>Mac: not covered. The sealed box is made with Linux kernel features (Landlock and seccomp) that macOS does not have.</li></ul><p>On a computer that is not covered, the join line says so and installs nothing.</p>" |
| 64 | text cmrunh "Runners now" |
| 65 | text cmrun1 " runner" |
| 66 | text cmrun1s " runners" |
| 67 | text cmrun2 " registered: keys that joined and have not left (a key Interplane has refused since still counts here). Several runners can be on one computer." |
| 68 | text cmnoteh "Interplane's note on its own runners: " |
| 69 | text cmtnote "runners-note" |
| 70 | text cmrtab "<table><tr><th>runner key</th><th>joined (Unix s)</th><th>checks an hour</th></tr>" |
| 71 | text cmrmore "The list shows the registered keys among the first 200 key files in the store, in the store's order." |
| 72 | text cmrunal "At least " |
| 73 | text cmrcap " The count stops after the first 200 keys in the store, so that showing this page stays cheap however many keys are made." |
| 74 | text cmr8 " The agreeing result has the same bytes as Interplane's own check." |
| 75 | text cmr9 " The agreeing result differs from Interplane's own check." |
| 76 | text cmr10 " Keys are free to make, so this is not called verified." |
| 77 | text cmdet "details" |
| 78 | text cmdot "." |
| 79 | text cmown "Interplane's own check: compiler omc <code>" |
| 80 | text cmownb "</code>, binary <code>" |
| 81 | text cmowno "</code>, output <code>" |
| 82 | text cmowne "</code>, exit 0." |
| 83 | text cmtab "<table><tr><th>key</th><th>time (Unix s)</th><th>exit</th><th>binary SHA-256</th><th>output SHA-256</th><th>signed message</th></tr>" |
| 84 | text cmtabe "</table>" |
| 85 | text cmtr "<tr><td class=\"mono\">" |
| 86 | text cmtd "</td><td class=\"mono\">" |
| 87 | text cmtre "</td></tr>" |
| 88 | text cmback "Back to community machines" |
| 89 | text cmback2 "The part in the salvage yard" |
| 90 | text cmtg2 "/g/" |
| 91 | |
| 92 | note ---- counting |
| 93 | note cm_count: for part id, N (keys counted), K (largest agreeing group), the number of groups, |
| 94 | note whether two groups tie for largest, and whether the largest group's result equals the hub's |
| 95 | note own receipt (glrcpt: slpublic id must have been called) |
| 96 | fn cm_count id view uchar * to void |
| 97 | b = new uchar 8192 0 |
| 98 | put cmgv cmcn 0 |
| 99 | put cmgv cmck 0 |
| 100 | put cmgv cmcg 0 |
| 101 | put cmgv cmctie 0 |
| 102 | put cmgv cmcagr 0 |
| 103 | cm_p0 |
| 104 | cm_pa cmtparts |
| 105 | cm_pa id |
| 106 | cm_pa cmtg2 |
| 107 | fd = fopen cmpth 0 get cmgv cmpl 573440 0 |
| 108 | if lt fd 0 |
| 109 | ret |
| 110 | end |
| 111 | while true bound 9223372036854775807 |
| 112 | n = getdnts int fd b 0 8192 |
| 113 | if le n 0 |
| 114 | break |
| 115 | end |
| 116 | o = ulong 0 |
| 117 | while lt o ulong n bound 8192 |
| 118 | o = add o cm_gent id part b o sub ulong n o |
| 119 | end |
| 120 | end |
| 121 | x = fclose int fd |
| 122 | end |
| 123 | |
| 124 | note cm_gent: one entry of parts/<id>/g/: a "<hash>.v" file names a group |
| 125 | fn cm_gent id view uchar * d view uchar * to ulong |
| 126 | rl = or ulong get d 16 shl ulong get d 17 8 |
| 127 | if lt rl 86 |
| 128 | ret rl |
| 129 | end |
| 130 | if ne get d 85 0 |
| 131 | ret rl |
| 132 | end |
| 133 | if not cm_eq part d 83 2 cmtv |
| 134 | ret rl |
| 135 | end |
| 136 | h = new uchar 64 0 |
| 137 | for i ulong 64 |
| 138 | put h i get d add 19 i |
| 139 | end |
| 140 | if not cm_ishex h |
| 141 | ret rl |
| 142 | end |
| 143 | c = cm_gsize id h |
| 144 | put cmgv cmcn add get cmgv cmcn c |
| 145 | put cmgv cmcg add get cmgv cmcg 1 |
| 146 | k = get cmgv cmck |
| 147 | if gt c k |
| 148 | put cmgv cmck c |
| 149 | put cmgv cmctie 0 |
| 150 | put cmgv cmcagr 0 |
| 151 | if cm_vhub id h |
| 152 | put cmgv cmcagr 1 |
| 153 | end |
| 154 | ret rl |
| 155 | end |
| 156 | if eq c k |
| 157 | put cmgv cmctie 1 |
| 158 | end |
| 159 | ret rl |
| 160 | end |
| 161 | |
| 162 | note cm_gsize: the number of keys in parts/<id>/g/<h>/ |
| 163 | fn cm_gsize id view uchar * h view uchar * to ulong |
| 164 | b = new uchar 8192 0 |
| 165 | cm_p0 |
| 166 | cm_pa cmtparts |
| 167 | cm_pa id |
| 168 | cm_pa cmtg2 |
| 169 | cm_pa h |
| 170 | fd = fopen cmpth 0 get cmgv cmpl 573440 0 |
| 171 | if lt fd 0 |
| 172 | ret 0 |
| 173 | end |
| 174 | c = ulong 0 |
| 175 | while true bound 9223372036854775807 |
| 176 | n = getdnts int fd b 0 8192 |
| 177 | if le n 0 |
| 178 | break |
| 179 | end |
| 180 | c = add c cm_dcnt part b 0 ulong n |
| 181 | end |
| 182 | x = fclose int fd |
| 183 | ret c |
| 184 | end |
| 185 | |
| 186 | note cm_dcnt: entries in a getdents64 buffer other than "." and ".." |
| 187 | fn cm_dcnt b view uchar * to ulong |
| 188 | o = ulong 0 |
| 189 | c = ulong 0 |
| 190 | while lt o len b bound 8192 |
| 191 | rl = or ulong get b add o 16 shl ulong get b add o 17 8 |
| 192 | if eq rl 0 |
| 193 | ret c |
| 194 | end |
| 195 | dot = eq get b add o 19 46 |
| 196 | d1 = and dot eq get b add o 20 0 |
| 197 | d2 = and dot and eq get b add o 20 46 eq get b add o 21 0 |
| 198 | if not or d1 d2 |
| 199 | c = add c 1 |
| 200 | end |
| 201 | o = add o rl |
| 202 | end |
| 203 | ret c |
| 204 | end |
| 205 | |
| 206 | note cm_vhub: the group's triple equals the hub's receipt: binary, stdout, exit 0 |
| 207 | fn cm_vhub id view uchar * h view uchar * to bool |
| 208 | b = new uchar 256 0 |
| 209 | cm_p0 |
| 210 | cm_pa cmtparts |
| 211 | cm_pa id |
| 212 | cm_pa cmtg2 |
| 213 | cm_pa h |
| 214 | cm_pa cmtv |
| 215 | r = cm_rd b |
| 216 | if ne r 132 |
| 217 | ret false |
| 218 | end |
| 219 | for i ulong 64 |
| 220 | if ne get b i get glrcpt add 65 i |
| 221 | ret false |
| 222 | end |
| 223 | if ne get b add 65 i get glrcpt add 129 i |
| 224 | ret false |
| 225 | end |
| 226 | end |
| 227 | ret and eq get b 130 48 eq get b 131 10 |
| 228 | end |
| 229 | |
| 230 | note ---- the record line |
| 231 | fn cm_rline id view uchar * lk bool to void |
| 232 | cm_count id |
| 233 | n = get cmgv cmcn |
| 234 | fput cmp |
| 235 | if eq n 0 |
| 236 | fput cmr0 |
| 237 | fput cmpe |
| 238 | ret |
| 239 | end |
| 240 | k = get cmgv cmck |
| 241 | fput cmr1 |
| 242 | fnum n |
| 243 | if eq n 1 |
| 244 | fput cmr2 |
| 245 | else |
| 246 | fput cmr2s |
| 247 | end |
| 248 | fput cmr3 |
| 249 | fnum k |
| 250 | fput cmr4 |
| 251 | if gt n k |
| 252 | fput cmr5 |
| 253 | fnum sub n k |
| 254 | fput cmr6 |
| 255 | else |
| 256 | fput cmdot |
| 257 | end |
| 258 | if eq get cmgv cmctie 1 |
| 259 | fput cmr7 |
| 260 | end |
| 261 | if and eq n k eq get cmgv cmcagr 1 |
| 262 | fput cmr8 |
| 263 | end |
| 264 | if and eq n k eq get cmgv cmcagr 0 |
| 265 | fput cmr9 |
| 266 | end |
| 267 | fput cmr10 |
| 268 | if lk |
| 269 | fputc 32 |
| 270 | cm_alink cmslpart id cmdet |
| 271 | end |
| 272 | fput cmpe |
| 273 | end |
| 274 | |
| 275 | fn cm_alink a view uchar * id view uchar * t view uchar * to void |
| 276 | fput cmhref |
| 277 | fputb |
| 278 | fput a |
| 279 | fesc id |
| 280 | fput cmhrefe |
| 281 | fput t |
| 282 | fput cmae |
| 283 | end |
| 284 | |
| 285 | note cm_partln: the line on the salvage part page (nothing when the community store is off) |
| 286 | fn cm_partln id view uchar * to void |
| 287 | if not cm_on |
| 288 | ret |
| 289 | end |
| 290 | fput cmh2 |
| 291 | fput cmcmh |
| 292 | fput cmh2e |
| 293 | cm_rline id true |
| 294 | end |
| 295 | |
| 296 | note ---- /community/ |
| 297 | fn cm_index to long |
| 298 | id = new uchar 64 0 |
| 299 | fput cmbase |
| 300 | fput cmh1 |
| 301 | fput cmtitle |
| 302 | fput cmh1e |
| 303 | fput cmp |
| 304 | fput cmintro |
| 305 | fput cmpe |
| 306 | fput cmh2 |
| 307 | fput cmjoinh |
| 308 | fput cmh2e |
| 309 | fput cmpre |
| 310 | fput cmjoin |
| 311 | fput cmpree |
| 312 | fput cmp |
| 313 | fput cmjoinp |
| 314 | fput cmpe |
| 315 | fput cmh2 |
| 316 | fput cmplath |
| 317 | fput cmh2e |
| 318 | fput cmplat |
| 319 | fput cmh2 |
| 320 | fput cmdoesh |
| 321 | fput cmh2e |
| 322 | fput cmdoes |
| 323 | fput cmh2 |
| 324 | fput cmneverh |
| 325 | fput cmh2e |
| 326 | fput cmp |
| 327 | fput cmnever |
| 328 | fput cmpe |
| 329 | fput cmh2 |
| 330 | fput cmstoph |
| 331 | fput cmh2e |
| 332 | fput cmpre |
| 333 | fput cmstop |
| 334 | fput cmpree |
| 335 | fput cmp |
| 336 | fput cmstopp |
| 337 | fput cmpe |
| 338 | fput cmh2 |
| 339 | fput cmruleh |
| 340 | fput cmh2e |
| 341 | fput cmp |
| 342 | fput cmrule |
| 343 | fput cmpe |
| 344 | cm_runners |
| 345 | fput cmh2 |
| 346 | fput cmpartsh |
| 347 | fput cmh2e |
| 348 | shown = ulong 0 |
| 349 | n = get glidxn 0 |
| 350 | for ix ulong n bound 1000000 |
| 351 | pos = sub sub n ix 1 |
| 352 | for i ulong 64 |
| 353 | put id i get glidx add mul pos 65 i |
| 354 | end |
| 355 | if cm_ispart id |
| 356 | cm_pcard id |
| 357 | shown = add shown 1 |
| 358 | end |
| 359 | end |
| 360 | if eq shown 0 |
| 361 | fput cmp |
| 362 | fput cmnopart |
| 363 | fput cmpe |
| 364 | end |
| 365 | cm_devfoot |
| 366 | fput cmclose |
| 367 | ret 200 |
| 368 | end |
| 369 | |
| 370 | fn cm_ispart id view uchar * to bool |
| 371 | if not slpublic id |
| 372 | ret false |
| 373 | end |
| 374 | ret eq get glrec 8 2 |
| 375 | end |
| 376 | |
| 377 | note cm_pcard: the part's title (linking to the yard) and its record line |
| 378 | fn cm_pcard id view uchar * to void |
| 379 | fput cmcard |
| 380 | fput cmhref |
| 381 | fputb |
| 382 | fput cmslsal |
| 383 | fesc id |
| 384 | fput cmhrefe |
| 385 | slesc 1 |
| 386 | fput cmae |
| 387 | cm_rline id true |
| 388 | fput cmcarde |
| 389 | end |
| 390 | |
| 391 | fn cm_devfoot to void |
| 392 | fput cmh2 |
| 393 | fput cmdevh |
| 394 | fput cmh2e |
| 395 | fput cmp |
| 396 | fput cmdev |
| 397 | fputc 32 |
| 398 | fput cmhref |
| 399 | fputb |
| 400 | fput cmled |
| 401 | fputb |
| 402 | fput cmrefl |
| 403 | fputb |
| 404 | fput cmsums |
| 405 | fput cmh2 |
| 406 | fput cmfilesh |
| 407 | fput cmh2e |
| 408 | fput cmpre |
| 409 | cm_sumsout |
| 410 | fput cmpree |
| 411 | fput cmp |
| 412 | fput cmolder |
| 413 | cm_archls |
| 414 | fput cmpe |
| 415 | end |
| 416 | |
| 417 | note cm_archls: links to every ledger.<seconds> and refused.<seconds> in the store root |
| 418 | fn cm_archls to void |
| 419 | b = new uchar 8192 0 |
| 420 | cm_p0 |
| 421 | fd = fopen cmpth 0 get cmgv cmpl 573440 0 |
| 422 | if lt fd 0 |
| 423 | ret |
| 424 | end |
| 425 | while true bound 9223372036854775807 |
| 426 | n = getdnts int fd b 0 8192 |
| 427 | if le n 0 |
| 428 | break |
| 429 | end |
| 430 | o = ulong 0 |
| 431 | while lt o ulong n bound 8192 |
| 432 | o = add o cm_archent part b o sub ulong n o |
| 433 | end |
| 434 | end |
| 435 | x = fclose int fd |
| 436 | end |
| 437 | |
| 438 | fn cm_archent d view uchar * to ulong |
| 439 | nm = new uchar 64 0 |
| 440 | n2 = new uchar 64 0 |
| 441 | rl = or ulong get d 16 shl ulong get d 17 8 |
| 442 | nl = ulong 0 |
| 443 | while lt add 19 nl rl bound 256 |
| 444 | if eq get d add 19 nl 0 |
| 445 | break |
| 446 | end |
| 447 | nl = add nl 1 |
| 448 | end |
| 449 | if or eq nl 0 gt nl 60 |
| 450 | ret rl |
| 451 | end |
| 452 | for i ulong nl bound 64 |
| 453 | put nm i get d add 19 i |
| 454 | end |
| 455 | if cm_archok part nm 0 nl |
| 456 | for i ulong nl bound 64 |
| 457 | put n2 i get nm i |
| 458 | end |
| 459 | fputc 32 |
| 460 | cm_alink cmslug part nm 0 nl part n2 0 nl |
| 461 | end |
| 462 | ret rl |
| 463 | end |
| 464 | |
| 465 | note cm_sumsout: dist/SHA256SUMS, escaped |
| 466 | fn cm_sumsout to void |
| 467 | b = new uchar 4096 0 |
| 468 | cm_q0 |
| 469 | cm_pa cmtdist |
| 470 | cm_pa cmtsums |
| 471 | r = cm_rd b |
| 472 | if gt r 0 |
| 473 | fesc part b 0 ulong r |
| 474 | end |
| 475 | end |
| 476 | |
| 477 | note ---- /community/part/<id> |
| 478 | fn cm_partpage id view uchar * to long |
| 479 | if not cm_ispart id |
| 480 | ret 404 |
| 481 | end |
| 482 | fput cmbase |
| 483 | fput cmp |
| 484 | cm_alink cmslug id cmback |
| 485 | fput cmpe |
| 486 | fput cmh1 |
| 487 | slesc 1 |
| 488 | fput cmh1e |
| 489 | cm_rline id false |
| 490 | fput cmp |
| 491 | cm_alink cmslsal id cmback2 |
| 492 | fput cmpe |
| 493 | x = slpublic id |
| 494 | fput cmp |
| 495 | fput cmown |
| 496 | fput tlpin |
| 497 | fput cmownb |
| 498 | cm_rcp 65 |
| 499 | fput cmowno |
| 500 | cm_rcp 129 |
| 501 | fput cmowne |
| 502 | fput cmpe |
| 503 | fput cmtab |
| 504 | cm_rows id |
| 505 | fput cmtabe |
| 506 | fput cmclose |
| 507 | ret 200 |
| 508 | end |
| 509 | |
| 510 | fn cm_rcp o ulong to void |
| 511 | for i ulong 64 |
| 512 | fputc get glrcpt add o i |
| 513 | end |
| 514 | end |
| 515 | |
| 516 | note cm_rows: one table row per counted key (parts/<id>/k/<key>) |
| 517 | fn cm_rows id view uchar * to void |
| 518 | b = new uchar 8192 0 |
| 519 | cm_p0 |
| 520 | cm_pa cmtparts |
| 521 | cm_pa id |
| 522 | cm_pa cmtk |
| 523 | fd = fopen cmpth 0 get cmgv cmpl 573440 0 |
| 524 | if lt fd 0 |
| 525 | ret |
| 526 | end |
| 527 | while true bound 9223372036854775807 |
| 528 | n = getdnts int fd b 0 8192 |
| 529 | if le n 0 |
| 530 | break |
| 531 | end |
| 532 | o = ulong 0 |
| 533 | while lt o ulong n bound 8192 |
| 534 | o = add o cm_row id part b o sub ulong n o |
| 535 | end |
| 536 | end |
| 537 | x = fclose int fd |
| 538 | end |
| 539 | |
| 540 | note cm_row: a key's row from "<binary> <stdout> <exit> <time> <message sha>\n" |
| 541 | note The length test and the byte read are two ifs: or is eager in Omega, so a short entry ("." or |
| 542 | note "..", 24 bytes) that ends the getdents buffer would otherwise be read past its end at byte 83 |
| 543 | note (trap 3; the live store lists ".." last, 2026-11-11). |
| 544 | fn cm_row id view uchar * d view uchar * to ulong |
| 545 | rl = or ulong get d 16 shl ulong get d 17 8 |
| 546 | if lt rl 84 |
| 547 | ret rl |
| 548 | end |
| 549 | if ne get d 83 0 |
| 550 | ret rl |
| 551 | end |
| 552 | k = new uchar 64 0 |
| 553 | b = new uchar 512 0 |
| 554 | for i ulong 64 |
| 555 | put k i get d add 19 i |
| 556 | end |
| 557 | if not cm_ishex k |
| 558 | ret rl |
| 559 | end |
| 560 | cm_p0 |
| 561 | cm_pa cmtparts |
| 562 | cm_pa id |
| 563 | cm_pa cmtk |
| 564 | cm_pa k |
| 565 | r = cm_rd b |
| 566 | if lt r 140 |
| 567 | ret rl |
| 568 | end |
| 569 | cm_rowout k part b 0 ulong r |
| 570 | ret rl |
| 571 | end |
| 572 | |
| 573 | note cm_rowout: fields of b are binary(64) sp stdout(64) sp exit sp time sp msgsha(64) LF |
| 574 | fn cm_rowout k view uchar * b view uchar * to void |
| 575 | kk = new uchar 64 0 |
| 576 | for i ulong 64 |
| 577 | put kk i get k i |
| 578 | end |
| 579 | e = cm_spn b 130 |
| 580 | t = cm_spn b add e 1 |
| 581 | if gt add t 65 len b |
| 582 | ret |
| 583 | end |
| 584 | fput cmtr |
| 585 | cm_alink cmslkey k kk |
| 586 | fput cmtd |
| 587 | fesc part b add e 1 sub t add e 1 |
| 588 | fput cmtd |
| 589 | fesc part b 130 sub e 130 |
| 590 | fput cmtd |
| 591 | fesc part b 0 64 |
| 592 | fput cmtd |
| 593 | fesc part b 65 64 |
| 594 | fput cmtd |
| 595 | cm_alink cmslmsg part b add t 1 64 cmdet |
| 596 | fput cmtre |
| 597 | end |
| 598 | |
| 599 | note cm_spn: the index of the first space in b at or after i (len b when none) |
| 600 | fn cm_spn b view uchar * i ulong to ulong |
| 601 | j = i |
| 602 | while lt j len b bound 512 |
| 603 | if eq get b j 32 |
| 604 | ret j |
| 605 | end |
| 606 | j = add j 1 |
| 607 | end |
| 608 | ret j |
| 609 | end |
| 610 | |
| 611 | note ---- runners now (on /community/): the registered keys and Interplane's note on its own runners |
| 612 | note cmkc: keys counted (first pass) or rows written (second pass) |
| 613 | note cmke: key entries looked at in this pass; cmkcap: 1 when a pass stopped at cmkmax entries. Keys |
| 614 | note are free to make, so each pass reads at most cmkmax key files (one forged serves every request). |
| 615 | const cmkc ulong 15 |
| 616 | const cmke ulong 16 |
| 617 | const cmkcap ulong 17 |
| 618 | const cmkmax ulong 200 |
| 619 | fn cm_runners to void |
| 620 | put cmgv cmkc 0 |
| 621 | put cmgv cmke 0 |
| 622 | put cmgv cmkcap 0 |
| 623 | cm_kscan 0 |
| 624 | n = get cmgv cmkc |
| 625 | capped = get cmgv cmkcap |
| 626 | fput cmh2 |
| 627 | fput cmrunh |
| 628 | fput cmh2e |
| 629 | fput cmp |
| 630 | if eq capped 1 |
| 631 | fput cmrunal |
| 632 | end |
| 633 | fnum n |
| 634 | if eq n 1 |
| 635 | fput cmrun1 |
| 636 | else |
| 637 | fput cmrun1s |
| 638 | end |
| 639 | fput cmrun2 |
| 640 | if eq capped 1 |
| 641 | fput cmrcap |
| 642 | end |
| 643 | fput cmpe |
| 644 | note the note is a file the operator writes in the read-only root (beside deny); absent: no note |
| 645 | b = new uchar 2048 0 |
| 646 | cm_q0 |
| 647 | cm_pa cmtnote |
| 648 | r = cm_rd b |
| 649 | if gt r 0 |
| 650 | fput cmp |
| 651 | fput cmnoteh |
| 652 | fesc part b 0 ulong r |
| 653 | fput cmpe |
| 654 | end |
| 655 | if eq n 0 |
| 656 | ret |
| 657 | end |
| 658 | fput cmrtab |
| 659 | put cmgv cmkc 0 |
| 660 | put cmgv cmke 0 |
| 661 | put cmgv cmkcap 0 |
| 662 | cm_kscan 1 |
| 663 | fput cmtabe |
| 664 | if eq capped 1 |
| 665 | fput cmp |
| 666 | fput cmrmore |
| 667 | fput cmpe |
| 668 | end |
| 669 | end |
| 670 | |
| 671 | note cm_kscan: every entry of keys/; m 0 counts registered keys, m 1 writes their rows (first 200) |
| 672 | fn cm_kscan m ulong to void |
| 673 | b = new uchar 8192 0 |
| 674 | cm_p0 |
| 675 | cm_pa cmtkeys |
| 676 | fd = fopen cmpth 0 get cmgv cmpl 573440 0 |
| 677 | if lt fd 0 |
| 678 | ret |
| 679 | end |
| 680 | while true bound 9223372036854775807 |
| 681 | n = getdnts int fd b 0 8192 |
| 682 | if le n 0 |
| 683 | break |
| 684 | end |
| 685 | o = ulong 0 |
| 686 | while lt o ulong n bound 8192 |
| 687 | o = add o cm_kent part b o sub ulong n o m |
| 688 | end |
| 689 | note stop once the entry cap is hit (cmkcap). Not on the row count: the counting pass must see the |
| 690 | note 201st key entry to know it stopped early, else 200 keys would be shown as an exact count. |
| 691 | if eq get cmgv cmkcap 1 |
| 692 | break |
| 693 | end |
| 694 | end |
| 695 | x = fclose int fd |
| 696 | end |
| 697 | |
| 698 | note cm_kent: one entry of keys/. A registered key file is "<public key, 130 hex> <rate> <time> j\n" |
| 699 | note (cm_kwrite). Every length test is its own if before the read it protects (or and and are eager). |
| 700 | fn cm_kent d view uchar * m ulong to ulong |
| 701 | rl = or ulong get d 16 shl ulong get d 17 8 |
| 702 | if lt rl 84 |
| 703 | ret rl |
| 704 | end |
| 705 | if ne get d 83 0 |
| 706 | ret rl |
| 707 | end |
| 708 | k = new uchar 64 0 |
| 709 | for i ulong 64 |
| 710 | put k i get d add 19 i |
| 711 | end |
| 712 | if not cm_ishex k |
| 713 | ret rl |
| 714 | end |
| 715 | e = get cmgv cmke |
| 716 | if ge e cmkmax |
| 717 | put cmgv cmkcap 1 |
| 718 | ret rl |
| 719 | end |
| 720 | put cmgv cmke add e 1 |
| 721 | cm_krow k m |
| 722 | ret rl |
| 723 | end |
| 724 | |
| 725 | note cm_krow: key k counted (m 0) or its row written (m 1) when keys/<k> is a registered key file |
| 726 | fn cm_krow k view uchar * m ulong to void |
| 727 | b = new uchar 512 0 |
| 728 | cm_p0 |
| 729 | cm_pa cmtkeys |
| 730 | cm_pa k |
| 731 | r = cm_rd b |
| 732 | if lt r 137 |
| 733 | ret |
| 734 | end |
| 735 | n = ulong r |
| 736 | if ne get b sub n 1 10 |
| 737 | ret |
| 738 | end |
| 739 | if ne get b sub n 2 106 |
| 740 | ret |
| 741 | end |
| 742 | if ne get b sub n 3 32 |
| 743 | ret |
| 744 | end |
| 745 | c = get cmgv cmkc |
| 746 | if eq m 0 |
| 747 | put cmgv cmkc add c 1 |
| 748 | ret |
| 749 | end |
| 750 | if ge c 200 |
| 751 | ret |
| 752 | end |
| 753 | e = cm_spn part b 0 n 131 |
| 754 | if ge e sub n 3 |
| 755 | ret |
| 756 | end |
| 757 | t = cm_spn part b 0 n add e 1 |
| 758 | if ne t sub n 3 |
| 759 | ret |
| 760 | end |
| 761 | put cmgv cmkc add c 1 |
| 762 | kk = new uchar 64 0 |
| 763 | for i ulong 64 |
| 764 | put kk i get k i |
| 765 | end |
| 766 | fput cmtr |
| 767 | cm_alink cmslkey k kk |
| 768 | fput cmtd |
| 769 | fesc part b add e 1 sub t add e 1 |
| 770 | fput cmtd |
| 771 | fesc part b 131 sub e 131 |
| 772 | fput cmtre |
| 773 | end |