Repository navigation
Conversation
🦋 Changeset detectedLatest commit: b207c86 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.
Summary
decimalize()andundecimalize()in@fleet-sdk/common(packages/common/src/utils/bigInt.ts) wrote their resolved defaults back into the caller's options object:Two observable effects:
{ decimals: 2 }returns with adecimalMark: "."the caller never set. These helpers are exactly the kind that get called with shared or reused option objects — the spec's own roundtrip test passes one options object to both functions — so the writes leak resolved defaults into caller state.decimalize(1763874n, Object.freeze({ decimals: 2 }))throwsTypeError: Cannot assign to read only property 'decimals', andundecimalize("1.23", Object.freeze({}))throwsTypeError: Cannot add property decimals, object is not extensible— even though both functions only ever read from the object.Fix
Resolve
decimals/decimalMarkinto local variables (keeping the exact same||default semantics, including an explicitly-undefined field falling back to the default) and pass a fresh object tobuildFormattedDecimal. The caller's object is never written to. All outputs are byte-identical — every pre-existing vector passes unchanged.Tests
Five new cases in
bigInt.spec.ts, all failing on pristine master:{ decimals: 2 }gaineddecimalMark).TypeError.TypeError.TypeError(adding a property to a non-extensible object).Results: bigInt spec 21/21; full monorepo suite 1137/1137 (66 files); biome clean on the changed files. Changeset included (
@fleet-sdk/common: patch).Independent community contribution — @Kshot9000 (https://x.com/kshot9000). If this work is useful, tips are welcome: ERG
9fcM5RWnAjmP4vx5bnW6yohB6H9bLq8sJbaPLHtwZLtQPB32Pvy