Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: In SendCoins, SendRestriction should be applied before deducting of coins #20516

Closed
wr1159 opened this issue Jun 2, 2024 · 0 comments · Fixed by #20517
Closed

Comments

@wr1159
Copy link
Contributor

wr1159 commented Jun 2, 2024

Summary

X/bank SendCoins SendRestriction 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant