Skip to content

Commit

Permalink
Address initial feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitrisJim committed May 24, 2023
1 parent 731a0af commit 64e0a1e
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 79 deletions.
18 changes: 0 additions & 18 deletions modules/core/02-client/exported/exported.go

This file was deleted.

2 changes: 2 additions & 0 deletions modules/core/02-client/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ type Keeper struct {
stakingKeeper types.StakingKeeper
upgradeKeeper types.UpgradeKeeper

// the address capable of executing a MsgUpdateClientParams message. Typically, this
// should be the x/gov module account.
authority string
}

Expand Down
4 changes: 2 additions & 2 deletions modules/core/02-client/keeper/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ func (k Keeper) GetAllowedClients(ctx sdk.Context) []string {

// GetParams returns the total set of ibc-client parameters.
func (k Keeper) GetParams(ctx sdk.Context) types.Params {
var p types.Params
store := ctx.KVStore(k.storeKey)
bz := store.Get([]byte(types.ParamsKey))
if bz == nil {
panic("ibc client params are not set in store")
return p
}

var p types.Params
k.cdc.MustUnmarshal(bz, &p)
return p
}
Expand Down
6 changes: 2 additions & 4 deletions modules/core/02-client/keeper/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,12 @@ func (suite *KeeperTestSuite) TestParams() {
}
}

// TestUnsetParams tests that trying to get params that are not set panics.
// TestUnsetParams tests that trying to get params that are not set returns empty params.
func (suite *KeeperTestSuite) TestUnsetParams() {
suite.SetupTest()
ctx := suite.chainA.GetContext()
store := ctx.KVStore(suite.chainA.GetSimApp().GetKey(ibcexported.StoreKey))
store.Delete([]byte(types.ParamsKey))

suite.Require().Panics(func() {
suite.chainA.GetSimApp().IBCKeeper.ClientKeeper.GetParams(ctx)
})
suite.Require().Equal(suite.chainA.GetSimApp().IBCKeeper.ClientKeeper.GetParams(ctx), types.Params{})
}
6 changes: 6 additions & 0 deletions modules/core/02-client/types/params_legacy.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
NOTE: Usage of x/params to manage parameters is deprecated in favor of x/gov
controlled execution of MsgUpdateParams messages. These types remains solely
for migration purposes and will be removed in a future release.
[#3621](https://github.com/cosmos/ibc-go/issues/3621)
*/
package types

import (
Expand Down
8 changes: 4 additions & 4 deletions modules/core/02-client/types/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ func TestIsAllowedClient(t *testing.T) {
params Params
expPass bool
}{
{"valid client", exported.Tendermint, DefaultParams(), true},
{"valid client with custom params", exported.Tendermint, NewParams(exported.Tendermint), true},
{"invalid blank client", " ", DefaultParams(), false},
{"invalid client with custom params", exported.Localhost, NewParams(exported.Tendermint), false},
{"success: valid client", exported.Tendermint, DefaultParams(), true},
{"success: valid client with custom params", exported.Tendermint, NewParams(exported.Tendermint), true},
{"success: invalid blank client", " ", DefaultParams(), false},
{"success: invalid client with custom params", exported.Localhost, NewParams(exported.Tendermint), false},
}

for _, tc := range testCases {
Expand Down
92 changes: 45 additions & 47 deletions modules/core/02-client/types/tx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions proto/ibc/core/client/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ package ibc.core.client.v1;
option go_package = "github.com/cosmos/ibc-go/v7/modules/core/02-client/types";

import "cosmos_proto/cosmos.proto";
import "cosmos/msg/v1/msg.proto";
import "ibc/core/client/v1/client.proto";
import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "ibc/core/client/v1/client.proto";

// Msg defines the ibc/client Msg service.
service Msg {
Expand Down Expand Up @@ -107,8 +106,6 @@ message MsgSubmitMisbehaviourResponse {}

// MsgUpdateClientParams defines the sdk.Msg type to update the client parameters.
message MsgUpdateClientParams {
option (cosmos.msg.v1.signer) = "authority";

// authority is the address of the governance account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

Expand Down

0 comments on commit 64e0a1e

Please sign in to comment.