Repository navigation
Conversation
The paraspell#1995 fix (42440fb) replaced the string-or-number union with a number-only builder, so `{ Parachain: '2000' }`, `{ PalletInstance: '50' }` and string-form `parents` started throwing ZodError, while `Uint64`/`Uint128` kept accepting strings through `IntegerAsBigInt`. The schema was inconsistent with itself, with the declared `TStringOrNumberOrBigInt` contract, with the repo's own fixtures, and with polkadot-js `.toHuman()` output. Replace `createNumberUint` with `createUint(bits)`, which accepts a number, a bigint, or a numeric string (plain or comma-delimited, e.g. '2,030'), normalizes the value to a number, and refines it to [0, 2^bits - 1], so the width bounds added by paraspell#1995 are kept. Applies to `Uint8` (`parents`, `PalletInstance`, `GeneralKey.length`) and `Uint32` (`Parachain`, `BodyId.Index`, `BodyPart` count/nom/denom). `Uint64`/`Uint128` are unchanged. `LocationSchema` is reused by the XCM API DTOs and the Playground validator, so those accept string-form locations again with no further change. Fixes paraspell#2539 Signed-off-by: ReNchi-X <216949634+ReNchi-X@users.noreply.github.com> AI-Assisted-By: Muse Spark (Meta)
Contributor
|
Dear @ReNchi-X Unfortunately in order to contribute you need to have issue reserved for you. The original reporter needs to say they do not want to carry out the FIX. You also did not adhere to bug bounty PR format. More information on program: https://paraspell.github.io/docs/contribution-guidelines.html Closing. With kind regards, |
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.
Fixes #2539
The #1995 fix (42440fb) replaced the string-or-number union with a number-only builder, so
{ Parachain: '2000' },{ PalletInstance: '50' }and string-formparentsstarted throwing ZodError, whileUint64/Uint128kept accepting strings throughIntegerAsBigInt.This replaces
createNumberUintwithcreateUint(bits), which accepts a number, a bigint, or a numeric string (plain or comma-delimited), normalizes to a number, and refines to [0, 2^bits - 1] so the #1995 width bounds are kept.LocationSchemais reused by the XCM API DTOs and the Playground validator, so those accept string-form locations again with no further change.Verified:
@paraspell/xcm-analyser239/239 tests pass (incl. new#2539regression cases), tsc/eslint/prettier clean; cross-packagecompareLocations3/3 andsortAssets8/8 pass.