Skip to content

fix(x/gov): remove leading comma in proposal_messages event attribute#26353

Merged
aljo242 merged 3 commits intocosmos:mainfrom
isotauon:fix/gov-proposal-messages-leading-comma
May 4, 2026
Merged

fix(x/gov): remove leading comma in proposal_messages event attribute#26353
aljo242 merged 3 commits intocosmos:mainfrom
isotauon:fix/gov-proposal-messages-leading-comma

Conversation

@isotauon
Copy link
Copy Markdown
Contributor

Description

Closes: #26045

The proposal_messages event attribute was being built by prepending a comma to each message type URL inside the loop in x/gov/keeper/proposal.go:

msgsStr += fmt.Sprintf(",%s", sdk.MsgTypeURL(msg))

For a proposal with two messages, this emitted ",/cosmos.bank.v1beta1.MsgSend,/cosmos.staking.v1beta1.MsgDelegate" instead of "/cosmos.bank.v1beta1.MsgSend,/cosmos.staking.v1beta1.MsgDelegate". The leading comma broke downstream consumers that parse the attribute by splitting on commas (the first element comes back empty).

Changes

  • Replace the manual msgsStr accumulator with a []string collected via append, then emit the joined value with strings.Join(msgTypeURLs, ",").
  • Add TestSubmitProposal_EmitsMessagesWithoutLeadingComma regression test that submits a proposal with two messages and asserts the emitted attribute has no leading comma and equals the expected joined value.

I also checked CancelProposal for the same pattern (per the suggestion in the issue thread) — it does not emit a proposal_messages event, so no changes needed there.

A CHANGELOG entry will be added in a follow-up commit once this PR has a number.

The proposal_messages event attribute was being built by prepending a
comma to each message type URL inside the loop, producing values like
",/cosmos.bank.v1beta1.MsgSend,/cosmos.staking.v1beta1.MsgDelegate"
instead of the intended comma-separated list. This broke downstream
consumers that split the attribute on commas.

Replace the manual accumulator with strings.Join over a []string of
type URLs, and add a regression test that asserts the emitted attribute
has no leading comma.

Closes: cosmos#26045
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 27, 2026

PR author is not in the allowed authors list.

@aljo242 aljo242 added the backport/v0.54.x Backport PR's to release/v0.54.x branch label May 4, 2026
@aljo242 aljo242 enabled auto-merge May 4, 2026 17:08
@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.86%. Comparing base (3ca76ce) to head (e604aab).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #26353      +/-   ##
==========================================
- Coverage   64.87%   64.86%   -0.02%     
==========================================
  Files         890      874      -16     
  Lines       58583    57601     -982     
==========================================
- Hits        38008    37361     -647     
+ Misses      20575    20240     -335     
Files with missing lines Coverage Δ
x/gov/keeper/proposal.go 83.09% <100.00%> (ø)

... and 19 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aljo242 aljo242 disabled auto-merge May 4, 2026 17:28
@aljo242 aljo242 merged commit 42f6f00 into cosmos:main May 4, 2026
42 of 43 checks passed
aljo242 added a commit that referenced this pull request May 4, 2026
…6353

fix(x/gov): remove leading comma in proposal_messages event attribute (backport #26353)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/v0.54.x Backport PR's to release/v0.54.x branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

x/gov: leading comma in proposal_messages event attribute

2 participants