Remove redundant action tags in x/gov txs (#3328)

This commit is contained in:
Hendrik Hofstadt 2019-01-21 19:30:04 +01:00 committed by Jack Zampolin
parent f65ae49356
commit d72e52b8f6
4 changed files with 9 additions and 14 deletions

View File

@ -40,6 +40,7 @@ BREAKING CHANGES
* `Delegation` -> `Value` in `MsgCreateValidator` and `MsgDelegate`
* `MsgBeginUnbonding` -> `MsgUndelegate`
* [\#3315] Increase decimal precision to 18
* [\#3328](https://github.com/cosmos/cosmos-sdk/issues/3328) [x/gov] Remove redundant action tag
* Tendermint
* [\#3298](https://github.com/cosmos/cosmos-sdk/issues/3298) Upgrade to Tendermint 0.28.0

View File

@ -33,7 +33,7 @@ func QueryDepositsByTxQuery(
) ([]byte, error) {
tags := []string{
fmt.Sprintf("%s='%s'", tags.Action, tags.ActionProposalDeposit),
fmt.Sprintf("%s='%s'", tags.Action, gov.MsgDeposit{}.Type()),
fmt.Sprintf("%s='%s'", tags.ProposalID, []byte(fmt.Sprintf("%d", params.ProposalID))),
}
@ -78,7 +78,7 @@ func QueryVotesByTxQuery(
) ([]byte, error) {
tags := []string{
fmt.Sprintf("%s='%s'", tags.Action, tags.ActionProposalVote),
fmt.Sprintf("%s='%s'", tags.Action, gov.MsgVote{}.Type()),
fmt.Sprintf("%s='%s'", tags.ProposalID, []byte(fmt.Sprintf("%d", params.ProposalID))),
}
@ -118,7 +118,7 @@ func QueryVoteByTxQuery(
) ([]byte, error) {
tags := []string{
fmt.Sprintf("%s='%s'", tags.Action, tags.ActionProposalVote),
fmt.Sprintf("%s='%s'", tags.Action, gov.MsgVote{}.Type()),
fmt.Sprintf("%s='%s'", tags.ProposalID, []byte(fmt.Sprintf("%d", params.ProposalID))),
fmt.Sprintf("%s='%s'", tags.Voter, []byte(params.Voter.String())),
}
@ -161,7 +161,7 @@ func QueryDepositByTxQuery(
) ([]byte, error) {
tags := []string{
fmt.Sprintf("%s='%s'", tags.Action, tags.ActionProposalDeposit),
fmt.Sprintf("%s='%s'", tags.Action, gov.MsgDeposit{}.Type()),
fmt.Sprintf("%s='%s'", tags.ProposalID, []byte(fmt.Sprintf("%d", params.ProposalID))),
fmt.Sprintf("%s='%s'", tags.Depositor, []byte(params.Depositor.String())),
}
@ -204,7 +204,7 @@ func QueryProposerByTxQuery(
) ([]byte, error) {
tags := []string{
fmt.Sprintf("%s='%s'", tags.Action, tags.ActionProposalSubmitted),
fmt.Sprintf("%s='%s'", tags.Action, gov.MsgSubmitProposal{}.Type()),
fmt.Sprintf("%s='%s'", tags.ProposalID, []byte(fmt.Sprintf("%d", proposalID))),
}

View File

@ -35,7 +35,6 @@ func handleMsgSubmitProposal(ctx sdk.Context, keeper Keeper, msg MsgSubmitPropos
}
resTags := sdk.NewTags(
tags.Action, tags.ActionProposalSubmitted,
tags.Proposer, []byte(msg.Proposer.String()),
tags.ProposalID, proposalIDBytes,
)
@ -58,7 +57,6 @@ func handleMsgDeposit(ctx sdk.Context, keeper Keeper, msg MsgDeposit) sdk.Result
proposalIDBytes := []byte(fmt.Sprintf("%d", msg.ProposalID))
resTags := sdk.NewTags(
tags.Action, tags.ActionProposalDeposit,
tags.Depositor, []byte(msg.Depositor.String()),
tags.ProposalID, proposalIDBytes,
)
@ -80,7 +78,6 @@ func handleMsgVote(ctx sdk.Context, keeper Keeper, msg MsgVote) sdk.Result {
return sdk.Result{
Tags: sdk.NewTags(
tags.Action, tags.ActionProposalVote,
tags.Voter, []byte(msg.Voter.String()),
tags.ProposalID, []byte(fmt.Sprintf("%d", msg.ProposalID)),
),

View File

@ -6,12 +6,9 @@ import (
// Governance tags
var (
ActionProposalDropped = []byte("proposal-dropped")
ActionProposalPassed = []byte("proposal-passed")
ActionProposalRejected = []byte("proposal-rejected")
ActionProposalSubmitted = []byte("proposal-submitted")
ActionProposalVote = []byte("proposal-vote")
ActionProposalDeposit = []byte("proposal-deposit")
ActionProposalDropped = []byte("proposal-dropped")
ActionProposalPassed = []byte("proposal-passed")
ActionProposalRejected = []byte("proposal-rejected")
Action = sdk.TagAction
Proposer = "proposer"