Skip to content

feat(arithmetic): add signed radix-32 window decoder - #2

Merged
RobinLinus merged 1 commit into
solving-bitcoin:mainfrom
brenorb:feat/signed-radix32-window-decoder
Sep 16, 2026
Merged

RobinLinus merged 1 commit into
solving-bitcoin:mainfrom
brenorb:feat/signed-radix32-window-decoder

Conversation

@brenorb

@brenorb brenorb commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a checked signed radix-32 ScriptNum decoder for digits in [-31, 31]
  • use a shared staggered magnitude lookup table for batch decoding
  • add deterministic correctness, malformed-input, adversarial, stack-boundary, and benchmark coverage
  • document measurements, comparison boundaries, limitations, negative results, and the next open problem

At 32 digits, the table construction measures 1,866 script bytes versus 2,430 for the like-for-like conditional-branch baseline, with a higher peak stack of 348 items versus 194.

Verification

  • cargo test --locked arithmetic::signed_window --lib
  • cargo test --locked --test primitive_metrics signed_window_metrics_are_current
  • cargo test --locked --test knowledge_base
  • cargo fmt --all -- --check
  • python3 tools/kb.py validate
  • cargo run --locked --release --example signed_window_benchmark

The full repository test suite was not completed, per request; its long-running generated-script tests were intentionally skipped for this PR.

@RobinLinus

Copy link
Copy Markdown
Contributor

Review recommendation: include after integration checks.

The signed-radix-32 decoder is a useful distinct primitive. Keep its signed-window input/output contract explicit and retain the boundary tests and focused metric check. Resolve the new catalog/negative-result IDs against #1 during integration.

Local validation: python3 tools/kb.py validate passed; 3 selected library tests passed; the active focused metric check passed. These are targeted local checks, not a full-suite or complete-spend validation. Results using a stack-limit-disabled execution helper remain research-unlimited.

Integration: rebase on #1, resolve any colliding catalog/NR/OP IDs, and run active metrics plus CI on the combined head (cargo test --locked -- --skip fields::).

Reviewed commit: fe96e0591bf51080771f98302dfb3012f81436b3.

@RobinLinus
RobinLinus merged commit 4715e84 into solving-bitcoin:main Sep 16, 2026
@brenorb
brenorb deleted the feat/signed-radix32-window-decoder 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