Skip to content

Commit

Permalink
chore: remove unused getsigner functions (backport #16937) (#16957)
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Jul 12, 2023
1 parent 12d9cdc commit 1ae7058
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 211 deletions.
13 changes: 0 additions & 13 deletions x/auth/types/msgs.go

This file was deleted.

21 changes: 0 additions & 21 deletions x/auth/vesting/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ func NewMsgCreateVestingAccount(fromAddr, toAddr sdk.AccAddress, amount sdk.Coin
}
}

// GetSigners returns the expected signers for a MsgCreateVestingAccount.
func (msg MsgCreateVestingAccount) GetSigners() []sdk.AccAddress {
addr, _ := sdk.AccAddressFromBech32(msg.FromAddress)
return []sdk.AccAddress{addr}
}

// NewMsgCreatePermanentLockedAccount returns a reference to a new MsgCreatePermanentLockedAccount.
func NewMsgCreatePermanentLockedAccount(fromAddr, toAddr sdk.AccAddress, amount sdk.Coins) *MsgCreatePermanentLockedAccount {
return &MsgCreatePermanentLockedAccount{
Expand All @@ -36,12 +30,6 @@ func NewMsgCreatePermanentLockedAccount(fromAddr, toAddr sdk.AccAddress, amount
}
}

// GetSigners returns the expected signers for a MsgCreatePermanentLockedAccount.
func (msg MsgCreatePermanentLockedAccount) GetSigners() []sdk.AccAddress {
from, _ := sdk.AccAddressFromBech32(msg.FromAddress)
return []sdk.AccAddress{from}
}

// NewMsgCreatePeriodicVestingAccount returns a reference to a new MsgCreatePeriodicVestingAccount.
func NewMsgCreatePeriodicVestingAccount(fromAddr, toAddr sdk.AccAddress, startTime int64, periods []Period) *MsgCreatePeriodicVestingAccount {
return &MsgCreatePeriodicVestingAccount{
Expand All @@ -51,12 +39,3 @@ func NewMsgCreatePeriodicVestingAccount(fromAddr, toAddr sdk.AccAddress, startTi
VestingPeriods: periods,
}
}

// GetSigners returns the expected signers for a MsgCreatePeriodicVestingAccount.
func (msg MsgCreatePeriodicVestingAccount) GetSigners() []sdk.AccAddress {
from, err := sdk.AccAddressFromBech32(msg.FromAddress)
if err != nil {
panic(err)
}
return []sdk.AccAddress{from}
}
8 changes: 0 additions & 8 deletions x/bank/types/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,6 @@ func TestNewMsgSetSendEnabled(t *testing.T) {
}
}

func TestMsgSendGetSigners(t *testing.T) {
from := sdk.AccAddress([]byte("input111111111111111"))
msg := NewMsgSend(from, sdk.AccAddress{}, sdk.NewCoins())
res := msg.GetSigners()
require.Equal(t, 1, len(res))
require.True(t, from.Equals(res[0]))
}

func TestMsgSetSendEnabledGetSignBytes(t *testing.T) {
msg := NewMsgSetSendEnabled("cartman", []*SendEnabled{{"casafiestacoin", false}, {"kylecoin", true}}, nil)
expected := `{"type":"cosmos-sdk/MsgSetSendEnabled","value":{"authority":"cartman","send_enabled":[{"denom":"casafiestacoin"},{"denom":"kylecoin","enabled":true}]}}`
Expand Down
18 changes: 0 additions & 18 deletions x/circuit/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ func NewMsgAuthorizeCircuitBreaker(granter, grantee string, permission *Permissi
}
}

// Route Implements Msg.
func (m MsgAuthorizeCircuitBreaker) Route() string { return sdk.MsgTypeURL(&m) }

// Type Implements Msg.
func (m MsgAuthorizeCircuitBreaker) Type() string { return sdk.MsgTypeURL(&m) }

// NewMsgTripCircuitBreaker creates a new MsgTripCircuitBreaker instance.
func NewMsgTripCircuitBreaker(authority string, urls []string) *MsgTripCircuitBreaker {
return &MsgTripCircuitBreaker{
Expand All @@ -33,22 +27,10 @@ func NewMsgTripCircuitBreaker(authority string, urls []string) *MsgTripCircuitBr
}
}

// Route Implements Msg.
func (m MsgTripCircuitBreaker) Route() string { return sdk.MsgTypeURL(&m) }

// Type Implements Msg.
func (m MsgTripCircuitBreaker) Type() string { return sdk.MsgTypeURL(&m) }

// NewMsgResetCircuitBreaker creates a new MsgResetCircuitBreaker instance.
func NewMsgResetCircuitBreaker(authority string, urls []string) *MsgResetCircuitBreaker {
return &MsgResetCircuitBreaker{
Authority: authority,
MsgTypeUrls: urls,
}
}

// Route Implements Msg.
func (m MsgResetCircuitBreaker) Route() string { return sdk.MsgTypeURL(&m) }

// Type Implements Msg.
func (m MsgResetCircuitBreaker) Type() string { return sdk.MsgTypeURL(&m) }
13 changes: 0 additions & 13 deletions x/crisis/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,7 @@ func NewMsgVerifyInvariant(sender sdk.AccAddress, invModeName, invRoute string)
}
}

