Repository navigation
feat(u32): document byte reorder boundary - #44
Merged
RobinLinus merged 1 commit intoSep 18, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
byte_reorder(offset)permutations and invalid-offset rejectionResearch framing
Question: what is the exact permutation and cost of the byte reorder used by non-byte-aligned u32 rotations?
Result: offsets 0, 1, 2, and 3 compile to 3, 2, 4, and 3 script bytes respectively. Each consumes four byte items with a 9-byte serialized witness and a 4-item strict peak.
The result is locally reproduced and unclassified for deployment. Inputs are raw byte-valued stack items; callers remain responsible for range and canonical ScriptNum checks.
Validation
cargo fmt --all -- --checkcargo test --locked byte_reorder_covers_all_offsetscargo test --locked byte_reorder_rejects_invalid_offsetscargo test --locked --test primitive_metrics u32_byte_reorder_metrics_are_currentpython3 tools/kb.py validategit diff --checkThe full repository test suite was intentionally not run; field-arithmetic tests remain skipped by default.