Skip to content

Commit

Permalink
fix MsgUpdateParams
Browse files Browse the repository at this point in the history
  • Loading branch information
neitdung committed Jul 14, 2024
1 parent 13dbee2 commit 3fca8be
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions x/meshsecurityprovider/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ import (
// RegisterLegacyAminoCodec registers the necessary x/meshsecurityprovider interfaces and concrete types
// on the provided LegacyAmino codec. These types are used for Amino JSON serialization.
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgUpdateParams{}, "meshsecurityprovider/MsgUpdateParams", nil)
}

func RegisterInterfaces(registry types.InterfaceRegistry) {
registry.RegisterImplementations(
(*sdk.Msg)(nil),
&MsgUpdateParams{},
)

msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
Expand Down
31 changes: 31 additions & 0 deletions x/meshsecurityprovider/types/msgs.go
Original file line number Diff line number Diff line change
@@ -1 +1,32 @@
package types

import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
)

var _ sdk.Msg = &MsgUpdateParams{}


const (
TypeMsgUpdateParams = "update-params"
)


func (msg MsgUpdateParams) Route() string { return ModuleName }
func (msg MsgUpdateParams) Type() string { return TypeMsgUpdateParams }
func (msg MsgUpdateParams) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil {
return errorsmod.Wrap(err, "invalid authority address")
}
return msg.Params.Validate()
}

func (msg MsgUpdateParams) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg))
}

func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress {
addr, _ := sdk.AccAddressFromBech32(msg.Authority)
return []sdk.AccAddress{addr}
}

0 comments on commit 3fca8be

Please sign in to comment.