fix(globe-wallet): use case-insensitive matching in remove_asset (#93) - #96
Closed
s6pa1rta3n-lab wants to merge 1 commit into
Closed
fix(globe-wallet): use case-insensitive matching in remove_asset (#93)#96s6pa1rta3n-lab wants to merge 1 commit into
s6pa1rta3n-lab wants to merge 1 commit into
Conversation
…_asset (Orbit-Wal#93) - Update remove_asset to use codes_match_case_insensitive for asset identity lookup - Align remove_asset behavior with add_asset duplicate detection rule - Add tests verifying case variant removal (e.g. registered 'USDC' removed with 'usdc') - Add tests verifying genuinely absent asset codes return AssetNotFound across casings - Update doc comments on AssetInfo and codes_match_case_insensitive
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
Resolves #93.
In
GlobeWallet,add_assetenforces case-insensitive uniqueness usingcodes_match_case_insensitiveto prevent registering case-variant duplicate tickers (e.g."USDC"vs"usdc"). However,remove_assetpreviously performed an exact string comparison (a.code == asset_code), causing registered assets to be unremovable if callers passed a different casing (e.g., lowercase"usdc"for a registered"USDC"asset), returningWalletError::AssetNotFound.Changes
remove_assetincontracts/globe-wallet/src/lib.rsto useSelf::codes_match_case_insensitive(&a.code, &asset_code)during registry scan.remove_asset,AssetInfo, andcodes_match_case_insensitiveto reflect consistent case-insensitive handling across add and remove operations.test_remove_asset_case_mismatch_succeeds: Verifies that an asset registered as"USDC"is successfully removed when requested as"usdc".test_remove_asset_case_variants: Verifies removal across multiple case variants (e.g., mixed-case"uSdC", uppercase"EURC", lowercase native"xlm").test_remove_asset_genuinely_absent_fails_all_casings: Verifies that genuinely absent assets returnWalletError::AssetNotFoundacross any casing and that partial/prefix strings (e.g."USD","USDCX") do not trigger false matches.Test Verification
Payout Routing
0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC