Skip to content

Commit

Permalink
refactor!: rm GetSignBytes
Browse files Browse the repository at this point in the history
  • Loading branch information
skyargos committed Nov 6, 2024
1 parent f0baea0 commit 0c2aa0e
Show file tree
Hide file tree
Showing 12 changed files with 0 additions and 344 deletions.
19 changes: 0 additions & 19 deletions x/auth/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package types
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
Expand Down Expand Up @@ -48,21 +47,3 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {

msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}

var (
amino = codec.NewLegacyAmino()

// ModuleCdc references the global x/auth module codec. Note, the codec should
// ONLY be used in certain instances of tests and for JSON encoding as Amino is
// still used for that purpose.
//
// The actual codec used for serialization should be provided to x/auth and
// defined at the application level.
ModuleCdc = codec.NewAminoCodec(amino)
)

func init() {
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)
amino.Seal()
}
5 changes: 0 additions & 5 deletions x/auth/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ func (m MsgUnlock) ValidateBasic() error {
return nil
}

// GetSignBytes encodes the message for signing.
func (m MsgUnlock) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

// GetSigners defines whose signature is required.
func (m MsgUnlock) GetSigners() []sdk.AccAddress {
issuer, err := sdk.AccAddressFromBech32(m.Issuer)
Expand Down
19 changes: 0 additions & 19 deletions x/bank/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package types
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
Expand All @@ -24,21 +23,3 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {

msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}

var (
amino = codec.NewLegacyAmino()

// ModuleCdc references the global x/bank module codec. Note, the codec should
// ONLY be used in certain instances of tests and for JSON encoding as Amino is
// still used for that purpose.
//
// The actual codec used for serialization should be provided to x/staking and
// defined at the application level.
ModuleCdc = codec.NewAminoCodec(amino)
)

func init() {
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)
amino.Seal()
}
5 changes: 0 additions & 5 deletions x/bank/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ func (m MsgLockedSend) ValidateBasic() error {
return nil
}

// GetSignBytes encodes the message for signing.
func (m MsgLockedSend) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

// GetSigners defines whose signature is required.
func (m MsgLockedSend) GetSigners() []sdk.AccAddress {
from, err := sdk.AccAddressFromBech32(m.FromAddress)
Expand Down
19 changes: 0 additions & 19 deletions x/bounty/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package types
import (
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
)
Expand Down Expand Up @@ -41,21 +40,3 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {

msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}

var (
amino = codec.NewLegacyAmino()

// ModuleCdc references the global x/bounty module codec. Note, the codec should
// ONLY be used in certain instances of tests and for JSON encoding as Amino is
// still used for that purpose.
//
// The actual codec used for serialization should be provided to x/bounty and
// defined at the application level.
ModuleCdc = codec.NewAminoCodec(amino)
)

func init() {
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)
amino.Seal()
}
96 changes: 0 additions & 96 deletions x/bounty/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ func (msg MsgCreateProgram) Route() string { return RouterKey }
// Type implements the sdk.Msg interface.
func (msg MsgCreateProgram) Type() string { return TypeMsgCreateProgram }

// GetSigners implements the sdk.Msg interface. It returns the address(es) that
// must sign over msg.GetSignBytes().
// If the validator address is not same as delegator's, then the validator must
// sign the msg as well.
func (msg MsgCreateProgram) GetSigners() []sdk.AccAddress {
// creator should sign the message
cAddr, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
Expand All @@ -57,12 +53,6 @@ func (msg MsgCreateProgram) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{cAddr}
}

// GetSignBytes returns the message bytes to sign over.
func (msg MsgCreateProgram) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(&msg)
return sdk.MustSortJSON(bz)
}

// ValidateBasic implements the sdk.Msg interface.
func (msg MsgCreateProgram) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
Expand Down Expand Up @@ -97,10 +87,6 @@ func (msg MsgEditProgram) Route() string { return RouterKey }
// Type implements the sdk.Msg interface.
func (msg MsgEditProgram) Type() string { return TypeMsgEditProgram }

// GetSigners implements the sdk.Msg interface. It returns the address(es) that
// must sign over msg.GetSignBytes().
// If the validator address is not same as delegator's, then the validator must
// sign the msg as well.
func (msg MsgEditProgram) GetSigners() []sdk.AccAddress {
// creator should sign the message
cAddr, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
Expand All @@ -111,12 +97,6 @@ func (msg MsgEditProgram) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{cAddr}
}

// GetSignBytes returns the message bytes to sign over.
func (msg MsgEditProgram) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(&msg)
return sdk.MustSortJSON(bz)
}

// ValidateBasic implements the sdk.Msg interface.
func (msg MsgEditProgram) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
Expand Down Expand Up @@ -146,10 +126,6 @@ func (msg MsgSubmitFinding) Route() string { return RouterKey }
// Type implements the sdk.Msg interface.
func (msg MsgSubmitFinding) Type() string { return TypeMsgSubmitFinding }

// GetSigners implements the sdk.Msg interface. It returns the address(es) that
// must sign over msg.GetSignBytes().
// If the validator address is not same as delegator's, then the validator must
// sign the msg as well.
func (msg MsgSubmitFinding) GetSigners() []sdk.AccAddress {
// creator should sign the message
cAddr, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
Expand All @@ -160,12 +136,6 @@ func (msg MsgSubmitFinding) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{cAddr}
}

// GetSignBytes returns the message bytes to sign over.
func (msg MsgSubmitFinding) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(&msg)
return sdk.MustSortJSON(bz)
}

// ValidateBasic implements the sdk.Msg interface.
func (msg MsgSubmitFinding) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
Expand Down Expand Up @@ -204,10 +174,6 @@ func (msg MsgEditFinding) Route() string { return RouterKey }
// Type implements the sdk.Msg interface.
func (msg MsgEditFinding) Type() string { return TypeMsgEditFinding }

// GetSigners implements the sdk.Msg interface. It returns the address(es) that
// must sign over msg.GetSignBytes().
// If the validator address is not same as delegator's, then the validator must
// sign the msg as well.
func (msg MsgEditFinding) GetSigners() []sdk.AccAddress {
// creator should sign the message
cAddr, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
Expand All @@ -218,12 +184,6 @@ func (msg MsgEditFinding) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{cAddr}
}

// GetSignBytes returns the message bytes to sign over.
func (msg MsgEditFinding) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(&msg)
return sdk.MustSortJSON(bz)
}

// ValidateBasic implements the sdk.Msg interface.
func (msg MsgEditFinding) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
Expand Down Expand Up @@ -252,19 +212,11 @@ func (msg MsgActivateProgram) Route() string { return RouterKey }
// Type implements sdk.Msg interface.
func (msg MsgActivateProgram) Type() string { return TypeMsgActivateProgram }

// GetSigners implements sdk.Msg interface. It returns the address(es) that
// must sign over msg.GetSignBytes().
func (msg MsgActivateProgram) GetSigners() []sdk.AccAddress {
cAddr, _ := sdk.AccAddressFromBech32(msg.OperatorAddress)
return []sdk.AccAddress{cAddr}
}

// GetSignBytes implements the sdk.Msg interface, returns the message bytes to sign over.
func (msg MsgActivateProgram) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(&msg)
return sdk.MustSortJSON(bz)
}

// ValidateBasic implements the sdk.Msg interface.
func (msg MsgActivateProgram) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
Expand All @@ -290,19 +242,11 @@ func (msg MsgCloseProgram) Route() string { return RouterKey }
// Type implements sdk.Msg interface.
func (msg MsgCloseProgram) Type() string { return TypeMsgCloseProgram }

// GetSigners implements sdk.Msg interface. It returns the address(es) that
// must sign over msg.GetSignBytes().
func (msg MsgCloseProgram) GetSigners() []sdk.AccAddress {
cAddr, _ := sdk.AccAddressFromBech32(msg.OperatorAddress)
return []sdk.AccAddress{cAddr}
}

// GetSignBytes implements the sdk.Msg interface, returns the message bytes to sign over.
func (msg MsgCloseProgram) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(&msg)
return sdk.MustSortJSON(bz)
}

// ValidateBasic implements the sdk.Msg interface.
func (msg MsgCloseProgram) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
Expand All @@ -328,14 +272,6 @@ func (msg MsgActivateFinding) Route() string { return RouterKey }
// Type implements the sdk.Msg interface.
func (msg MsgActivateFinding) Type() string { return TypeMsgActivateFinding }

// GetSignBytes returns the message bytes to sign over.
func (msg MsgActivateFinding) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(&msg)
return sdk.MustSortJSON(bz)
}

// GetSigners implements the sdk.Msg interface. It returns the address(es) that
// must sign over msg.GetSignBytes().
func (msg MsgActivateFinding) GetSigners() []sdk.AccAddress {
// host should sign the message
hostAddr, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
Expand Down Expand Up @@ -372,14 +308,6 @@ func (msg MsgConfirmFinding) Route() string { return RouterKey }
// Type implements the sdk.Msg interface.
func (msg MsgConfirmFinding) Type() string { return TypeMsgConfirmFinding }

// GetSignBytes returns the message bytes to sign over.
func (msg MsgConfirmFinding) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(&msg)
return sdk.MustSortJSON(bz)
}

// GetSigners implements the sdk.Msg interface. It returns the address(es) that
// must sign over msg.GetSignBytes().
func (msg MsgConfirmFinding) GetSigners() []sdk.AccAddress {
// host should sign the message
hostAddr, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
Expand Down Expand Up @@ -418,14 +346,6 @@ func (msg MsgConfirmFindingPaid) Route() string { return RouterKey }
// Type implements the sdk.Msg interface.
func (msg MsgConfirmFindingPaid) Type() string { return TypeMsgConfirmFindingPaid }

// GetSignBytes returns the message bytes to sign over.
func (msg MsgConfirmFindingPaid) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(&msg)
return sdk.MustSortJSON(bz)
}

// GetSigners implements the sdk.Msg interface. It returns the address(es) that
// must sign over msg.GetSignBytes().
func (msg MsgConfirmFindingPaid) GetSigners() []sdk.AccAddress {
// host should sign the message
hostAddr, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
Expand Down Expand Up @@ -462,14 +382,6 @@ func (msg MsgCloseFinding) Route() string { return RouterKey }
// Type implements the sdk.Msg interface.
func (msg MsgCloseFinding) Type() string { return TypeMsgCloseFinding }

// GetSignBytes returns the message bytes to sign over.
func (msg MsgCloseFinding) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(&msg)
return sdk.MustSortJSON(bz)
}

// GetSigners implements the sdk.Msg interface. It returns the address(es) that
// must sign over msg.GetSignBytes().
func (msg MsgCloseFinding) GetSigners() []sdk.AccAddress {
// host should sign the message
hostAddr, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
Expand Down Expand Up @@ -509,8 +421,6 @@ func (msg MsgPublishFinding) Route() string { return RouterKey }
// Type implements the sdk.Msg interface.
func (msg MsgPublishFinding) Type() string { return TypeMsgPublishFinding }

// GetSigners implements the sdk.Msg interface. It returns the address(es) that
// must sign over msg.GetSignBytes().
func (msg MsgPublishFinding) GetSigners() []sdk.AccAddress {
// releaser should sign the message
cAddr, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
Expand All @@ -520,12 +430,6 @@ func (msg MsgPublishFinding) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{cAddr}
}

// GetSignBytes returns the message bytes to sign over.
func (msg MsgPublishFinding) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(&msg)
return sdk.MustSortJSON(bz)
}

// ValidateBasic implements the sdk.Msg interface.
func (msg MsgPublishFinding) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
Expand Down
19 changes: 0 additions & 19 deletions x/cert/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package types
import (
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
govtypesv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
Expand Down Expand Up @@ -56,21 +55,3 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {

msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}

var (
amino = codec.NewLegacyAmino()

// ModuleCdc references the global x/cert module codec. Note, the codec should
// ONLY be used in certain instances of tests and for JSON encoding as Amino is
// still used for that purpose.
//
// The actual codec used for serialization should be provided to x/cert and
// defined at the application level.
ModuleCdc = codec.NewAminoCodec(amino)
)

func init() {
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)
amino.Seal()
}
Loading

0 comments on commit 0c2aa0e

Please sign in to comment.