-
Notifications
You must be signed in to change notification settings - Fork 607
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(superfluid/gov): configure unpool whitelist via gov prop #3512
Conversation
|
||
// GetIfFound gets key from store | ||
// returns a boolean indicating whether value exists for the given key and error | ||
func GetIfFound(store store.KVStore, key []byte, result proto.Message) (found bool, err error) { |
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.
Can be changed later / can discuss in an issue, should not block this PR. Perhaps this should be called HasWithType
?
e.g. if we were masters of the store interface
store.HasProtoMsg("myKey", types.Pool)
Has to indicate its a bool (rather than assuming you'd get the object back)
OR is proto.Message here actually mutated? If so lets update the comment, but this doesn't actually make sense to me as an API.
Why don't just make a method called Get
thats the same as MustGet, but returns an error instead of panics?
@@ -10,23 +10,25 @@ import ( | |||
func ProposalSetSuperfluidAssetsRESTHandler(clientCtx client.Context) govrest.ProposalRESTHandler { | |||
return govrest.ProposalRESTHandler{ | |||
SubRoute: "set-superfluid-assets", | |||
Handler: newSetSuperfluidAssetsHandler(clientCtx), |
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.
idk whats going on here, but IIRC this REST folder doesn't matter for anything / should be deleted, so not blocking
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.
For each of these, the handler is the same - no-op. I just made a shared no-op function for all of these but yes it's unimportant
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.
ah that makes sense! Nice :)
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.
Looks great to me! Can we just sanity check that we have an existing test for ensuring that unpooling doesn't work for pools not in whitelist?
func (suite *KeeperTestSuite) TestHandleUnpoolWhiteListChange() { | ||
const ( | ||
testTitle = "test title" | ||
testDescription = "test description" | ||
) |
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.
Great job on the test!
Co-authored-by: Dev Ojha <[email protected]>
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.
Well done 👍
x/superfluid/client/cli/tx.go
Outdated
Args: cobra.ExactArgs(0), | ||
Short: "Update unpool whitelist proposal", | ||
Long: "This proposal will update the unpool whitelist if passed. " + | ||
"Every pool id must be valid. If proposal passes, and the pool id is invalid, the proposal will not take any effect. " + |
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.
Why don't we run GetPoolAndPoke in ValidateBasic to prevent this from happening?
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.
Unfortunately, we don't have access to the gamm keeper in ValidateBasic()
.
However, I found out that gov module attempts to test-run the proposal with cache context before allowing it to be submitted:
https://github.com/osmosis-labs/cosmos-sdk/blob/870132d311d162fdbe0e92fcc0a42ee3889afd0d/x/gov/keeper/proposal.go#L22-L29
So if pool doesn't exist, it will not be submitted. I will change the wording
* feat(superfluid/gov): configure unpool whitelist via gov prop * cli and amino registrateions * linter * Update x/superfluid/keeper/gov/suite_test.go * Update x/superfluid/keeper/gov/suite_test.go * add tests for GetIfFound (#3145) * add tests for GetIfFound * refactor * cli fix * cli updates * remove message not activated * Update x/superfluid/types/gov.go Co-authored-by: Dev Ojha <[email protected]> * correct CLI wording * GetIfFound godoc Co-authored-by: Hieu Vu <[email protected]> Co-authored-by: Dev Ojha <[email protected]> (cherry picked from commit 404cf9b)
Test added: #3532 |
…#3531) * feat(superfluid/gov): configure unpool whitelist via gov prop * cli and amino registrateions * linter * Update x/superfluid/keeper/gov/suite_test.go * Update x/superfluid/keeper/gov/suite_test.go * add tests for GetIfFound (#3145) * add tests for GetIfFound * refactor * cli fix * cli updates * remove message not activated * Update x/superfluid/types/gov.go Co-authored-by: Dev Ojha <[email protected]> * correct CLI wording * GetIfFound godoc Co-authored-by: Hieu Vu <[email protected]> Co-authored-by: Dev Ojha <[email protected]> (cherry picked from commit 404cf9b) Co-authored-by: Roman <[email protected]>
Closes: #XXX
What is the purpose of the change
Add the ability to configure the unpool whitelist via gov prop.
The new gov prop takes the list of pool ids and
isOverwriteFlag
. If the flag is true, the old pool ids are discarded. If false, the old pool ids are merged with the new.Brief Changelog
Testing and Verifying
Upon enabling whitelist, it is still impossible to run:
We should enable that message in a separate PR.
Documentation and Release Note
Unreleased
section inCHANGELOG.md
? yes