-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
feat(bank): Allow injectable restrictions on bank transfers #14224
Merged
Merged
Changes from 22 commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
83de950
[14124]: Define a SendRestriction function type.
SpicyLemon 1648159
[14124]: Move the MintingRestrictionFn in with the SendRestrictionFn …
SpicyLemon 66b2b93
[14124]: Change InputOutputCoins to accept only a single input since …
SpicyLemon 845480d
[14124]: Add a SendRestrictionFn to the send keeper. Rename the exist…
SpicyLemon df54462
[14124]: Remove the SendCoinsWithoutRestriction and always run restri…
SpicyLemon ba605c3
[14124]: Create a struct to hold the send restriction function that c…
SpicyLemon 66e8474
[14124]: Switch the keeper to use this SendRestriction holder and giv…
SpicyLemon bc988d9
[14124]: Add some more unit test cases on the SendCoins w/restrictions.
SpicyLemon 3f6ea3a
[14124]: Add unit tests on InputOutputCoins with restrictions.
SpicyLemon a5b1afe
[14124]: Add unit tests on append and prepend send restrictions.
SpicyLemon 64bb3c1
[14124]: Update the gov mocks to include the new Append and Prepend r…
SpicyLemon 9bd62bf
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon 987e9c5
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon e388801
[14124]: Update changelog.
SpicyLemon 1ef3412
[14124]: Fix a couple test failure messages.
SpicyLemon 60fbf14
[14124]: Fix some import ordering.
SpicyLemon 915216e
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon 66ec36f
[14124]: Update spec doc with SendKeeper Append and Prepend SendRestr…
SpicyLemon 1f0efb8
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon c9cc904
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon 28f37ed
[14124]: Fix test compilation (due to AccountI change).
SpicyLemon a0befb3
[14124]: Lint fixes.
SpicyLemon 327f218
[14124]: Add some extra info to the restriction composition function …
SpicyLemon f4d0a12
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon 6202a5d
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon 8aba61a
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon a994e79
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon 916608b
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon ed42c18
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon 4260317
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon 2a3f9fa
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon c9b5bab
[14124]: Remove the API Breaking change listing since another PR did …
SpicyLemon c7583b4
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon f54f8fa
[14124]: Move the definition of the restriction functions into the ty…
SpicyLemon c9b7b71
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon c6e1dca
[14124]: Move the wrapper for the SendRestrictionFn back into the kee…
SpicyLemon 053a518
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon 0000a6e
[14124]: Regen mocks to get the ClearSendRestriction.
SpicyLemon 2f61c50
Fix broken reference to moved MintingRestrictionFn definition.
SpicyLemon 231c925
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon dfb0f30
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon a452e6a
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon 1c009f5
[14124]: Fix compilation issue after merge.
SpicyLemon a0f7191
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon c43f119
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon 114838d
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon 89680e8
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon a116b9a
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon 0f36433
Move the send restriction application in SendCoins to after subUnlock…
SpicyLemon acbc96c
Add some spec documentation about the send restrictions.
SpicyLemon fdd3354
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon 7140caa
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon d4eca5d
[14124]: Fix unit tests that broke when I changed the location of the…
SpicyLemon 8fb5fd4
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon 7ab7b5a
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon 555523c
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon adb1e73
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon 58b6f99
Merge branch 'main' into dwedul/14124-bank-restrictions
SpicyLemon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package keeper | ||
|
||
// This file exists in the keeper package to expose some private things | ||
// for the purpose of testing in the keeper_test package. | ||
|
||
func (k BaseSendKeeper) SetSendRestriction(restriction SendRestrictionFn) { | ||
k.sendRestriction.Fn = restriction | ||
} | ||
|
||
func (k BaseSendKeeper) GetSendRestrictionFn() SendRestrictionFn { | ||
return k.sendRestriction.Fn | ||
} |
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
Oops, something went wrong.
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.
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.
This is late, and may have been discussed already, but I wonder what the need is for having 2 new methods, compared to just, say,
AppendSendRestriction
? More importantly, how can a module decide whether itsSendRestrictionFn
should be prepended vs appended? It seems like a global decision that can't be made locally.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.
The ordering of send restrictions might matter. I expect most things will use
Append
, but there could easily be a situation where a module needs theirs to go before the ones already injected.I hate when I get into a situation where I just can't do what I know I need to do because the only layer I have access too didn't provide enough control. So, while
Append
will usually be good enough,Prepend
andClear
can easily save the day.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.
But how does the module know whether it's safe to insert its restriction function before all others? That is, I see a problem where modules can be fighting each other for the correct position of their restrictions.
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.
The module can't know. The blockchain author can though, and needs to have the tools available to fix ordering problems if the arise.