Skip to content

Add Nock 4K reference test vectors#4

Open
sigilante wants to merge 7 commits intomainfrom
sigilante/nock-norms
Open

Add Nock 4K reference test vectors#4
sigilante wants to merge 7 commits intomainfrom
sigilante/nock-norms

Conversation

@sigilante
Copy link
Collaborator

63 test cases covering all 12 opcodes (0-11) plus auto-cons, as subject/formula/result triples in machine-legible JSON with generated Markdown reference table.

Includes Python scripts to regenerate the Markdown (generate.py) and validate against a live runtime via urbit eval (validate.py).

sigilante and others added 2 commits March 12, 2026 15:33
63 test cases covering all 12 opcodes (0-11) plus auto-cons,
as subject/formula/result triples in machine-legible JSON with
generated Markdown reference table.

Includes Python scripts to regenerate the Markdown (generate.py)
and validate against a live runtime via urbit eval (validate.py).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sigilante sigilante marked this pull request as draft March 12, 2026 20:41
sigilante and others added 4 commits March 12, 2026 15:58
Matrix multiplication (mmul): 10x10 procedurally generated matrices,
uses /lib/tiny with a turn extension.

SHA-512 (sha512): hashes 'abc' (3 bytes), extends tiny with ror, net,
inv, run arms needed for the SHA-512 algorithm. Implementation follows
the shal arm from hoon.hoon.

Moves both from Desired to Supplied in README.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace /+ tiny imports with inlined arms using |^ core pattern.
All arms are compiled into the nock formula via !=, making each
benchmark fully self-contained without external library dependencies.

Files converted: atomcat, atomdog, atomgmp, bigslot, mmul, sha512, sieve

Also fixes:
- con (binary OR) implementation: was computing XOR, now correct
- Replace bloq/step/bite stdlib types with bare @ types
- Use raw noun types (*) for list-like structures

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Regenerate ackermann and sieve nock/noun files with current compiler.
Add nock/noun files for: add, atomcat, atomdog, atomgmp, bigslot,
dec, factorial, fibonacci, mmul, sha512.

.nock files contain the [subject formula] cell as compact text.
.noun files contain the jammed binary representation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
New: desk/bar/tests.json with expected results for all 12 benchmarks.
Each entry has name, description, subject, default_subject, and result.
Slow benchmarks use smaller test subjects (e.g. factorial 5 not 40).
Hardcoded benchmarks (atomcat/dog/gmp, sha512) have results computed
via stdlib since naive Nock is too slow to verify directly.

Fix: atomgmp.hoon used n=(bex 128) which made m < n, causing
sub to underflow. Changed to n=(bex 127) to match the atomcat/dog
pattern where m=(dec (bex N)), n=(bex N/2).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sigilante sigilante marked this pull request as ready for review March 12, 2026 22:15
@sigilante
Copy link
Collaborator Author

This adds Nock, jammed noun, and Hoon examples along with a battery of Nock subject/formula/result triplets for each opcode.

@sigilante
Copy link
Collaborator Author

sigilante commented Mar 12, 2026

I can merge unilaterally but if anyone at UF can review I'd appreciate it. @dozreg-toplud @matthew-levan @midden-fabler

- Document that all benchmarks are now self-contained (no /+ tiny)
- List .hoon, .nock, .noun, and tests.json as included files
- Add Nock Reference Tests section pointing to norm/
- Rename 'Reporting' to 'Running' for the execution instructions section

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant