Repository navigation
fix(serializer,core): align single-byte wire widths, register/extension bounds, and selection checks - #243
Open
a-shannon wants to merge 1 commit into
Conversation
…on bounds, and selection checks
🦋 Changeset detectedLatest commit: f73270d The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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.
Summary
This PR aligns several
@fleet-sdk/serializerbinary codec widths and bounds with SigmaState and hardens@fleet-sdk/corecoin selection and minting validation:Box token & register counts (
packages/serializer/src/serializers/boxSerializer.ts)UByte), matchingErgoBoxCandidateserialization in SigmaState (note: a valid standalone box is bounded to 4,096 bytes, so this is codec parity rather than a live-box unlock).> 255tokens on write and> 6registers on read.extractPackedRegistersvalidator betweenwriteRegistersandestimateBoxSizeso register gaps and unexpected register keys outsideR4–R9are rejected consistently.Type serializer parity (
packages/serializer/src/serializers/typeSerializer.ts)0x60) using a single unsigned byte (UByte) and reject declared arity< 2.0x18(nestedCollwithembdCode === 0) for non-primitive element types (e.g.,Coll[Coll[(Int, Int)]]).Transaction & context extension serializer (
packages/serializer/src/serializers/transactionSerializer.ts)txIdon deserialization so non-ascending wire key orders produce the sametxIdand outputboxIds as SigmaState /ergo-lib. (Note: JavaScriptRecord<string, string>enumerates integer-index keys in ascending order, so re-serializing a deserialized non-ascending transaction emits ascending keys.)ContextExtensionentry counts (0..127) and variable IDs (0..127) matchingContextExtensionSerializer, and reject unexpected trailing bytes after a transaction.Selection & minting (
packages/core/src/builder/selector/strategies/accumulativeSelectionStrategy.ts,packages/core/src/builder/outputBuilder.ts)OutputBuilder.buildbefore emitting EIP-4 metadata registers, while keeping zero-amount ordinary token filtering intact.Validation
pnpm -r build— passpnpm cov:check— 66/66 test files, 1,142/1,142 tests pass with 100% line/function/statement coverage across all modified filesbiome checkon all 10 modified source/test files — pass.changeset/fix-serializer-and-selection-hardening.mdcovering@fleet-sdk/serializerand@fleet-sdk/core(patch)