From 661d201d6b6c144c3b1dd7280338106d11e86edd Mon Sep 17 00:00:00 2001 From: Geoff Lee Date: Mon, 30 Oct 2023 18:26:22 +0900 Subject: [PATCH] remove unncessary comma from value of proposal_messages event (#18300) --- x/gov/keeper/proposal.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index 3002924c24..c4b18557b6 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -5,6 +5,7 @@ import ( "context" "errors" "fmt" + "strings" "time" "cosmossdk.io/collections" @@ -35,13 +36,13 @@ func (keeper Keeper) SubmitProposal(ctx context.Context, messages []sdk.Msg, met 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 += fmt.Sprintf(",%s", sdk.MsgTypeURL(msg)) + msgs = append(msgs, sdk.MsgTypeURL(msg)) // perform a basic validation of the message if m, ok := msg.(sdk.HasValidateBasic); ok { @@ -123,7 +124,7 @@ func (keeper Keeper) SubmitProposal(ctx context.Context, messages []sdk.Msg, met sdk.NewEvent( types.EventTypeSubmitProposal, sdk.NewAttribute(types.AttributeKeyProposalID, fmt.Sprintf("%d", proposalID)), - sdk.NewAttribute(types.AttributeKeyProposalMessages, msgsStr), + sdk.NewAttribute(types.AttributeKeyProposalMessages, strings.Join(msgs, ",")), ), )