Repository navigation
feat(u4): add embedded threshold mask - #137
Conversation
|
Review: changes required before merge. The vector result reverses the documented input order. The loop consumes the bottom input first using OP_ROLL, then restores staged results in reverse order. On input [1,2,3] bottom-to-top, the threshold(2), equality(1), trichotomy(2), and clamp(2) cases fail their documented ordered output checks and succeed with the reversed expected vectors. Preserve the documented order and add asymmetric input/output vectors, including preserved main/alt-stack state. Evidence: Reviewed commit: |
4050076 to
2583e72
Compare
|
Addressed the review comment in commit
Tests passed: |
|
Review of The revised top-input schedule addresses the earlier reversed output order. Preserve asymmetric threshold vectors and exact stack-frontier coverage; rebase and rerun the threshold library/metric checks and KB validation. Current integration conflicts: Validation scope: source/diff and existing CI review; no new full-repository or field-arithmetic test run was requested. |
Resolve the six integration conflicts Robin listed by keeping every entry from both sides: catalog records (main 101 + arithmetic/u4-threshold = 102), the metric fixture beside u4_parity_metrics_are_current, the u4 module declaration, the primitives index, the arithmetic comparison row, and the u4 README API bullet, metric row, and witness sentence. The threshold README bullet adopts main's note that the range check does not establish canonical ScriptNum encoding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add an asymmetric positional test over every threshold 0..=15 using threshold-1, threshold, threshold+1, 0, and 15 between preserved main and alt-stack sentinels, comparing the full bottom-to-top final stack. Add an exact-frontier test deriving the maximum preserved state from U4_LT_MASK_MAX_BATCH for batches 1, 16, 500, and 998, with main-only and split main/alt preservation: the maximum reaches a 1,000-item peak and one more item fails with StackSize. Register both tests in the catalog and describe the coverage on the knowledge page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed in
Validation on the committed HEAD with a clean tree:
No field-arithmetic or full-repository run was performed. Evidence remains This head was subsequently integrated into |
Summary\n- add a range-checked u4 batch primitive that returns one Boolean for each nibble below an embedded public threshold\n- use bottom-to-top OP_ROLL scheduling so altstack restoration returns masks in the original order\n- document the canonical-byte boundary, limitations, catalog record, comparison, and exact metrics\n\n## Evidence\n- focused unit tests: cargo test --locked arithmetic::u4::threshold::tests --lib\n- exact metric fixture: cargo test --locked --test primitive_metrics u4_lt_mask_metrics_are_current -- --exact\n- knowledge validation: python3 tools/kb.py validate\n- formatting, JSON, and diff checks pass\n- representative 16-nibble fragment: 218 script bytes, 33 witness bytes, 18 strict peak stack items, 157 static non-push opcodes\n- execution class remains unclassified; no Bitcoin Core consensus or relay-policy validation is claimed\n\nThe full repository test suite was skipped intentionally.