Skip to content

Commit

Permalink
cleanup legacy msg related stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Oct 7, 2024
1 parent 2f594db commit dd51c58
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 178 deletions.
171 changes: 1 addition & 170 deletions x/cronos/types/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,7 @@ import (
"github.com/ethereum/go-ethereum/common"
)

const (
TypeMsgConvertVouchers = "ConvertVouchers"
TypeMsgTransferTokens = "TransferTokens"
TypeMsgUpdateTokenMapping = "UpdateTokenMapping"
TypeMsgUpdateParams = "UpdateParams"
TypeMsgTurnBridge = "TurnBridge"
TypeMsgUpdatePermissions = "UpdatePermissions"
TypeMsgStoreBlockList = "StoreBlockList"
)
const TypeMsgUpdateTokenMapping = "UpdateTokenMapping"

var (
_ sdk.Msg = &MsgConvertVouchers{}
Expand All @@ -39,31 +31,6 @@ func NewMsgConvertVouchers(address string, coins sdk.Coins) *MsgConvertVouchers
}
}

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

// Type ...
func (msg MsgConvertVouchers) Type() string {
return TypeMsgConvertVouchers
}

// GetSigners ...
func (msg *MsgConvertVouchers) GetSigners() []sdk.AccAddress {
address, err := sdk.AccAddressFromBech32(msg.Address)
if err != nil {
panic(err)
}
return []sdk.AccAddress{address}
}

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

// ValidateBasic ...
func (msg *MsgConvertVouchers) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Address)
Expand All @@ -90,31 +57,6 @@ func NewMsgTransferTokens(from string, to string, coins sdk.Coins) *MsgTransferT
}
}

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

// Type ...
func (msg MsgTransferTokens) Type() string {
return TypeMsgTransferTokens
}

// GetSigners ...
func (msg *MsgTransferTokens) GetSigners() []sdk.AccAddress {
from, err := sdk.AccAddressFromBech32(msg.From)
if err != nil {
panic(err)
}
return []sdk.AccAddress{from}
}

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

// ValidateBasic ...
func (msg *MsgTransferTokens) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.From)
Expand Down Expand Up @@ -174,22 +116,11 @@ func (msg *MsgUpdateTokenMapping) ValidateBasic() error {
return nil
}

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

// Type ...
func (msg MsgUpdateTokenMapping) Type() string {
return TypeMsgUpdateTokenMapping
}

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

// NewMsgTurnBridge ...
func NewMsgTurnBridge(admin string, enable bool) *MsgTurnBridge {
return &MsgTurnBridge{
Expand All @@ -198,15 +129,6 @@ func NewMsgTurnBridge(admin string, enable bool) *MsgTurnBridge {
}
}

// GetSigners ...
func (msg *MsgTurnBridge) GetSigners() []sdk.AccAddress {
sender, err := sdk.AccAddressFromBech32(msg.Sender)
if err != nil {
panic(err)
}
return []sdk.AccAddress{sender}
}

// ValidateBasic ...
func (msg *MsgTurnBridge) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Sender)
Expand All @@ -217,38 +139,13 @@ func (msg *MsgTurnBridge) ValidateBasic() error {
return nil
}

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

// Type ...
func (msg MsgTurnBridge) Type() string {
return TypeMsgTurnBridge
}

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

func NewMsgUpdateParams(authority string, params Params) *MsgUpdateParams {
return &MsgUpdateParams{
Authority: authority,
Params: params,
}
}

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

// ValidateBasic does a sanity check on the provided data.
func (msg *MsgUpdateParams) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil {
Expand All @@ -262,22 +159,6 @@ func (msg *MsgUpdateParams) ValidateBasic() error {
return nil
}

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

// Type ...
func (msg MsgUpdateParams) Type() string {
return TypeMsgUpdateParams
}

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

// NewMsgUpdatePermissions ...
func NewMsgUpdatePermissions(from string, address string, permissions uint64) *MsgUpdatePermissions {
return &MsgUpdatePermissions{
Expand All @@ -287,15 +168,6 @@ func NewMsgUpdatePermissions(from string, address string, permissions uint64) *M
}
}

// GetSigners ...
func (msg *MsgUpdatePermissions) GetSigners() []sdk.AccAddress {
sender, err := sdk.AccAddressFromBech32(msg.From)
if err != nil {
panic(err)
}
return []sdk.AccAddress{sender}
}

// ValidateBasic ...
func (msg *MsgUpdatePermissions) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.From)
Expand All @@ -310,22 +182,6 @@ func (msg *MsgUpdatePermissions) ValidateBasic() error {
return nil
}

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

// Type ...
func (msg MsgUpdatePermissions) Type() string {
return TypeMsgUpdatePermissions
}

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

func NewMsgStoreBlockList(from string, blob []byte) *MsgStoreBlockList {
return &MsgStoreBlockList{
From: from,
Expand Down Expand Up @@ -360,28 +216,3 @@ func (msg *MsgStoreBlockList) ValidateBasic() error {
}
return nil
}

func (msg *MsgStoreBlockList) GetSigners() []sdk.AccAddress {
addr, err := sdk.AccAddressFromBech32(msg.From)
if err != nil {
panic(err)
}

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
}
8 changes: 0 additions & 8 deletions x/e2ee/types/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,3 @@ func ValidateRecipientKey(key string) error {
_, err := age.ParseX25519Recipient(key)
return err
}

func (m *MsgRegisterEncryptionKey) GetSigners() []sdk.AccAddress {
addr, err := sdk.AccAddressFromBech32(m.Address)
if err != nil {
panic(err)
}
return []sdk.AccAddress{addr}
}

0 comments on commit dd51c58

Please sign in to comment.