Skip to content

Commit

Permalink
Problem: internal msg can't be used in amino sign (#1477)
Browse files Browse the repository at this point in the history
* Problem: internal msg can't be used in amino sign

Solution:
- implements legacytx.LegacyMsg

* fix msg type
  • Loading branch information
yihuang authored Jun 18, 2024
1 parent 9b25932 commit fb3477e
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions x/cronos/types/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"filippo.io/age"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
"github.com/ethereum/go-ethereum/common"
)

Expand All @@ -19,16 +20,17 @@ const (
TypeMsgUpdateParams = "UpdateParams"
TypeMsgTurnBridge = "TurnBridge"
TypeMsgUpdatePermissions = "UpdatePermissions"
TypeMsgStoreBlockList = "StoreBlockList"
)

var (
_ sdk.Msg = &MsgConvertVouchers{}
_ sdk.Msg = &MsgTransferTokens{}
_ sdk.Msg = &MsgUpdateTokenMapping{}
_ sdk.Msg = &MsgUpdateParams{}
_ sdk.Msg = &MsgTurnBridge{}
_ sdk.Msg = &MsgUpdatePermissions{}
_ sdk.Msg = &MsgStoreBlockList{}
_ legacytx.LegacyMsg = &MsgConvertVouchers{}
_ legacytx.LegacyMsg = &MsgTransferTokens{}
_ legacytx.LegacyMsg = &MsgUpdateTokenMapping{}
_ legacytx.LegacyMsg = &MsgUpdateParams{}
_ legacytx.LegacyMsg = &MsgTurnBridge{}
_ legacytx.LegacyMsg = &MsgUpdatePermissions{}
_ legacytx.LegacyMsg = &MsgStoreBlockList{}
)

func NewMsgConvertVouchers(address string, coins sdk.Coins) *MsgConvertVouchers {
Expand Down Expand Up @@ -361,3 +363,19 @@ func (msg *MsgStoreBlockList) GetSigners() []sdk.AccAddress {

return []sdk.AccAddress{addr}
}

// GetSignBytes ...
func (msg *MsgStoreBlockList) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}

// Route ...
func (msg MsgStoreBlockList) Route() string {
return RouterKey
}

// Type ...
func (msg MsgStoreBlockList) Type() string {
return TypeMsgStoreBlockList
}

0 comments on commit fb3477e

Please sign in to comment.