-
Notifications
You must be signed in to change notification settings - Fork 586
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Enable/Disable controller/host on-chain params (#566)
* add ica params Add new Params type to ICA. A single test is added to check defaults and validation. Usage within the ICA keepers is still needed * regenerate params proto into host and controller submodules * split params implementation into host/controller * add keeper params logic * Apply suggestions from code review Co-authored-by: Damian Nolan <damiannolan@gmail.com> * add host genesis init/export params test case * add genesis validation for controller and host params Co-authored-by: Damian Nolan <damiannolan@gmail.com>
- Loading branch information
1 parent
e6a5583
commit d681c0d
Showing
25 changed files
with
1,129 additions
and
57 deletions.
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
24 changes: 24 additions & 0 deletions
24
modules/apps/27-interchain-accounts/controller/keeper/params.go
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,24 @@ | ||
package keeper | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
"github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/controller/types" | ||
) | ||
|
||
// GetControllerEnabled retrieves the host enabled boolean from the paramstore | ||
func (k Keeper) GetControllerEnabled(ctx sdk.Context) bool { | ||
var res bool | ||
k.paramSpace.Get(ctx, types.KeyControllerEnabled, &res) | ||
return res | ||
} | ||
|
||
// GetParams returns the total set of the host submodule parameters. | ||
func (k Keeper) GetParams(ctx sdk.Context) types.Params { | ||
return types.NewParams(k.GetControllerEnabled(ctx)) | ||
} | ||
|
||
// SetParams sets the total set of the host submodule parameters. | ||
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { | ||
k.paramSpace.SetParamSet(ctx, ¶ms) | ||
} |
15 changes: 15 additions & 0 deletions
15
modules/apps/27-interchain-accounts/controller/keeper/params_test.go
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,15 @@ | ||
package keeper_test | ||
|
||
import "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/controller/types" | ||
|
||
func (suite *KeeperTestSuite) TestParams() { | ||
expParams := types.DefaultParams() | ||
|
||
params := suite.chainA.GetSimApp().ICAControllerKeeper.GetParams(suite.chainA.GetContext()) | ||
suite.Require().Equal(expParams, params) | ||
|
||
expParams.ControllerEnabled = false | ||
suite.chainA.GetSimApp().ICAControllerKeeper.SetParams(suite.chainA.GetContext(), expParams) | ||
params = suite.chainA.GetSimApp().ICAControllerKeeper.GetParams(suite.chainA.GetContext()) | ||
suite.Require().Equal(expParams, params) | ||
} |
Oops, something went wrong.