Repository navigation
feat(u4): add embedded equality mask - #138
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: |
16fdc6d to
a0488ed
Compare
|
Updated in commit
Checks passed: focused equality tests, all 34 non-ignored |
|
Review of The revised schedule and numeric equality address the earlier output-order and byte-alias concerns. Preserve asymmetric equality masks and numeric-alias cases; rebase and rerun the equality-mask 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 integration conflicts in knowledge/catalog.json, knowledge/comparisons/arithmetic.md, knowledge/primitives/index.md, src/arithmetic/u4/README.md, src/arithmetic/u4/mod.rs and tests/primitive_metrics.rs by keeping every entry from both sides. - catalog.json: all 101 main records unchanged plus the PR's arithmetic/u4-equality record (102 records, 257 configurations, no duplicate ids). - primitive_metrics.rs: all 113 main #[test] fns plus u4_eq_mask_metrics_are_current (114, no duplicates). - mod.rs, README, index and comparison tables: main's rows plus the PR's equality rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Address the review request to preserve asymmetric equality masks and numeric-alias cases after integrating main. - Run raw-witness alias tests under the explicit local TapscriptProfile::Consensus profile (require_minimal: false, stack limit enforced) with a clean-stack OP_TRUE assertion, matching the alias contract used by the adjacent-equality mask. - Add a non-palindromic mixed-alias vector (target 1, mask [1,0,1,0,1,0]) with a canonical control and a Policy-profile MinimalData rejection control. - Add test-only mutants of the historical 16fdc6d implementation: the OP_EQUAL comparator fails with Verify and the reversed OP_ROLL output schedule fails with NumEqualVerify on the same complete leaf. - Correct the catalog record: script_bytes 218 -> 190 (stale value from 16fdc6d; per_use_script_bytes and the README metric already read 190) and witness_bytes_max 33 -> null, because permitted numeric aliases can exceed the 33-byte canonical fixture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed in
Metrics were not refreshed.
These runs use compiler Validation on the committed head with a clean tree:
No field-arithmetic or full-repository test run was performed. This head was subsequently integrated into |
Summary\n- add a range-checked u4 batch primitive that returns one Boolean for each nibble equal to an embedded public target\n- use bottom-to-top OP_ROLL scheduling so altstack restoration returns masks in the original order\n- document the canonical-byte boundary, comparison with aggregate counting and lookup projections, catalog record, and exact metrics\n\n## Evidence\n- focused unit tests: cargo test --locked arithmetic::u4::equality::tests --lib\n- exact metric fixture: cargo test --locked --test primitive_metrics u4_eq_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.