Repository navigation
CECHO-2510: statics: ERC20 duplicate-contract-address test rejects legitimate cross-chain address reuse - #10028
Merged
Conversation
The test keyed duplicates by contract address alone and rejected any match on a non-ETH family, so a token deployed at the same address on two different chains (e.g. eth:aaplx and okbxlayer:aaplx) failed the suite even though CoinMap accepts it. It was also order-dependent and interpolated the accumulator object as [object Object]. Key by family:contractAddress:network.type to mirror CoinMap.addCoin so that cross-chain address reuse passes while same-chain duplicates still fail. Ticket: CECHO-2510
Contributor
Contributor
|
|
ArunBala-Bitgo
approved these changes
Oct 22, 2026
prajwalu142
approved these changes
Oct 22, 2026
There was a problem hiding this comment.
🟢 Approval recommended
The focused test-only change preserves namespace-specific duplicate detection, with no unresolved review findings.
No open issues 🎉
What changed in this PR
Updates the statics ERC20 duplicate-address test to allow legitimate cross-chain address reuse without changing production code.
Changes:
- Checks uniqueness by
family:contractAddress:network.type, matchingCoinMapcollision rules. - Removes iteration-order dependence and reports both token names in duplicate errors.
- Removes the unused
DuplicateCoinObjectinterface.
| File | Description |
|---|---|
modules/statics/test/unit/coins.ts |
Scopes duplicate-address checks to the intended namespace and simplifies test bookkeeping. |
Review effort: Balanced
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
Fixes the
@bitgo/staticsunit test that rejected legitimate reuse of a contract address across different chains. Chains are separate namespaces, so a token deployed at the same (deterministic) address on two chains — e.g.eth:aaplxandokbxlayer:aaplx— is valid, andCoinMapalready accepts it.Linear: CECHO-2510
Changes
modules/statics/test/unit/coins.ts: rewriteERC20 Coins › should have no duplicate contract addressesto key byfamily:contractAddress:network.type, mirroring the invariant enforced byCoinMap.addCoin. Cross-chain address reuse now passes; same-chain duplicates still fail.DuplicateCoinObjectinterface.CoinMapiteration order) and the[object Object]error message.No production code change —
CoinMapalready permits cross-chain reuse.Test Plan
npx mocha test/unit/coins.ts→ 40002 passingtsc --buildclean; eslint 0 errors; prettier cleaneth:token with the same address onmainnet.ethereumstill throwsDuplicateContractAddressDefinitionErrorokbxlayer:aaplx(same address aseth:aaplx) can be onboarded once added