Repository navigation
feat(u4): document word stack transfers - #49
Conversation
|
Review: changes needed before merge. Fold the existing word-transfer documentation/tests into the shared stack/router package, with consistent preservation and ordering assertions. Historical local validation (September 11, at this unchanged PR head): The new metric markers are only added to the ignored aggregate metric collection; add an active, focused metric check for these documented configurations. Rebase the documentation and catalog on current main, preserving the existing configurations, and rerun only the affected checks. Reviewed commit: |
09a75bd to
6b1ac69
Compare
|
Updated in place and rebased onto current main. Consolidated the shared word-transfer coverage requested by #37: raw-item/address documentation, preservation/order tests at depths 0 and 8, strict 992/993 copy and 999/1000 move boundaries, and active copy/move metrics with runtime witnesses and strict stack peaks. Removed the old ignored duplicate metric entries. Checks: |
|
Consolidated #48 into this PR. Added explicit one-way and roundtrip ordering tests, zero-item and both-direction underflow checks, and active u4_toaltstack(4)/u4_fromaltstack(4) metrics. The docs now state that each one-way transfer reverses the moved group, while a complete roundtrip preserves order and older stack state; the representative witness is 8 bytes with a 9-byte maximum. Required checks passed: cargo fmt --all -- --check, python3 tools/kb.py validate, git diff --cached --check, focused transport tests, and cargo test --locked --test primitive_metrics (107 passed, 1 ignored). |
|
Consolidated #50 into this PR. Added the staged verifier’s raw-byte contract, sentinel preservation, mismatch coverage at all eight positions, canonical/noncanonical encoding behavior, and both main/altstack underflow checks. Added an active metric check for the 29-byte, 33-byte-witness, 17-item-peak, 23-non-push-opcode verifier boundary; staging and terminal predicates are excluded from fragment size. Required checks passed: cargo fmt --all -- --check, python3 tools/kb.py validate, git diff --cached --check, focused verifier tests, and cargo test --locked --test primitive_metrics (108 passed, 1 ignored). |
|
Consolidated #53 into this PR. Added active lifecycle metrics for the 16-item triangular and 17-item linear offset tables, exact schedule tests, sentinel-preservation tests, matching-cleanup coverage, wrong-width failure, leftover-width behavior, and explicit over-cleanup consumption. Documentation now distinguishes offset tables from complete Boolean lookup memory and records caller-owned depth/cleanup obligations. Required checks passed: cargo fmt --all -- --check, python3 tools/kb.py validate, git diff --cached --check, focused lookup tests, and cargo test --locked --test primitive_metrics (109 passed, 1 ignored). |
|
Added the remaining #56 regression to this consolidated package.\n\nThe new test supplies exactly 16 runtime items and verifies that both and fail with . It deliberately does not carry over #56's stale stack/metric probes; the existing active #49 metrics remain authoritative.\n\nChecks:\n- cargo fmt --all -- --check\n- python3 tools/kb.py validate\n- git diff --cached --check\n- cargo test --locked --lib arithmetic::u4::stack::tests — 24 passed\n- cargo test --locked --test primitive_metrics u4_word_transfer_metrics_are_current — passed |
|
Correction to the previous note: added the remaining #56 regression to this consolidated package. The new test supplies exactly 16 runtime items and verifies that both u4_copy_u32_from(9) and u4_move_u32_from(9) fail with InvalidStackOperation. It deliberately does not carry over #56's stale stack/metric probes; the existing active #49 metrics remain authoritative.\n\nChecks:\n- cargo fmt --all -- --check\n- python3 tools/kb.py validate\n- git diff --cached --check\n- cargo test --locked --lib arithmetic::u4::stack::tests — 24 passed\n- cargo test --locked --test primitive_metrics u4_word_transfer_metrics_are_current — passed |
|
Review of The consolidated transfer/lookup coverage addresses the earlier packaging request. While resolving the stack.rs conflict, retain the newly merged #239 checked/unchecked pair-packing and range-error tests as well as this PR's transfer tests. Merge catalog/metric additions without dropping existing rows, then run the focused stack/lookup checks. Current integration conflicts: Validation scope: source/diff and existing CI review; no new full-repository or field-arithmetic test run was requested. |
…licts Robin Linus requested integrating current main while retaining solving-bitcoin#239's checked/unchecked pair-packing and range-error tests on stack.rs alongside this PR's word-transfer and lookup-lifecycle documentation and tests. - knowledge/catalog.json: combined the two independent stack_contract sentence additions (main's popcount wording, this PR's transfer/ lookup wording); kept every record and configuration from both sides (117 records, 292 configurations; main's 283 configs + this PR's 9 new ones). - src/arithmetic/u4/mod.rs: re-sorted the module list, keeping every `pub mod` from both sides. - src/arithmetic/u4/stack.rs: kept both `use` imports (this PR's execute_script_with_inputs_strict and main's bitcoin_scriptexec:: ExecError, the latter needed by solving-bitcoin#239's tests). All 24 tests in the module (main's 13 plus this PR's 11 new transfer tests) survive; the PR's now-superseded `packs_all_checked_nibble_pairs` is correctly dropped in favor of main's renamed/expanded `packs_all_nibble_pairs`, per instruction to keep main's pair-packing functions unchanged. - tests/primitive_metrics.rs: both sides had appended new tests at the same insertion point; spliced this PR's 4 new u4 metric tests ahead of main's 4 new u32 metric tests, preserving all fns from both sides (206 main + 4 new = 210 total, verified by name-set comparison). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed in
Evidence remains local only ( Pushed to |
Summary
u4_copy_u32_from(0)andu4_move_u32_from(0)contractsValidation
cargo fmt --all -- --checkcargo test --locked arithmetic::u4::stack::tests::copy_and_move_u32_preserve_nibble_orderpython3 tools/kb.py validategit diff --checkThe full repository test suite was intentionally not run; validation is scoped to the changed primitive as requested.