Skip to content

Commit be0461b

Browse files
committed
Rename messages to match other modules.
1 parent 1cb9375 commit be0461b

File tree

10 files changed

+153
-151
lines changed

10 files changed

+153
-151
lines changed

e2e/tests/core/03-connection/connection_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (s *ConnectionTestSuite) TestMaxExpectedTimePerBlockParam() {
6969
s.Require().NoError(err)
7070
s.Require().NotNil(authority)
7171

72-
msg := connectiontypes.NewMsgUpdateConnectionParams(authority.String(), connectiontypes.NewParams(delay))
72+
msg := connectiontypes.NewMsgUpdateParams(authority.String(), connectiontypes.NewParams(delay))
7373
s.ExecuteGovProposalV1(ctx, msg, chainA, chainAWallet, 1)
7474
} else {
7575
changes := []paramsproposaltypes.ParamChange{

modules/core/03-connection/keeper/keeper.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ func (k Keeper) addConnectionToClient(ctx sdk.Context, clientID, connectionID st
226226
func (k Keeper) GetParams(ctx sdk.Context) types.Params {
227227
store := ctx.KVStore(k.storeKey)
228228
bz := store.Get([]byte(types.ParamsKey))
229-
if len(bz) == 0 {
230-
return types.Params{}
229+
if bz == nil { // only panic on unset params and not on empty params
230+
panic("controller params are not set in store")
231231
}
232232

233233
var params types.Params

modules/core/03-connection/keeper/keeper_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -224,5 +224,7 @@ func (suite *KeeperTestSuite) TestUnsetParams() {
224224
store := ctx.KVStore(suite.chainA.GetSimApp().GetKey(exported.StoreKey))
225225
store.Delete([]byte(types.ParamsKey))
226226

227-
suite.Require().Equal(suite.chainA.GetSimApp().IBCKeeper.ConnectionKeeper.GetParams(ctx), types.Params{})
227+
suite.Require().Panics(func() {
228+
suite.chainA.GetSimApp().IBCKeeper.ConnectionKeeper.GetParams(ctx)
229+
})
228230
}

modules/core/03-connection/types/codec.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
3333
&MsgConnectionOpenTry{},
3434
&MsgConnectionOpenAck{},
3535
&MsgConnectionOpenConfirm{},
36-
&MsgUpdateConnectionParams{},
36+
&MsgUpdateParams{},
3737
)
3838

3939
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)

modules/core/03-connection/types/msgs.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var (
1717
_ sdk.Msg = (*MsgConnectionOpenConfirm)(nil)
1818
_ sdk.Msg = (*MsgConnectionOpenAck)(nil)
1919
_ sdk.Msg = (*MsgConnectionOpenTry)(nil)
20-
_ sdk.Msg = (*MsgUpdateConnectionParams)(nil)
20+
_ sdk.Msg = (*MsgUpdateParams)(nil)
2121

2222
_ codectypes.UnpackInterfacesMessage = (*MsgConnectionOpenTry)(nil)
2323
_ codectypes.UnpackInterfacesMessage = (*MsgConnectionOpenAck)(nil)
@@ -291,25 +291,25 @@ func (msg MsgConnectionOpenConfirm) GetSigners() []sdk.AccAddress {
291291
return []sdk.AccAddress{accAddr}
292292
}
293293

294-
// NewMsgUpdateConnectionParams creates a new MsgUpdateConnectionParams instance
295-
func NewMsgUpdateConnectionParams(authority string, params Params) *MsgUpdateConnectionParams {
296-
return &MsgUpdateConnectionParams{
294+
// NewMsgUpdateParams creates a new MsgUpdateParams instance
295+
func NewMsgUpdateParams(authority string, params Params) *MsgUpdateParams {
296+
return &MsgUpdateParams{
297297
Authority: authority,
298298
Params: params,
299299
}
300300
}
301301

302-
// GetSigners returns the expected signers for a MsgUpdateConnectionParams message.
303-
func (msg *MsgUpdateConnectionParams) GetSigners() []sdk.AccAddress {
302+
// GetSigners returns the expected signers for a MsgUpdateParams message.
303+
func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress {
304304
accAddr, err := sdk.AccAddressFromBech32(msg.Authority)
305305
if err != nil {
306306
panic(err)
307307
}
308308
return []sdk.AccAddress{accAddr}
309309
}
310310

311-
// ValidateBasic performs basic checks on a MsgUpdateConnectionParams.
312-
func (msg *MsgUpdateConnectionParams) ValidateBasic() error {
311+
// ValidateBasic performs basic checks on a MsgUpdateParams.
312+
func (msg *MsgUpdateParams) ValidateBasic() error {
313313
if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil {
314314
return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err)
315315
}

modules/core/03-connection/types/msgs_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -232,27 +232,27 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenConfirm() {
232232
}
233233
}
234234

235-
// TestMsgUpdateConnectionParams_ValidateBasic tests ValidateBasic for MsgUpdateConnectionParams
236-
func (suite *MsgTestSuite) TestMsgUpdateConnectionParams_ValidateBasic() {
235+
// TestMsgUpdateParams_ValidateBasic tests ValidateBasic for MsgUpdateParams
236+
func (suite *MsgTestSuite) TestMsgUpdateParams_ValidateBasic() {
237237
authority := suite.chainA.App.GetIBCKeeper().GetAuthority()
238238
testCases := []struct {
239239
name string
240-
msg *types.MsgUpdateConnectionParams
240+
msg *types.MsgUpdateParams
241241
expPass bool
242242
}{
243243
{
244244
"success: valid authority and params",
245-
types.NewMsgUpdateConnectionParams(authority, types.DefaultParams()),
245+
types.NewMsgUpdateParams(authority, types.DefaultParams()),
246246
true,
247247
},
248248
{
249249
"failure: invalid authority address",
250-
types.NewMsgUpdateConnectionParams("invalid", types.DefaultParams()),
250+
types.NewMsgUpdateParams("invalid", types.DefaultParams()),
251251
false,
252252
},
253253
{
254254
"failure: invalid time per block",
255-
types.NewMsgUpdateConnectionParams(authority, types.NewParams(0)),
255+
types.NewMsgUpdateParams(authority, types.NewParams(0)),
256256
false,
257257
},
258258
}

0 commit comments

Comments
 (0)