fix: Option DATA parser treats any nonzero tag as Some, per JVM getOption#895
Open
mwaddip wants to merge 1 commit into
Open
fix: Option DATA parser treats any nonzero tag as Some, per JVM getOption#895mwaddip wants to merge 1 commit into
mwaddip wants to merge 1 commit into
Conversation
…tion The JVM reads the Option DATA tag through getOption (sigma Extensions.getOption): `if (tag != 0) Some(getValue) else None`. Our sigma-ser get_option mapped only tag 1 to Some and silently returned None on any other nonzero tag WITHOUT consuming the value bytes, desyncing the stream — a v3 tree carrying an SOption constant with DATA tag 0x02 failed to parse where the JVM evaluates it to Some(5). Fix the shared reader helper to mirror the convention; put_option still writes 0/1, so the write side is unchanged. The only other caller (ergo-p2p peer-spec parsing) aligns with the same scorex reader convention. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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 reads the Option DATA tag through
getOption(sigmaExtensions.getOption):if (tag != 0) Some(getValue) else None— any nonzero tag byte isSome. Our shared sigma-serget_optionmapped only tag1toSomeand silently returnedNoneon other nonzero tags without consuming the value bytes, desyncing the stream: a v3 tree carrying anSOptionconstant with DATA tag0x02failed to parse where the JVM evaluates it toSome(5).Fixes the reader helper to mirror the convention;
put_optionstill writes 0/1, so the write side is unchanged. The only other caller (ergo-p2p peer-spec parsing) aligns with the same scorex reader convention.Tests: reader tag pins (0/1/2/255) and the corpus constant
28 02 0a, standalone and segregated in a v3 tree.