fix: ignore non-canonical asset names when scaling - #207
Merged
Merged
Conversation
Azorlogh
approved these changes
Sep 30, 2026
NumaryBot
approved these changes
Sep 30, 2026
NumaryBot
left a comment
Contributor
There was a problem hiding this comment.
The required automated review completed with no remaining findings.
ascandone
enabled auto-merge (squash)
October 1, 2026 09:01
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.
Reported by @Azorlogh on #199.
funds.GetAssetsgroups an account's balances by scale, but different asset names can have the same scale:EURandEUR/0are both scale 0. One balance overwrote the other, and which one was kept depended on map iteration order.With balances
acc1: EUR = 5, EUR/0 = 0, EUR/2 = 100, this script:sometimes pays the 1 EUR directly and sometimes converts EUR/2 through
@swap, because theEUR/0balance hides the 5 EUR.Scaling postings always use the canonical name (
EUR,EUR/2, neverEUR/0). A balance whose name isn't in that form can't be spent under the name the posting uses.GetAssetsnow skips those balances (EUR/0,EUR/02,EUR/x...). Adding them to the canonical balance instead would spendEURthe account doesn't have.Tests:
GetAssetswith non-canonical namesscaling.num.specs.json:EUR = 4, EUR/0 = 0must convert the 4 EUR (it failed every time before the fix)