chore: eliminate long dependency where possible#1390
Merged
Conversation
18c22d2 to
b9e4c6a
Compare
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
Reduce the surface area of the
longdependency in this monorepo, drop unused cosmos plumbing from the WalletConnect provider, and bump several cosmos-related packages that had drifted significantly behind upstream.Changes and rationale
1.
signer-cosmos: droplongand the no-op gas-string round-tripsigners/signer-cosmos/src/helpers.ts— removedimport Long from 'long'and replacedLong.fromString(fee?.gas).toString()withfee?.gasdirectly.signers/signer-cosmos/package.json— removed\"long\": \"^4.0.0\"from dependencies.Why: The previous
Long.fromString(s).toString()round-trip on the gas string was effectively a no-op for any valid gas value, and worse than CosmJS's own validation for invalid input —Long.fromStringsilently accepts garbage, while@cosmjs/stargate'ssignAndBroadcastalready strictly validates the gas string viaInt53.fromString(which uses/^-?[0-9]+$/and throws clearly on bad input or out-of-range values). So passing the string through directly is both safer (clearer errors) and lets us drop the dependency. The only behavioural loss is the silent\"NaN\"/\"Infinity\"→\"0\"coercion thatLong.fromStringdid, which is not a desired behaviour for a gas value.2.
signer-cosmos: bump@cosmjs/stargate^0.31.0→^0.34.0Why: This package had not been updated for a long time. Bumping it removes one transitive
longsource from the tree, brings in upstream fixes, and unblocks future cosmos updates that have been blocked by the older version pin.3. Providers: pin
@rango-dev/signer-cosmosto^0.39.2-next.0provider-cosmostation,provider-keplr,provider-leap-cosmos,provider-xdefiall had^0.39.1; bumped to^0.39.2-next.0.Why: The local workspace
signer-cosmosis at0.39.2-next.0(a pre-release). Per semver,^0.39.1does not match a pre-release version, so yarn workspaces was falling back to fetching the published0.39.1from the npm registry — meaning the local long-removal would not actually take effect for downstream providers. Bumping the range to^0.39.2-next.0lets yarn link to the workspace package. This range will be tightened back to^0.39.2oncesigner-cosmos@0.39.2is published.4.
provider-walletconnect-2: drop unused cosmos signer@cosmjs/launchpad,@keplr-wallet/cosmos,@keplr-wallet/simple-fetch,@rango-dev/signer-cosmos,cosmos-wallet.src/signers/cosmos.ts,src/signers/helper.ts,src/signers/mock.ts.src/signer.ts— removed COSMOS signer registration and dynamic import.Why: WalletConnect doesn't currently support cosmos in this provider, so the cosmos signer code and its dependencies were dead weight. Removing them eliminates several transitive
long(and other) dependencies and cuts ~480 lines of unused code.5.
provider-keplr: bump keplr/chain-registry packages@chain-registry/keplr^2.0.110→^2.0.198@keplr-wallet/types^0.11.21→^0.13.26(was a major-version drift)starknet ^8to devDependencies — required as a peer of@keplr-wallet/types@^0.13.26.Why: Same drift situation as cosmos packages — these had not been updated in a long time. Bringing them current trims one transitive
longsource and aligns with whatsigner-cosmosis now using.What is not fixed in this PR
yarn why longstill reports the package as present transitively via:@keplr-wallet/typesand@keplr-wallet/proto-types— no stable upstream release dropslong.cosmjs-types— the stable release still depends onlong.protobufjs— still pullslongfor 64-bit integer support.@trezor/transport(viaprovider-trezor) — out of scope for this branch.These would each require either an upstream release or a more invasive migration (e.g. swapping
cosmjs-typesfor the BigInt fork), so they are intentionally deferred.yarn auditcurrently reports 159 Low / 408 Moderate / 386 High / 53 Critical vulnerabilities. These are pre-existing across the workspace and not addressed here; calling them out for visibility.How did you test this change?
yarn installresolves cleanly with the new rangesyarn buildforsigner-cosmos,provider-keplr,provider-cosmostation,provider-leap-cosmos,provider-walletconnect-2,provider-xdefisignAndBroadcastcorrectly)Checklist