-
Notifications
You must be signed in to change notification settings - Fork 4.2k
x/gov: leading comma in proposal_messages event attribute #26045
Description
When a proposal is submitted, the proposal_messages event attribute is built by prepending a comma to each message type URL:
// x/gov/keeper/proposal.go, line 44
msgsStr += fmt.Sprintf(",%s", sdk.MsgTypeURL(msg))For a proposal with two messages, the emitted value looks like ",/cosmos.bank.v1beta1.MsgSend,/cosmos.staking.v1beta1.MsgDelegate" instead of "/cosmos.bank.v1beta1.MsgSend,/cosmos.staking.v1beta1.MsgDelegate".
The leading comma breaks any downstream consumer that parses this attribute by splitting on commas (produces an empty first element).
Suggested fix: replace the loop accumulation with strings.Join over a []string of type URLs, or trim the leading comma with msgsStr[1:] after the loop.
How I found this
Was auditing the gov module's event emission paths and noticed msgsStr is initialized empty on line 39, then unconditionally prepended with a comma on every iteration at line 44.