// get the bytes for the message signer to sign on
func (msg MsgVerifyInvariant) GetSigners() []sdk.AccAddress {
sender, _ := sdk.AccAddressFromBech32(msg.Sender)
return []sdk.AccAddress{sender}
}

// FullInvariantRoute - get the messages full invariant route
func (msg MsgVerifyInvariant) FullInvariantRoute() string {
return msg.InvariantModuleName + "/" + msg.InvariantRoute
}

// GetSigners returns the signer addresses that are expected to sign the result
// of GetSignBytes.
func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress {
authority, _ := sdk.AccAddressFromBech32(msg.Authority)
return []sdk.AccAddress{authority}
}
6 changes: 0 additions & 6 deletions x/gov/types/v1beta1/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ func NewMsgSubmitProposal(content Content, initialDeposit sdk.Coins, proposer sd
// GetInitialDeposit returns the initial deposit of MsgSubmitProposal.
func (m *MsgSubmitProposal) GetInitialDeposit() sdk.Coins { return m.InitialDeposit }

// GetProposer returns the proposer address of MsgSubmitProposal.
func (m *MsgSubmitProposal) GetProposer() sdk.AccAddress {
proposer, _ := sdk.AccAddressFromBech32(m.Proposer)
return proposer
}

// GetContent returns the content of MsgSubmitProposal.
func (m *MsgSubmitProposal) GetContent() Content {
content, ok := m.Content.GetCachedValue().(Content)
Expand Down
125 changes: 5 additions & 120 deletions x/group/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package group
import (
"github.com/cosmos/gogoproto/proto"

errorsmod "cosmossdk.io/errors"

"github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
Expand Down Expand Up @@ -34,49 +32,21 @@ var (
_ types.UnpackInterfacesMessage = MsgCreateGroupWithPolicy{}
)

// GetSigners returns the expected signers for a MsgCreateGroup.
func (m MsgCreateGroup) GetSigners() []sdk.AccAddress {
admin := sdk.MustAccAddressFromBech32(m.Admin)

return []sdk.AccAddress{admin}
}

// GetSigners returns the expected signers for a MsgUpdateGroupAdmin.
func (m MsgUpdateGroupAdmin) GetSigners() []sdk.AccAddress {
admin := sdk.MustAccAddressFromBech32(m.Admin)

return []sdk.AccAddress{admin}
}

// GetGroupID gets the group id of the MsgUpdateGroupAdmin.
func (m *MsgUpdateGroupAdmin) GetGroupID() uint64 {
return m.GroupId
}

// GetSigners returns the expected signers for a MsgUpdateGroupMetadata.
func (m MsgUpdateGroupMetadata) GetSigners() []sdk.AccAddress {
admin := sdk.MustAccAddressFromBech32(m.Admin)

return []sdk.AccAddress{admin}
}

// GetGroupID gets the group id of the MsgUpdateGroupMetadata.
func (m *MsgUpdateGroupMetadata) GetGroupID() uint64 {
return m.GroupId
}

// GetSigners returns the expected signers for a MsgUpdateGroupMembers.
func (m MsgUpdateGroupMembers) GetSigners() []sdk.AccAddress {
admin := sdk.MustAccAddressFromBech32(m.Admin)

return []sdk.AccAddress{admin}
}

// GetGroupID gets the group id of the MsgUpdateGroupMembers.
func (m *MsgUpdateGroupMembers) GetGroupID() uint64 {
return m.GroupId
}

// GetGroupID gets the group id of the MsgUpdateGroupAdmin.
func (m *MsgUpdateGroupAdmin) GetGroupID() uint64 {
return m.GroupId
}

// NewMsgCreateGroupWithPolicy creates a new MsgCreateGroupWithPolicy.
func NewMsgCreateGroupWithPolicy(admin string, members []MemberRequest, groupMetadata, groupPolicyMetadata string, groupPolicyAsAdmin bool, decisionPolicy DecisionPolicy) (*MsgCreateGroupWithPolicy, error) {
m := &MsgCreateGroupWithPolicy{
Expand Down Expand Up @@ -118,25 +88,6 @@ func (m MsgCreateGroupWithPolicy) UnpackInterfaces(unpacker types.AnyUnpacker) e
return unpacker.UnpackAny(m.DecisionPolicy, &decisionPolicy)
}

// GetSigners returns the expected signers for a MsgCreateGroupWithPolicy.
func (m MsgCreateGroupWithPolicy) GetSigners() []sdk.AccAddress {
admin := sdk.MustAccAddressFromBech32(m.Admin)
return []sdk.AccAddress{admin}
}

// GetSigners returns the expected signers for a MsgCreateGroupPolicy.
func (m MsgCreateGroupPolicy) GetSigners() []sdk.AccAddress {
admin := sdk.MustAccAddressFromBech32(m.Admin)
return []sdk.AccAddress{admin}
}

// GetSigners returns the expected signers for a MsgUpdateGroupPolicyAdmin.
func (m MsgUpdateGroupPolicyAdmin) GetSigners() []sdk.AccAddress {
admin := sdk.MustAccAddressFromBech32(m.Admin)

return []sdk.AccAddress{admin}
}

// NewMsgUpdateGroupPolicyDecisionPolicy creates a new MsgUpdateGroupPolicyDecisionPolicy.
func NewMsgUpdateGroupPolicyDecisionPolicy(admin, address sdk.AccAddress, decisionPolicy DecisionPolicy) (*MsgUpdateGroupPolicyDecisionPolicy, error) {
m := &MsgUpdateGroupPolicyDecisionPolicy{
Expand Down Expand Up @@ -164,13 +115,6 @@ func (m *MsgUpdateGroupPolicyDecisionPolicy) SetDecisionPolicy(decisionPolicy De
return nil
}

// GetSigners returns the expected signers for a MsgUpdateGroupPolicyDecisionPolicy.
func (m MsgUpdateGroupPolicyDecisionPolicy) GetSigners() []sdk.AccAddress {
admin := sdk.MustAccAddressFromBech32(m.Admin)

return []sdk.AccAddress{admin}
}

// GetDecisionPolicy gets the decision policy of MsgUpdateGroupPolicyDecisionPolicy.
func (m *MsgUpdateGroupPolicyDecisionPolicy) GetDecisionPolicy() (DecisionPolicy, error) {
decisionPolicy, ok := m.DecisionPolicy.GetCachedValue().(DecisionPolicy)
Expand All @@ -187,13 +131,6 @@ func (m MsgUpdateGroupPolicyDecisionPolicy) UnpackInterfaces(unpacker types.AnyU
return unpacker.UnpackAny(m.DecisionPolicy, &decisionPolicy)
}

// GetSigners returns the expected signers for a MsgUpdateGroupPolicyMetadata.
func (m MsgUpdateGroupPolicyMetadata) GetSigners() []sdk.AccAddress {
admin := sdk.MustAccAddressFromBech32(m.Admin)

return []sdk.AccAddress{admin}
}

// NewMsgCreateGroupPolicy creates a new MsgCreateGroupPolicy.
func NewMsgCreateGroupPolicy(admin sdk.AccAddress, group uint64, metadata string, decisionPolicy DecisionPolicy) (*MsgCreateGroupPolicy, error) {
m := &MsgCreateGroupPolicy{
Expand Down Expand Up @@ -265,30 +202,6 @@ func NewMsgSubmitProposal(address string, proposers []string, msgs []sdk.Msg, me
return m, nil
}

// GetSigners returns the expected signers for a MsgSubmitProposal.
func (m MsgSubmitProposal) GetSigners() []sdk.AccAddress {
addrs, err := m.getProposerAccAddresses()
if err != nil {
panic(err)
}

return addrs
}

// getProposerAccAddresses returns the proposers as `[]sdk.AccAddress`.
func (m *MsgSubmitProposal) getProposerAccAddresses() ([]sdk.AccAddress, error) {
addrs := make([]sdk.AccAddress, len(m.Proposers))
for i, proposer := range m.Proposers {
addr, err := sdk.AccAddressFromBech32(proposer)
if err != nil {
return nil, errorsmod.Wrap(err, "proposers")
}
addrs[i] = addr
}

return addrs, nil
}

// SetMsgs packs msgs into Any's
func (m *MsgSubmitProposal) SetMsgs(msgs []sdk.Msg) error {
anys, err := tx.SetMsgs(msgs)
Expand All @@ -308,31 +221,3 @@ func (m MsgSubmitProposal) GetMsgs() ([]sdk.Msg, error) {
func (m MsgSubmitProposal) UnpackInterfaces(unpacker types.AnyUnpacker) error {
return tx.UnpackInterfaces(unpacker, m.Messages)
}

// GetSigners returns the expected signers for a MsgWithdrawProposal.
func (m MsgWithdrawProposal) GetSigners() []sdk.AccAddress {
admin := sdk.MustAccAddressFromBech32(m.Address)

return []sdk.AccAddress{admin}
}

// GetSigners returns the expected signers for a MsgVote.
func (m MsgVote) GetSigners() []sdk.AccAddress {
addr := sdk.MustAccAddressFromBech32(m.Voter)

return []sdk.AccAddress{addr}
}

// GetSigners returns the expected signers for a MsgExec.
func (m MsgExec) GetSigners() []sdk.AccAddress {
signer := sdk.MustAccAddressFromBech32(m.Executor)

return []sdk.AccAddress{signer}
}

// GetSigners returns the expected signers for a MsgLeaveGroup
func (m MsgLeaveGroup) GetSigners() []sdk.AccAddress {
signer := sdk.MustAccAddressFromBech32(m.Address)

return []sdk.AccAddress{signer}
}
12 changes: 0 additions & 12 deletions x/slashing/types/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,3 @@ func NewMsgUnjail(validatorAddr sdk.ValAddress) *MsgUnjail {
ValidatorAddr: validatorAddr.String(),
}
}

// GetSigners returns the expected signers for MsgUnjail.
func (msg MsgUnjail) GetSigners() []sdk.AccAddress {
valAddr, _ := sdk.ValAddressFromBech32(msg.ValidatorAddr)
return []sdk.AccAddress{sdk.AccAddress(valAddr)}
}

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

0 comments on commit 1ae7058

Please sign in to comment.