From 707392982a455ed8df8780220fa128ae660c8435 Mon Sep 17 00:00:00 2001 From: Vritra4 Date: Mon, 30 Oct 2023 11:53:12 +0900 Subject: [PATCH 1/3] remove unnecessary comma --- x/gov/keeper/proposal.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index 907af584..043e5b8d 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -3,6 +3,7 @@ package keeper import ( goerrors "errors" "fmt" + "strings" "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/client" @@ -36,7 +37,7 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat // Loop through all messages and confirm that each has a handler and the gov module account // as the only signer for _, msg := range messages { - msgsStr += fmt.Sprintf(",%s", sdk.MsgTypeURL(msg)) + strings.Join([]string{msgsStr, sdk.MsgTypeURL(msg)}, ",") // perform a basic validation of the message if err := msg.ValidateBasic(); err != nil { From 5956dea0d03e4320912f449bc589a6d5315327e6 Mon Sep 17 00:00:00 2001 From: Vritra4 Date: Mon, 30 Oct 2023 11:57:35 +0900 Subject: [PATCH 2/3] fix lol --- x/gov/keeper/proposal.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index 043e5b8d..8ae20781 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -37,7 +37,7 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat // Loop through all messages and confirm that each has a handler and the gov module account // as the only signer for _, msg := range messages { - strings.Join([]string{msgsStr, sdk.MsgTypeURL(msg)}, ",") + msgsStr = strings.Join([]string{msgsStr, sdk.MsgTypeURL(msg)}, ",") // perform a basic validation of the message if err := msg.ValidateBasic(); err != nil { From a2f5022b5fe234fe31534bbd9af8079a1a2a4703 Mon Sep 17 00:00:00 2001 From: Vritra4 Date: Mon, 30 Oct 2023 12:07:44 +0900 Subject: [PATCH 3/3] prev commit can't get rid of unncessary comma --- x/gov/keeper/proposal.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index 8ae20781..d5abbcb2 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -31,13 +31,13 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat return v1.Proposal{}, err } - // Will hold a comma-separated string of all Msg type URLs. - msgsStr := "" + // Will hold a string slice of all Msg type URLs. + msgs := []string{} // Loop through all messages and confirm that each has a handler and the gov module account // as the only signer for _, msg := range messages { - msgsStr = strings.Join([]string{msgsStr, sdk.MsgTypeURL(msg)}, ",") + msgs = append(msgs, sdk.MsgTypeURL(msg)) // perform a basic validation of the message if err := msg.ValidateBasic(); err != nil { @@ -100,7 +100,7 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat sdk.NewEvent( types.EventTypeSubmitProposal, sdk.NewAttribute(types.AttributeKeyProposalID, fmt.Sprintf("%d", proposalID)), - sdk.NewAttribute(types.AttributeKeyProposalMessages, msgsStr), + sdk.NewAttribute(types.AttributeKeyProposalMessages, strings.Join(msgs, ",")), ), )