Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 22b8dfb The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Problem
SigmaByteReader.readBool()read a boolean asbyte === 0x01:That is not what the reference implementation does. In sigmastate-interpreter,
CoreDataSerializer.deserializereadsSBooleanas:sigma-rust does the same (
Literal::Boolean(r.get_u8()? != 0)inergotree-ir/src/serialization/data.rs). So a boolean byte of0x02,0x80or0xffis true on the node and in sigma-rust, but Fleet parsed it as false — silently flipping the value of anSBoolconstant (in a box register, a context extension, or a tree constant) instead of reading what the reference reads. It was also inconsistent inside Fleet itself:readOption()already treats any non-zero byte asSome.Canonical encodings are unaffected: writers (Fleet's included) only ever emit
0x00/0x01, and those read back exactly as before.Fix
readBool()now returnsthis.readByte() !== 0, matching the reference. Changeset included (.changeset/tidy-bools-truthy.md,@fleet-sdk/serializer: patch).One interaction worth flagging: at end-of-input on
master,readByte()returnsundefined, which this comparison would read as true rather than the old false. Neither is a real value — that axis is the out-of-bounds read fixed in #225, after which an EOF bool throws aRangeErrorbefore any comparison. This PR is deliberately scoped to the in-bounds value semantics.Test evidence
Tests-first — both new tests fail on pristine
masterwith exactly the predicted flip (expected false to be truefor byte0x02):sigmaByteReader.spec.ts: a bool is false only for0x00;0x01,0x02,0x7f,0x80and0xffare all true.sigmaConstant.spec.ts:SConstant.from("0102")andSConstant.from("01ff")parse astrue(controls"0100"/"0101"unchanged).After the fix:
masterbaseline 1132 + 2 new)— Kyle Cox (@Kshot9000, https://x.com/kshot9000) · Support my Ergo work: 9fcM5RWnAjmP4vx5bnW6yohB6H9bLq8sJbaPLHtwZLtQPB32Pvy