forked from cosmos/cosmos-sdk
-
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
Injectable locked coins functionality #577
Merged
Merged
Conversation
This file contains 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
…keeper. Also, call the send restriction function during DelegateCoins.
…he subUnlockedCoins so that it happens in the same order as InputOutputCoins and also does the most-likely thing to fail first.
…coin entries. In SpendableCoins, when there's a negative coin, only ignore those rather than claiming there's no spendable balance at all.
…t to not do a partial write for the expected-to-fail SendCoins.
…nsWithRestrictions to use a cache context to not get partial updates.
…r the coins have been subtracted from the source account.
SpicyLemon
changed the title
Injectable locked coins funcitonality
Injectable locked coins functionality
Jul 6, 2023
…ecause the last validator was being removed at the end of the last block. So the exported state didn't have any validators causing the import to panic. When that happens on other blocks, it handles it just fine, it was just that it was happening on the very last block that caused the problem.
The following |
Taztingo
reviewed
Jul 7, 2023
Taztingo
approved these changes
Jul 17, 2023
nullpointer0x00
approved these changes
Jul 17, 2023
SpicyLemon
added a commit
that referenced
this pull request
Jul 28, 2023
* [1619]: Create a GetLockedCoinsFn that can be injected into the view keeper. Also, call the send restriction function during DelegateCoins. * [1619]: Move the send restriction application in SendCoins to after the subUnlockedCoins so that it happens in the same order as InputOutputCoins and also does the most-likely thing to fail first. * [1619]: Wrap all GetLockedCoinsFn such that it only returns positive coin entries. In SpendableCoins, when there's a negative coin, only ignore those rather than claiming there's no spendable balance at all. * [1619]: Tweak the spec doc. * [1619]: Tweak the sanction TestBankSendCoinsUsesSendRestrictionFn test to not do a partial write for the expected-to-fail SendCoins. * [1619]: Refactor TestInputOutputCoinsWithRestrictions and TestSendCoinsWithRestrictions to use a cache context to not get partial updates. * [1619]: Tweak/fix some comments. * [1619]: Move the sendRestriction application in DelegateCoins to after the coins have been subtracted from the source account. * [1619]: Fix test-sim-after-import that started failing at seed 3012 because the last validator was being removed at the end of the last block. So the exported state didn't have any validators causing the import to panic. When that happens on other blocks, it handles it just fine, it was just that it was happening on the very last block that caused the problem. * [1619]: Add changelog entry.
20 tasks
SpicyLemon
added a commit
that referenced
this pull request
Jul 31, 2023
…nd (#578) (#579) * Injectable locked coins functionality (#577) * [1619]: Create a GetLockedCoinsFn that can be injected into the view keeper. Also, call the send restriction function during DelegateCoins. * [1619]: Move the send restriction application in SendCoins to after the subUnlockedCoins so that it happens in the same order as InputOutputCoins and also does the most-likely thing to fail first. * [1619]: Wrap all GetLockedCoinsFn such that it only returns positive coin entries. In SpendableCoins, when there's a negative coin, only ignore those rather than claiming there's no spendable balance at all. * [1619]: Tweak the spec doc. * [1619]: Tweak the sanction TestBankSendCoinsUsesSendRestrictionFn test to not do a partial write for the expected-to-fail SendCoins. * [1619]: Refactor TestInputOutputCoinsWithRestrictions and TestSendCoinsWithRestrictions to use a cache context to not get partial updates. * [1619]: Tweak/fix some comments. * [1619]: Move the sendRestriction application in DelegateCoins to after the coins have been subtracted from the source account. * [1619]: Fix test-sim-after-import that started failing at seed 3012 because the last validator was being removed at the end of the last block. So the exported state didn't have any validators causing the import to panic. When that happens on other blocks, it handles it just fine, it was just that it was happening on the very last block that caused the problem. * [1619]: Add changelog entry. * Add binary version to status (#578) * Added custom nodeInfo type on response, and query for NodeInfo in order to get binary version. Refactored code to remove circular dependency. * Added json tags to lowercase fields. * Removed comment. * Added ChangeLog entry. --------- Co-authored-by: Matt Witkowski <mwitkowski@provenance.io>
19 tasks
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.
Description
Related: provenance-io/provenance#1619
This PR:
GetLockedCoinsFn
type and allows them to be provided to the bank's view keeper.LockedCoins
toUnvestedCoins
, appendsUnvestedCoins
as aGetLockedCoinsFn
by default, and remakesLockedCoins
to just call the definedGetLockedCoinsFn
.SpendableCoins
to ignore only resulting negative/zero denoms instead of reporting that nothing is spendable when one denom is over-locked.SendRestrictionFn
toDelegateCoins
.SendCoins
, moves theSendRestrictionFn
call to aftersubUnlockedCoins
so that all calls to theSendRestrictionFn
now happen after the subtraction but before the addition.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