Skip to content

Commit

Permalink
nit: rename update param messages to match other modules. (#3708)
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitrisJim authored Jun 1, 2023
1 parent 6f628d9 commit 14c2698
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 130 deletions.
2 changes: 1 addition & 1 deletion modules/core/02-client/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
&MsgUpdateClient{},
&MsgUpgradeClient{},
&MsgSubmitMisbehaviour{},
&MsgUpdateClientParams{},
&MsgUpdateParams{},
)

msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
Expand Down
16 changes: 8 additions & 8 deletions modules/core/02-client/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var (
_ sdk.Msg = (*MsgUpdateClient)(nil)
_ sdk.Msg = (*MsgSubmitMisbehaviour)(nil)
_ sdk.Msg = (*MsgUpgradeClient)(nil)
_ sdk.Msg = (*MsgUpdateClientParams)(nil)
_ sdk.Msg = (*MsgUpdateParams)(nil)

_ codectypes.UnpackInterfacesMessage = (*MsgCreateClient)(nil)
_ codectypes.UnpackInterfacesMessage = (*MsgUpdateClient)(nil)
Expand Down Expand Up @@ -266,25 +266,25 @@ func (msg MsgSubmitMisbehaviour) UnpackInterfaces(unpacker codectypes.AnyUnpacke
return unpacker.UnpackAny(msg.Misbehaviour, &misbehaviour)
}

// NewMsgUpdateClientParams creates a new instance of MsgUpdateClientParams.
func NewMsgUpdateClientParams(authority string, params Params) *MsgUpdateClientParams {
return &MsgUpdateClientParams{
// NewMsgUpdateParams creates a new instance of MsgUpdateParams.
func NewMsgUpdateParams(authority string, params Params) *MsgUpdateParams {
return &MsgUpdateParams{
Authority: authority,
Params: params,
}
}

// GetSigners returns the expected signers for a MsgUpdateClientParams message.
func (msg *MsgUpdateClientParams) GetSigners() []sdk.AccAddress {
// GetSigners returns the expected signers for a MsgUpdateParams message.
func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress {
accAddr, err := sdk.AccAddressFromBech32(msg.Authority)
if err != nil {
panic(err)
}
return []sdk.AccAddress{accAddr}
}

// ValidateBasic performs basic checks on a MsgUpdateClientParams.
func (msg *MsgUpdateClientParams) ValidateBasic() error {
// ValidateBasic performs basic checks on a MsgUpdateParams.
func (msg *MsgUpdateParams) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil {
return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err)
}
Expand Down
14 changes: 7 additions & 7 deletions modules/core/02-client/types/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,32 +610,32 @@ func (suite *TypesTestSuite) TestMsgSubmitMisbehaviour_ValidateBasic() {
}
}

// TestMsgUpdateClientParams_ValidateBasic tests ValidateBasic for MsgUpdateClientParams
func (suite *TypesTestSuite) TestMsgUpdateClientParams_ValidateBasic() {
// TestMsgUpdateParams_ValidateBasic tests ValidateBasic for MsgUpdateParams
func (suite *TypesTestSuite) TestMsgUpdateParams_ValidateBasic() {
authority := suite.chainA.App.GetIBCKeeper().GetAuthority()
testCases := []struct {
name string
msg *types.MsgUpdateClientParams
msg *types.MsgUpdateParams
expPass bool
}{
{
"success: valid authority and params",
types.NewMsgUpdateClientParams(authority, types.DefaultParams()),
types.NewMsgUpdateParams(authority, types.DefaultParams()),
true,
},
{
"success: valid authority empty params",
types.NewMsgUpdateClientParams(authority, types.Params{}),
types.NewMsgUpdateParams(authority, types.Params{}),
true,
},
{
"failure: invalid authority address",
types.NewMsgUpdateClientParams("invalid", types.DefaultParams()),
types.NewMsgUpdateParams("invalid", types.DefaultParams()),
false,
},
{
"failure: invalid allowed client",
types.NewMsgUpdateClientParams(authority, types.NewParams("")),
types.NewMsgUpdateParams(authority, types.NewParams("")),
false,
},
}
Expand Down
Loading

0 comments on commit 14c2698

Please sign in to comment.