fix(globe-wallet): remove SpendLimit/DailySpent when removing asset (#89) - #109
Open
ZacLou wants to merge 1 commit into
Open
fix(globe-wallet): remove SpendLimit/DailySpent when removing asset (#89)#109ZacLou wants to merge 1 commit into
ZacLou wants to merge 1 commit into
Conversation
Closes Orbit-Wal#89. emove_asset previously left the per-asset SpendLimit and DailySpent entries in persistent storage, causing unbounded storage growth and surprising behavior when the asset was re-added later. Clean them up alongside the UserAssets entry, matching the cleanup already done by migrate_user_assets. Also adds tests proving the limit resets to 0 after removal, re-adding starts fresh, and other asset limits are untouched.
Author
|
Local verification passed on Windows:
The two new regression tests specifically cover the orphaned-state bug described in the issue. |
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.
Closes #89
remove_assetpreviously left the per-assetSpendLimitandDailySpententries in persistent storage, causing two problems:This change cleans up both keys alongside the
UserAssetsentry, matching the cleanup already done bymigrate_user_assets.Added tests
test_remove_asset_clears_spend_limit_and_daily_spent— proves the limit resets to 0 after removal and that re-adding starts fresh.test_remove_asset_keeps_other_asset_limits_intact— proves removing one asset does not affect another user's asset limits.No public API or enum discriminants are changed.