You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR migrates accountNumber from number to bigint across the @cosmjs/stargate, @cosmjs/amino, and @cosmjs/proto-signing packages to handle Cosmos SDK 0.53+ accounts whose GenerateID() counter can exceed Number.MAX_SAFE_INTEGER. The Uint53.fromString call in signdoc.ts is correctly replaced with Uint64.fromString, which internally uses native BigInt and preserves precision for 64-bit values.
Confidence Score: 4/5
Safe to merge — all signing paths correctly propagate bigint and no precision loss can occur.
Only P2 findings remain (test fixture inconsistency in proto-signing testutils). All core signing flows — signDirect, signAmino, getSequence — correctly handle the bigint type end-to-end.
packages/proto-signing/src/testutils.ts — three test vectors still use number literal 1 instead of 1n
Important Files Changed
Filename
Overview
packages/stargate/src/accounts.ts
Account.accountNumber changed to bigint; uses toBigInt() from Uint64 which handles values above Number.MAX_SAFE_INTEGER correctly
packages/amino/src/signdoc.ts
Accepts bigint for accountNumber and switches from Uint53 to Uint64 for safe >53-bit conversion; correct change
packages/stargate/src/signingstargateclient.ts
SignerData.accountNumber changed to bigint; signDirect and signAmino paths both correctly forward bigint to their respective makeSignDoc functions
packages/stargate/src/stargateclient.ts
SequenceResponse.accountNumber changed to bigint; getSequence() propagates the bigint from Account cleanly
packages/proto-signing/src/signing.ts
accountNumber parameter widened to number
packages/stargate/src/testutils.ts
Test fixtures updated to bigint literals (16n, 0n) consistently
packages/cosmwasm/src/testutils.ts
Test fixtures updated to bigint literals (16n, 0n) consistently
Updated to use unused.accountNumber (now bigint) directly; comparison updated to use >= 0n
packages/stargate/src/stargateclient.spec.ts
accountNumber comparisons updated to use bigint comparison (>= 0n) instead of toBeGreaterThanOrEqual
packages/stargate/src/accounts.spec.ts
Test expectation updated to use 56n bigint literal; aligns with new Account.accountNumber type
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[StargateClient.getSequence] -->|"accountNumber: bigint"| B[SequenceResponse]
B --> C{Signer type}
C -->|OfflineDirectSigner| D[signDirect]
C -->|AminoSigner| E[signAmino]
D -->|"makeSignDoc(…, accountNumber: bigint)"| F["proto-signing\nBigInt(accountNumber) → SignDoc"]
E -->|"makeSignDocAmino(…, accountNumber: bigint)"| G["amino\nUint64.fromString(accountNumber.toString()) → string"]
H[accountFromAny] -->|"Uint64.toBigInt()"| I["Account.accountNumber: bigint"]
I --> A
Loading
Comments Outside Diff (1)
packages/proto-signing/src/testutils.ts, line 19 (link)
Test fixture accountNumber not updated to bigint
The three test vectors in this file still use accountNumber: 1 (a number) while the rest of the codebase now uses bigint literals. makeSignDoc accepts number | bigint so there's no runtime error, but it's inconsistent with the pattern established across packages/stargate/src/testutils.ts and packages/cosmwasm/src/testutils.ts. Consider updating all three vectors to 1n for uniformity.
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
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.
Breaking change converts account number to use bigint to.