-
Notifications
You must be signed in to change notification settings - Fork 2
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
Allow injectable restrictions on bank transfers #568
Conversation
…e, sanction, and other send restriction func stuff.
…nd make it private so that it can't be confused with a SendRestrictionFn.
…to address (as it should have been).
…f with the contexts to reduce reduncancy, e.g. it was quarantine.HasQuarantineBypass and is now quarantine.HasBypass. Also add some unit tests on them.
…ate the existing keeper.
…idn't really change anything or make anything easier.
…nt in the error message.
Holding off on merging this. The related provenance PR is failing sims, e.g. https://github.com/provenance-io/provenance/actions/runs/4897195504/jobs/8745004575?pr=1506
|
Found the issue, just haven't fixed it yet. However, I did find that, during the block 23 invariant check,
I'm fairly certain that's the culprit. Here's what I think is happening:
The problem is that, most sends happen inside a transaction. If an error is encountered, the state is rolled back. But in that I'm pretty sure the best solution is to fix the reward program begin blocker to properly roll back what it might have partially done. I'm going to look into doing that tomorrow. I'll probably do a quick audit of other BeginBlockers to see if they might be in the same boat here. |
There was an issue found. So, holding off on review until fixed.
Found the problem, and it was specific to the rewards module (in the provenance repo). The fix is to use a cache context for its begin/end block stuff so things aren't partially done. There wasn't anything that needed to be addressed in here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to come up with a method for overriding the spendable coins count when the user is sanctioned. This would be a separate effort though.
* Add SendRestriction stuff to the bank keeper and remove the quarantine, sanction, and other send restriction func stuff. * Move the restrictions into types so other modules can use them for expected keepers. * Update the sanction module to provide a send restriction. * Add a way to bypass the sanction restriction with a special context. * Fix some unit tests. * Update the quarantine module to use a SendRestriction. * Move the SendRestriction wrapper struct thingy back into the keeper and make it private so that it can't be confused with a SendRestrictionFn. * Limit the MsgMultiSend simulation operation to a single input. * Fix the sanction send restriction to use the from address instead of to address (as it should have been). * Fix all the unit tests that broke from these changes. * Remove the quarantine and sanction expected keepers and mocks from the bank module. * Remove the module names from the names of the funcs doing bypass stuff with the contexts to reduce reduncancy, e.g. it was quarantine.HasQuarantineBypass and is now quarantine.HasBypass. Also add some unit tests on them. * correct the import alias in the send restriction function files. * Add some tests on the quarantine SendRestrictionFn. * Add unit tests on the sanction SendRestrictionFn. * Update changelog. * Update a comment to be a bit more specific. * Add unit test on WithMintCoinsRestriction to make sure it doesn't update the existing keeper. * Add unit tests on the send restriction functions via InputOutputCoins. * Undo changes to x/sanction/simulation/operations_test.go since they didn't really change anything or make anything easier. * When there isn't enough spendable balance, always include a coin amount in the error message.
…tions Backport #568 to v0.46.x and mark v0.46.10-pio-4 in the changelog.
Description
This PR:
MsgMultiSend
andInputOutputCoins
to a single input.SetQuarantineKeeper
andSetSanctionKeeper
functions.MintingRestrictionFn
type from the keeper package to types.SendCoinsBypassQuarantine
.SetSendRestrictionsFunc
method; use the newAppendSendRestriction
orPrependSendRestriction
instead.Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change