Skip to content

feat(u4): add canonical LSB projection - #196

Closed
brenorb wants to merge 1 commit into
solving-bitcoin:mainfrom
brenorb:feat/u4-canonical-lsb-next
Closed

brenorb wants to merge 1 commit into
solving-bitcoin:mainfrom
brenorb:feat/u4-canonical-lsb-next

Conversation

@brenorb

@brenorb brenorb commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add u4_nibbles_to_lsb_canonical() for minimally encoded hostile u4 batches
  • preserve the existing numeric-range-only projection for callers with an external canonicality proof
  • return one least-significant-bit item per nibble with the shared 16-item lookup table
  • add reference, malformed-input, stack-preservation, metric, and documentation coverage

Measurements

  • 504-byte canonical fragment for 32 nibbles versus 440 bytes for the numeric-only path
  • 65-byte representative witness across 32 data items
  • 51-item strict stack peak and 360 static non-push opcodes
  • no hints; 16 table items are resident during lookup

Verification

  • cargo fmt --all -- --check
  • python3 tools/kb.py validate
  • git diff --check
  • focused Rust execution was not run locally because the host is out of disk space; CI is authoritative

This is a locally reproduced, unclassified bit-projection fragment. It makes no consensus, policy, or cryptographic-security claim.

Copy link
Copy Markdown
Contributor

Review: changes required before merge.

The canonical wrapper retains a maximum batch size of 982, but its stronger validator adds one stack item to the peak. Strict local executions succeed at 981 and fail at 982 for otherwise valid inputs. Give the canonical variant its own maximum (981 without unrelated state), update composition/peak documentation, and add exact-boundary tests.

Evidence: locally-reproduced against the proposed implementation; local fragment execution only, deployment unclassified. This is not Bitcoin Core or complete-spend validation. Run the affected module tests and focused metric check after the fix.

Reviewed commit: 92d26baf1b5967503e4286da37f6d2d1e3660667.

@brenorb

brenorb commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #113. The reviewer confirmed this branch repeats the same implementation; #113 already contains the separate 981-input canonical bound, boundary regression, composition docs, and corrected catalog placement.

@brenorb brenorb closed this Sep 19, 2026
@brenorb
brenorb deleted the feat/u4-canonical-lsb-next 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