From a7dffbf4845dbeaa131e3f2d2d004385b10dfdbe Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 11 Aug 2023 10:29:16 +0200 Subject: [PATCH] feat(x/gov): Emit VoterAddr (backport #17354) (#17356) Co-authored-by: Devon Bear Co-authored-by: Julien Robert --- CHANGELOG.md | 1 + x/gov/keeper/vote.go | 1 + x/gov/types/events.go | 1 + 3 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b10e12036dbc..672b22f3ea43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements +* (x/gov) [#17354](https://github.com/cosmos/cosmos-sdk/issues/17354) Emit `VoterAddr` in `proposal_vote` event. * (x/group, x/gov) [#17220](https://github.com/cosmos/cosmos-sdk/pull/17220) Add `--skip-metadata` flag in `draft-proposal` to skip metadata prompt. * (x/genutil) [#17296](https://github.com/cosmos/cosmos-sdk/pull/17296) Add `MigrateHandler` to allow reuse migrate genesis related function. * In v0.46, v0.47 this function is additive to the `genesis migrate` command. However in v0.50+, adding custom migrations to the `genesis migrate` command is directly possible. diff --git a/x/gov/keeper/vote.go b/x/gov/keeper/vote.go index 7f43bec1266d..2f24c37d2e93 100644 --- a/x/gov/keeper/vote.go +++ b/x/gov/keeper/vote.go @@ -37,6 +37,7 @@ func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.A ctx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeProposalVote, + sdk.NewAttribute(types.AttributeKeyVoter, voterAddr.String()), sdk.NewAttribute(types.AttributeKeyOption, options.String()), sdk.NewAttribute(types.AttributeKeyProposalID, fmt.Sprintf("%d", proposalID)), ), diff --git a/x/gov/types/events.go b/x/gov/types/events.go index 76927591af8e..709d5b02c70a 100644 --- a/x/gov/types/events.go +++ b/x/gov/types/events.go @@ -9,6 +9,7 @@ const ( EventTypeActiveProposal = "active_proposal" EventTypeSignalProposal = "signal_proposal" + AttributeKeyVoter = "voter" AttributeKeyProposalResult = "proposal_result" AttributeKeyOption = "option" AttributeKeyProposalID = "proposal_id"