Repository navigation
fix(statics): dispatch EVM token creation by token kind - #9959
Closed
ralph-bitgo[bot] wants to merge 1 commit into
Closed
ralph-bitgo[bot] wants to merge 1 commit into
ralph-bitgo[bot] wants to merge 1 commit into
Conversation
The hbarevm family supports both ERC20 and ERC721, so its family name keyed both erc20ChainToNameMap and erc721ChainToNameMap inside createToken. The switch matched the ERC20 case first while the ERC721 loop had already replaced the family's initializer with erc721Token, so ERC721 tokens were constructed with the ERC20 argument layout: `features` landed in the wrong parameter and the coin failed its required account-model feature check. bga then logged "Skipping malformed token" and dropped erc721:hbarevmtoken and hbarevm:mclmongp. Dispatch map-covered families on the token's kind (asset === erc721) instead of on the family so each initializer receives its own argument layout, and drop the initializerMap overrides that made the family maps ambiguous. AMS tokens on hbarevm now create correctly for both kinds with no warnings. Ticket: CECHO-2453 Session-Id: 5215fb23-4ab1-4f77-835c-d7bdddff05cf Task-Id: 30c88a03-cff5-449c-9da3-5ad8a9e65771
Contributor
Contributor
|
|
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.
Description
@bitgo/staticscreateTokendispatched EVM token creation on the token's family, but thehbarevmfamily supports both ERC20 and ERC721 (SUPPORTS_ERC20+SUPPORTS_ERC721on its base coin), so its family name keyed botherc20ChainToNameMapanderc721ChainToNameMap. Theswitchmatched the ERC20 case first while the ERC721 registration loop had already replaced the family's initializer witherc721Token, so ERC721 tokens were constructed with the ERC20 argument layout:featureslanded in the wrong parameter and the coin failed its requiredaccount-modelfeature check (MissingRequiredCoinFeatureError). The BitGo Admin CLI (bga) then loggedSkipping malformed tokenand droppederc721:hbarevmtokenandhbarevm:mclmongp— reported in CECHO-2453.This change dispatches families covered by the ERC20/ERC721 chain maps on the token's kind (
asset === UnderlyingAsset.ERC721) instead of the family, so each initializer receives its own argument layout, and removes theinitializerMapoverrides that made the overlapping family maps ambiguous. AMS tokens onhbarevmnow create correctly for both kinds (EthLikeERC721Token/EthLikeERC20Token, withaccount-model) with no malformed-token warnings and no skips.No dependency changes. Follow-up: bga (BitGo/bitgo-admin) picks this up via a
@bitgo-beta/staticsbump after this lands on master.Issue Number
CECHO-2453 (Linear)
Type of change
How Has This Been Tested?
should create hbarevm ERC721 and ERC20 AMS tokens instead of skipping them as malformedinmodules/statics/test/unit/coins.tsfeeds freshhbarevm-family AMS configs of both kinds throughcreateTokenMapUsingTrimmedConfigDetails(the code path bga uses at startup) and asserts the tokens are created with the correct classes, contract addresses, andaccount-modelfeature, and that noSkipping malformed tokenwarning is emitted. On the previous code the test fails withcoin 'hbarevm:freshnft' is not defined(the token is skipped exactly as reported); with the fix it passes.@bitgo/staticsunit suite: 39,701 tests passing.erc721:hbarevmtoken,hbarevm:mclmongpplus fresh AMS-only tokens of both kinds): all four tokens processed withaccount-modeland zero malformed-token warnings; before the fix the same run emitted 3Skipping malformed tokenwarnings and dropped every token.tsc --buildformodules/staticspasses andprettier --checkis clean.Checklist:
tsc --buildformodules/staticspasses; the change is pure TypeScript with no runtime-specific APIs)Ticket: CECHO-2453