Range-check shift/rotate amounts in the bytestring wrappers#7854
Open
Unisay wants to merge 1 commit into
Open
Conversation
shiftByteString and rotateByteString passed the amount to the Bitwise code as an unchecked Integer, matching the pre-vanRossem builtin semantics (variants B/C accept any amount). Builtin semantics variants D and E, which the van Rossem HF activates, take the amount as a checked Int, so off-chain evaluation would succeed where the deployed script fails once PV11 is live. Both wrappers now fail on amounts outside the machine-Int range, mirroring D/E. Issue: IntersectMBO/plutus-private#2342
Unisay
marked this pull request as draft
July 17, 2026 11:07
Unisay
marked this pull request as ready for review
July 17, 2026 11:17
zliu41
approved these changes
Jul 17, 2026
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.
The
shiftByteStringandrotateByteStringwrappers inPlutusTx.Builtins.Internalpass the shift/rotation amount toPlutusCore.Bitwiseas a fullIntegerwith no range check. This matches the currently live builtin semantics (variants B/C take the amount asIntegerCostedLiterally), but variants D and E — which the van Rossem hard fork activates at PV11 — take the amount as a checkedInt, failing on values outside[-2^63, 2^63-1]. Once PV11 is live, off-chain evaluation would silently succeed (all-zero shift result, modular rotation) where the deployed script fails phase-2 validation. Both wrappers now fail on out-of-Int-range amounts, mirroring D/E.Follow-up to #7851, which fixed the analogous narrowing bugs in the other wrappers. Time-sensitive: the divergence goes live with the van Rossem HF.
Closes IntersectMBO/plutus-private#2342