From 055b37c7b4666d4be69cd62b3efdb785bc8b7596 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Mon, 25 Mar 2024 17:32:38 +0100 Subject: [PATCH] fix conflicts --- CHANGELOG.md | 1 + x/gov/CHANGELOG.md | 76 ---------------------------------------- x/gov/keeper/deposit.go | 12 +------ x/gov/keeper/proposal.go | 12 ------- x/gov/types/events.go | 22 +----------- 5 files changed, 3 insertions(+), 120 deletions(-) delete mode 100644 x/gov/CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 30a4bc971530..703883327cf5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements +* (x/gov) [#19853](https://github.com/cosmos/cosmos-sdk/pull/19853) Emit `depositor` in `EventTypeProposalDeposit`. * (x/gov) [#19844](https://github.com/cosmos/cosmos-sdk/pull/19844) Emit the proposer of governance proposals. ## Bug Fixes diff --git a/x/gov/CHANGELOG.md b/x/gov/CHANGELOG.md deleted file mode 100644 index 4859161e7758..000000000000 --- a/x/gov/CHANGELOG.md +++ /dev/null @@ -1,76 +0,0 @@ - - -# Changelog - -## [Unreleased] - -### Features - -* [#19592](https://github.com/cosmos/cosmos-sdk/pull/19592) Add custom tally function. -* [#19304](https://github.com/cosmos/cosmos-sdk/pull/19304) Add `MsgSudoExec` for allowing executing any message as a sudo. -* [#19101](https://github.com/cosmos/cosmos-sdk/pull/19101) Add message based params configuration. -* [#18532](https://github.com/cosmos/cosmos-sdk/pull/18532) Add SPAM vote to proposals. -* [#18532](https://github.com/cosmos/cosmos-sdk/pull/18532) Add proposal types to proposals. -* [#18620](https://github.com/cosmos/cosmos-sdk/pull/18620) Add optimistic proposals. -* [#18762](https://github.com/cosmos/cosmos-sdk/pull/18762) Add multiple choice proposals. -* [#19853](https://github.com/cosmos/cosmos-sdk/pull/19853) Emit `depositor` in `EventTypeProposalDeposit` and `proposal_type` in `EventTypeSubmitProposal` - -### Improvements - -* [#19741](https://github.com/cosmos/cosmos-sdk/pull/19741) Add `ExpeditedQuorum` parameter specifying a minimum quorum for expedited proposals, that can differ from the regular quorum. -* [#19352](https://github.com/cosmos/cosmos-sdk/pull/19352) `TallyResult` include vote options counts. Those counts replicates the now deprecated (but not removed) yes, no, abstain and veto count fields. -* [#18976](https://github.com/cosmos/cosmos-sdk/pull/18976) Log and send an event when a proposal deposit refund or burn has failed. -* [#18856](https://github.com/cosmos/cosmos-sdk/pull/18856) Add `ProposalCancelMaxPeriod` parameter for modifying how long a proposal can be cancelled after it has been submitted. -* [#19167](https://github.com/cosmos/cosmos-sdk/pull/19167) Add `YesQuorum` parameter specifying a minimum of yes vote in the total proposal voting power for the proposal to pass. -* [#18445](https://github.com/cosmos/cosmos-sdk/pull/18445) Extend gov config. -* [#18532](https://github.com/cosmos/cosmos-sdk/pull/18532) Repurpose `govcliutils.NormalizeProposalType` to work for gov v1 proposal types. - -### State Machine Breaking - -* [#19101](https://github.com/cosmos/cosmos-sdk/pull/19101) Add message based params configuration. -* [#18532](https://github.com/cosmos/cosmos-sdk/pull/18532) Add SPAM vote to proposals. -* [#18532](https://github.com/cosmos/cosmos-sdk/pull/18532) Add proposal types to proposals. -* [#18620](https://github.com/cosmos/cosmos-sdk/pull/18620) Add optimistic proposals. -* [#18762](https://github.com/cosmos/cosmos-sdk/pull/18762) Add multiple choice proposals. -* [#18856](https://github.com/cosmos/cosmos-sdk/pull/18856) Add `ProposalCancelMaxPeriod` parameters. -* [#19167](https://github.com/cosmos/cosmos-sdk/pull/19167) Add `YesQuorum` parameter. - -### Client Breaking Changes - -* [#19101](https://github.com/cosmos/cosmos-sdk/pull/19101) Querying specific params types was deprecated in gov/v1 and has been removed. gov/v1beta1 rest unchanged. - -### API Breaking Changes - -* [#19481](https://github.com/cosmos/cosmos-sdk/pull/19481) Migrate module to use `appmodule.Environment`; `NewKeeper` now takes `appmodule.Environment` instead of a store service and no `baseapp.MessageRouter` anymore. -* [#19481](https://github.com/cosmos/cosmos-sdk/pull/19481) v1beta1 proposal handlers now take a `context.Context` instead of an `sdk.Context`. -* [#19592](https://github.com/cosmos/cosmos-sdk/pull/19592) `types.Config` and `types.DefaultConfig` have been moved to the keeper package in order to support the custom tallying function. -* [#19349](https://github.com/cosmos/cosmos-sdk/pull/19349) Simplify state management in `x/gov`. Note `k.VotingPeriodProposals` and `k.SetProposal` are no longer needed and have been removed. -* [#18532](https://github.com/cosmos/cosmos-sdk/pull/18532) All functions that were taking an expedited bool parameter now take a `ProposalType` parameter instead. -* [#17496](https://github.com/cosmos/cosmos-sdk/pull/17496) in `x/gov/types/v1beta1/vote.go` `NewVote` was removed, constructing the struct is required for this type. -* [#19101](https://github.com/cosmos/cosmos-sdk/pull/19101) Move `QueryProposalVotesParams` and `QueryVoteParams` from the `types/v1` package to `utils` and remove unused `querier.go` file. -* [#19740](https://github.com/cosmos/cosmos-sdk/pull/19740) Verify `InitGenesis` and `ExportGenesis` module code and keeper code do not panic. - -### Deprecated - -* [#18532](https://github.com/cosmos/cosmos-sdk/pull/18532) The field `v1.Proposal.Expedited` is deprecated and will be removed in the next release. diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index 915d6b1b64c5..9229c30432f8 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -164,25 +164,15 @@ func (keeper Keeper) AddDeposit(ctx context.Context, proposalID uint64, deposito return false, err } -<<<<<<< HEAD sdkCtx := sdk.UnwrapSDKContext(ctx) sdkCtx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeProposalDeposit, + sdk.NewAttribute(types.AttributeKeyDepositor, depositorAddr.String()), sdk.NewAttribute(sdk.AttributeKeyAmount, depositAmount.String()), sdk.NewAttribute(types.AttributeKeyProposalID, fmt.Sprintf("%d", proposalID)), ), ) -======= - if err := k.environment.EventService.EventManager(ctx).EmitKV( - types.EventTypeProposalDeposit, - event.NewAttribute(types.AttributeKeyDepositor, depositorAddr.String()), - event.NewAttribute(sdk.AttributeKeyAmount, depositAmount.String()), - event.NewAttribute(types.AttributeKeyProposalID, fmt.Sprintf("%d", proposalID)), - ); err != nil { - return false, err - } ->>>>>>> d1c3547d8 (feat(x/gov): emit depositor in `proposal_deposit` event (#19853)) err = keeper.SetDeposit(ctx, deposit) if err != nil { diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index 5469a7b502a7..a461c369ea05 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -119,7 +119,6 @@ func (keeper Keeper) SubmitProposal(ctx context.Context, messages []sdk.Msg, met return v1.Proposal{}, err } -<<<<<<< HEAD sdkCtx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeSubmitProposal, @@ -128,17 +127,6 @@ func (keeper Keeper) SubmitProposal(ctx context.Context, messages []sdk.Msg, met sdk.NewAttribute(types.AttributeKeyProposalMessages, msgsStr), ), ) -======= - if err := k.environment.EventService.EventManager(ctx).EmitKV( - types.EventTypeSubmitProposal, - event.NewAttribute(types.AttributeKeyProposalType, proposalType.String()), - event.NewAttribute(types.AttributeKeyProposalID, fmt.Sprintf("%d", proposalID)), - event.NewAttribute(types.AttributeKeyProposalProposer, proposer.String()), - event.NewAttribute(types.AttributeKeyProposalMessages, strings.Join(msgs, ",")), - ); err != nil { - return v1.Proposal{}, fmt.Errorf("failed to emit event: %w", err) - } ->>>>>>> d1c3547d8 (feat(x/gov): emit depositor in `proposal_deposit` event (#19853)) return proposal, nil } diff --git a/x/gov/types/events.go b/x/gov/types/events.go index 98e29fa2673e..8f04e47cca17 100644 --- a/x/gov/types/events.go +++ b/x/gov/types/events.go @@ -9,11 +9,11 @@ const ( EventTypeActiveProposal = "active_proposal" EventTypeCancelProposal = "cancel_proposal" -<<<<<<< HEAD AttributeKeyProposalResult = "proposal_result" AttributeKeyVoter = "voter" AttributeKeyOption = "option" AttributeKeyProposalID = "proposal_id" + AttributeKeyDepositor = "depositor" AttributeKeyProposalMessages = "proposal_messages" // Msg type_urls in the proposal AttributeKeyVotingPeriodStart = "voting_period_start" AttributeKeyProposalLog = "proposal_log" // log of proposal execution @@ -24,26 +24,6 @@ const ( AttributeValueProposalFailed = "proposal_failed" // error on proposal handler AttributeValueProposalCanceled = "proposal_canceled" // error on proposal handler AttributeKeyProposalProposer = "proposal_proposer" // account address of the proposer -======= - AttributeKeyProposalResult = "proposal_result" - AttributeKeyVoter = "voter" - AttributeKeyOption = "option" - AttributeKeyProposalID = "proposal_id" - AttributeKeyDepositor = "depositor" - AttributeKeyProposalMessages = "proposal_messages" // Msg type_urls in the proposal - AttributeKeyVotingPeriodStart = "voting_period_start" - AttributeKeyProposalLog = "proposal_log" // log of proposal execution - AttributeKeyProposalDepositError = "proposal_deposit_error" // error on proposal deposit refund/burn - AttributeKeyProposalProposer = "proposal_proposer" // account address of the proposer - - AttributeValueProposalDropped = "proposal_dropped" // didn't meet min deposit - AttributeValueProposalPassed = "proposal_passed" // met vote quorum - AttributeValueProposalRejected = "proposal_rejected" // didn't meet vote quorum - AttributeValueExpeditedProposalRejected = "expedited_proposal_rejected" // didn't meet expedited vote quorum - AttributeValueOptimisticProposalRejected = "optimistic_proposal_rejected" // didn't meet optimistic vote quorum - AttributeValueProposalFailed = "proposal_failed" // error on proposal handler - AttributeValueProposalCanceled = "proposal_canceled" // error on proposal handler ->>>>>>> d1c3547d8 (feat(x/gov): emit depositor in `proposal_deposit` event (#19853)) AttributeKeyProposalType = "proposal_type" AttributeSignalTitle = "signal_title"