fix: read Header version as a signed Byte at the unparsedBytes gate (JVM parity)#909
Open
mwaddip wants to merge 1 commit into
Open
fix: read Header version as a signed Byte at the unparsedBytes gate (JVM parity)#909mwaddip wants to merge 1 commit into
mwaddip wants to merge 1 commit into
Conversation
… gate
The JVM `HeaderWithoutPow` reads `version` as a signed `Byte` and gates the
`unparsedBytes` region on `version > 1`. sigma-rust compared `version` as
`u8`, so a version byte 0x80 (-128 signed) was seen as 128 > 1: the parser
consumed `unparsedBytes`, shifting the AutolykosSolution parse and yielding a
different `minerPk` than the JVM (which skips the region) -- a deserialization
fork vs sigma-state 6.0.3.
Compare the signed interpretation `(version as i8) > 1` at the parse and
serialize gates. Versions 1/2/3 are positive, so signed == unsigned; only
version >= 0x80 changes, matching the JVM. The two `version > 1` sites in the
arbitrary proptest generator are left unchanged: it emits only versions {1,2},
and one is a v2-field nulling gate (`!= 1`), not an unparsedBytes gate. Adds a
regression test on the 0x80/0x7f witness headers (minerPk infinity vs real).
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 JVM
HeaderWithoutPowreadsversionas a signedByteand gatesunparsedBytesonversion > 1. sigma-rust comparedversionasu8, so a version byte 0x80 (-128 signed) was read as 128 > 1: the parser consumedunparsedBytes, shifting the AutolykosSolution parse and yielding a differentminerPkthan the JVM (which skips the region) — a fork vs sigma-state 6.0.3.Fix: compare the signed value
(version as i8) > 1at the parse and serialize gates. Versions 1/2/3 are positive (signed == unsigned); only version >= 0x80 changes, matching the JVM. Adds a regression test on the 0x80/0x7f witness headers (minerPk infinity vs real point). Validated against the JVM oracle by the conformance suite.