Repository navigation
Revert "feat: refresh known tokens via identity-guarded CoinMap.replace (#9922)" - #9970
Merged
Merged
Conversation
problem/goal: Revert PR #9922 (commit 787e718), which allowed AMS payloads to update already-registered coins via the identity-guarded CoinMap.replace/replaceExistingCoin path. Restores the prior behavior where statics wins and an AMS payload cannot change features of an already-registered coin. implementation details: git revert --no-commit of 787e718; removes replaceExistingCoin and its related error type from modules/statics (coins.ts, errors.ts, map.ts) along with the unit tests added by the original PR. verification: yarn run unit-test --scope @bitgo/statics — 39690 passing. Ticket: CSHLD-863
Contributor
prajwalu142
marked this pull request as ready for review
October 14, 2026 14:20
0xPrabh
approved these changes
Oct 14, 2026
Contributor
|
|
prajwalu142
added a commit
that referenced
this pull request
Oct 19, 2026
problem/goal Re-land the AMS-driven refresh of already-registered coins that was reverted from statics 2138 (#9970 reverting #9922). The original implementation replaced any known coin matched by an AMS record, including base chains, which swapped LightningCoin for DynamicCoin and broke wallet-platform coin singletons on staging (CSHLD-1957). implementation details - createToken stays pure: known coins are returned untouched; unknown records build via constructToken (extracted from createToken). - createTokenMapUsingConfigDetails owns the refresh: known tokens flow instead of being skipped, and the refreshed record is written through CoinMap.replace, which rejects same-id replacements that change the coin class (CoinClassMismatchError) or the immutable identity fields id, name, alias and contract address (CoinImmutableFieldsMismatchError). Known base chains never reach the refresh path. - createTokenMapUsingTrimmedConfigDetails lets known tokens continue into feature enrichment and delegates the refresh to the config details builder. - New tests pin the base-chain parity canary, the tlnbtc regression, refresh with class preservation, class-swap rejection, per-field identity rejection (id, name, alias, contract address), alias-drop fail-closed on builder refresh, and AMS feature updates flowing through while identity stays untouched. verification npx mocha test/unit/ in modules/statics: 39700 passing, 0 failing; tsc --noEmit clean; eslint clean. Ticket: CSHLD-863
prajwalu142
added a commit
that referenced
this pull request
Oct 19, 2026
problem/goal Re-land the AMS-driven refresh of already-registered coins that was reverted from statics 2138 (#9970 reverting #9922). The original implementation replaced any known coin matched by an AMS record, including base chains, which swapped LightningCoin for DynamicCoin and broke wallet-platform coin singletons on staging (CSHLD-1957). implementation details - createToken stays pure: known coins are returned untouched; unknown records build via constructToken (extracted from createToken). - createTokenMapUsingConfigDetails owns the refresh: known tokens flow instead of being skipped, and the refreshed record is written through CoinMap.replace, which rejects same-id replacements that change the coin class (CoinClassMismatchError) or the immutable identity fields id, name, alias and contract address (CoinImmutableFieldsMismatchError). Known base chains never reach the refresh path. - createTokenMapUsingTrimmedConfigDetails lets known tokens continue into feature enrichment and delegates the refresh to the config details builder. - New tests pin the base-chain parity canary, the tlnbtc regression, refresh with class preservation, class-swap rejection, per-field identity rejection (id, name, alias, contract address), alias-drop fail-closed on builder refresh, and AMS feature updates flowing through while identity stays untouched. verification npx mocha test/unit/ in modules/statics: 39700 passing, 0 failing; tsc --noEmit clean; eslint clean. Ticket: CSHLD-863
prajwalu142
added a commit
that referenced
this pull request
Oct 19, 2026
problem/goal Re-land the AMS-driven refresh of already-registered coins that was reverted from statics 2138 (#9970 reverting #9922). The original implementation replaced any known coin matched by an AMS record, including base chains, which swapped LightningCoin for DynamicCoin and broke wallet-platform coin singletons on staging (CSHLD-1957). implementation details - createToken stays pure: known coins are returned untouched; unknown records build via constructToken (extracted from createToken). - createTokenMapUsingConfigDetails owns the refresh: known tokens flow instead of being skipped, and the refreshed record is written through CoinMap.replace, which rejects same-id replacements that change the coin class (CoinClassMismatchError) or the immutable identity fields id, name, alias and contract address (CoinImmutableFieldsMismatchError). Known base chains never reach the refresh path. - createTokenMapUsingTrimmedConfigDetails lets known tokens continue into feature enrichment and delegates the refresh to the config details builder. - New tests pin the base-chain parity canary, the tlnbtc regression, refresh with class preservation, class-swap rejection, per-field identity rejection (id, name, alias, contract address), alias-drop fail-closed on builder refresh, and AMS feature updates flowing through while identity stays untouched. verification npx mocha test/unit/ in modules/statics: 39700 passing, 0 failing; tsc --noEmit clean; eslint clean. Ticket: CSHLD-863
prajwalu142
added a commit
that referenced
this pull request
Oct 19, 2026
problem/goal Re-land the AMS-driven refresh of already-registered coins that was reverted from statics 2138 (#9970 reverting #9922). The original implementation replaced any known coin matched by an AMS record, including base chains, which swapped LightningCoin for DynamicCoin and broke wallet-platform coin singletons on staging (CSHLD-1957). implementation details - createToken stays pure: known coins are returned untouched; unknown records build via constructToken (extracted from createToken). - createTokenMapUsingConfigDetails owns the refresh: known tokens flow instead of being skipped, and the refreshed record is written through CoinMap.replace, which rejects same-id replacements that change the coin class (CoinClassMismatchError) or the immutable identity fields id, name, alias and contract address (CoinImmutableFieldsMismatchError). Known base chains never reach the refresh path. - createTokenMapUsingTrimmedConfigDetails lets known tokens continue into feature enrichment and delegates the refresh to the config details builder. - New tests pin the base-chain parity canary, the tlnbtc regression, refresh with class preservation, class-swap rejection, per-field identity rejection (id, name, alias, contract address), alias-drop fail-closed on builder refresh, and AMS feature updates flowing through while identity stays untouched. verification npx mocha test/unit/ in modules/statics: 39700 passing, 0 failing; tsc --noEmit clean; eslint clean. Ticket: CSHLD-863
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.
Problem/Goal
Reverts #9922 (commit
787e7189), which let AMS payloads update already-registered coins via the identity-guardedCoinMap.replace/replaceExistingCoinpath. Restores the prior behavior where statics wins and an AMS payload cannot change features of an already-registered coin.Implementation details
git revertof commit787e7189— removesreplaceExistingCoinand its error type frommodules/statics(coins.ts,errors.ts,map.ts), along with the unit tests added by the original PR.Verification
yarn run unit-test --scope @bitgo/statics— 39690 passing.Ticket: CSHLD-863