Skip to content

test(u4): strengthen parity boundary coverage - #233

Merged
RobinLinus merged 2 commits into
solving-bitcoin:mainfrom
brenorb:fix/u4-parity-boundaries
Sep 25, 2026
Merged

RobinLinus merged 2 commits into
solving-bitcoin:mainfrom
brenorb:fix/u4-parity-boundaries

Conversation

@brenorb

@brenorb brenorb commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • clarify that parity inputs are range-checked, not canonically encoded
  • replace the palindromic ordering blind spot with asymmetric output coverage
  • reject malformed and oversized numeric inputs at every position with clean-stack checks
  • validate the 982-item/1,000-stack frontier and preserved main/alt-stack state

Validation

  • cargo test --locked --lib arithmetic::u4::parity
  • cargo test --locked --test primitive_metrics u4_parity_metrics_are_current -- --exact
  • python3 tools/kb.py validate
  • rustfmt --edition 2021 --check src/arithmetic/u4/parity.rs
  • git diff --check

The repository-wide test suite was not run. The focused parity suite took 287.7s because it executes the absolute 982-item OP_ROLL frontier.

@RobinLinus
RobinLinus merged commit 15926a8 into solving-bitcoin:main Sep 25, 2026
3 checks passed
brenorb added a commit to brenorb/bitcoin-scripts that referenced this pull request Sep 28, 2026
…ests with canonical API

Resolve conflicts against origin/main 3d1001f in src/arithmetic/u4/parity.rs,
src/arithmetic/u4/README.md, src/arithmetic/u4/mod.rs and
knowledge/comparisons/arithmetic.md.

- parity.rs: keep solving-bitcoin#233's numeric-range API, docs and all five tests
  (projects_all_nibble_parities_in_order, distinguishes_asymmetric_output_order,
  rejects_out_of_range_nibbles, rejects_zero_and_overlarge_batches,
  respects_combined_stack_frontier) plus the PR's four canonical tests and the
  separate U4_PARITY_CANONICAL_MAX_BATCH = 981 bound.
- mod.rs: main's module list is a superset of the PR's sorted list.
- README/comparison: keep rows from both sides; describe the numeric-range
  and canonical APIs separately.
- Knowledge page and catalog: split the numeric-range and canonical-encoding
  descriptions; the range-only API is not claimed to enforce canonical
  encoding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@brenorb
brenorb deleted the fix/u4-parity-boundaries branch October 28, 2026 02:57
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.

2 participants