Repository navigation
test(u32): strengthen checked zero predicate coverage - #235
Conversation
|
Review of The new boundary tests are useful, but the claimed implementation defect is not reproduced. Holding this version for the concrete change above. Validation scope: source/diff and existing CI review; no new full-repository or field-arithmetic test run was requested. |
|
Addressed in 0b825a7, integrated with main at e9d5a66. You were right: runtime witnesses with a nonzero limb at each of the four positions return false under both the original and proposed generators. Removed the redundant OP_DUP/OP_DROP change; the policy-produced fragment is again 53 bytes with 37 static non-push opcodes. The PR title/description now reflect test and contract coverage, not an implementation bug fix. Retained the boundary, preserved-state, and stack-frontier tests. Added a reusable runtime-witness contract check with a valid-input control using the same OP_DROP OP_TRUE cleanup as the negative cases. It checks -1 and 256 at every position for Verify, and five-byte numeric limbs for ScriptIntNumericOverflow. A validation-bypass mutation is caught by that same contract check at the malformed-input assertion. Also corrected the catalog label to distinguish the four-byte unchecked stack helper from the checked predicate. Validation on the integrated tree: 8 focused library tests, the named u32_zero_metrics_are_current fixture, KB validation, rustfmt, and git diff --check passed. The raw-witness contract and frontier checks use local tapscript execution with the combined stack limit enabled; the retained non-strict helper tests remain research-unlimited. No Bitcoin Core consensus or relay-policy claim is added. No broad repository or field-arithmetic suite was run. |
Summary
Keep the checked u32 zero predicate's existing generator and 53-byte policy-produced fragment. Add runtime-witness contract coverage for nonzero limbs at every position, malformed and oversized limbs, preserved stack state, and the combined stack frontier. Clarify the checked versus unchecked helper contract and restore the 37 static non-push opcode metric.
Validation
cargo test --locked --lib arithmetic::u32::zerocargo test --locked --test primitive_metrics u32_zero_metrics_are_current -- --exactpython3 tools/kb.py validaterustfmt --edition 2021 --check src/arithmetic/u32/zero.rsgit diff --checkThe new raw-witness contract and stack-frontier checks use the strict local tapscript executor with its combined stack limit enforced. Existing vector tests that use the stack-limit-disabled helper remain local research evidence. These checks do not establish Bitcoin Core consensus or relay-policy validity.