Skip to content

fix(xcm-analyser): accept string-form numeric junctions in u8/u32 fields - #2541

Closed
ReNchi-X wants to merge 1 commit into
paraspell:mainfrom
ReNchi-X:fix/2539-string-junctions
Closed

ReNchi-X wants to merge 1 commit into
paraspell:mainfrom
ReNchi-X:fix/2539-string-junctions

Conversation

@ReNchi-X

Copy link
Copy Markdown

Fixes #2539

The #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.

This replaces createNumberUint with createUint(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. LocationSchema is reused by the XCM API DTOs and the Playground validator, so those accept string-form locations again with no further change.

Verified: @paraspell/xcm-analyser 239/239 tests pass (incl. new #2539 regression cases), tsc/eslint/prettier clean; cross-package compareLocations 3/3 and sortAssets 8/8 pass.

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)
@dudo50

dudo50 commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Dear @ReNchi-X
Thanks for interest in contributing to ParaSpell tool stack.

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,
Team ParaSpell✨

@dudo50 dudo50 closed this Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug bounty] xcm-analyser rejects string-form numeric junctions — the #1995 fix removed the string compatibility it asked to keep

2 participants