Skip to content

Revert "feat: refresh known tokens via identity-guarded CoinMap.replace (#9922)" - #9970

Merged
prajwalu142 merged 1 commit into
masterfrom
CSHLD-863-revert-replace-existing-coin
Oct 14, 2026
Merged

prajwalu142 merged 1 commit into
masterfrom
CSHLD-863-revert-replace-existing-coin

Conversation

@prajwalu142

Copy link
Copy Markdown
Contributor

Problem/Goal

Reverts #9922 (commit 787e7189), which let AMS payloads 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 of commit 787e7189 — removes replaceExistingCoin and its 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

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
@linear-code

linear-code Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

CSHLD-863

@prajwalu142
prajwalu142 marked this pull request as ready for review October 14, 2026 14:20
@prajwalu142
prajwalu142 requested a review from a team as a code owner October 14, 2026 14:20

@Venkat-Annavazzala Venkat-Annavazzala left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Unit tests are failing on Node 26.x (Current release line, non-blocking). This is not an LTS version yet, so it does not block merge, but it signals an incompatibility to fix before Node 26.x becomes LTS.

View run

@prajwalu142
prajwalu142 merged commit 1607e4d into master Oct 14, 2026
26 checks passed
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
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.

3 participants