You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we can see that the first for loop of code tries to check if at least one coin is zero then exit else if at the end return. However in the next loop, it performs the iteration and checks for coins that are non-zero which thereby renders the prior loop useless.
Suggestion
Simply remove the first loop and the other unnecessary checks then only add coins that are non-zero
Simplifies and makes clearer the code in removeZeroCoins by
removing unnecessary checks that boiled down to still running
in the same final for loop.
Fixes#13958
…3967)
Simplifies and makes clearer the code in removeZeroCoins by
removing unnecessary checks that boiled down to still running
in the same final for loop.
Fixes#13958
Summary of Bug
Noticed while auditing cosmos/gaia that if we examine the code inside
cosmos-sdk/types/coin.go
Lines 782 to 803 in 8cce748
Suggestion
Simply remove the first loop and the other unnecessary checks then only add coins that are non-zero
/cc @elias-orijtech
The text was updated successfully, but these errors were encountered: