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
X/bank SendCoinsSendRestriction should be applied before deducting of coins using subUnlockedCoins
Problem Definition
Why do we need this feature?
Currently, the coins are first deducted, and then we check the send restriction.
In the tx flow, is there is an error, then the tx is reverted.
In a module flow (that isn't in a tx, so begin/endblock call or whatever), the balances will indeed be deducted and then throw an error. This is why you need to run this in a cache context and only write it if it succeeds without an error. Ref
What problems may be addressed by introducing this feature?
Lack of standardisation with InputOutputCoins, we might need to change that as well but not a big issue for now.
What benefits does the SDK stand to gain by including this feature?
Safer usage of SendRestriction in SendCoins.
Proposed Feature
To move SendRestriction before subUnlockedCoins in SendCoins of Send.go in x/bank keeper