Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix and cleanup action tags #4045

Merged
merged 8 commits into from
Apr 8, 2019
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .pending/bugfixes/sdk/3966-fixed-multiple-
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#3966 fixed multiple assigns to action tags
#3793 add delegator tag for MsgCreateValidator and deleted unused moniker and identity tags
1 change: 0 additions & 1 deletion x/slashing/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ func handleMsgUnjail(ctx sdk.Context, msg MsgUnjail, k Keeper) sdk.Result {
k.validatorSet.Unjail(ctx, consAddr)

tags := sdk.NewTags(
tags.Action, tags.ActionValidatorUnjailed,
tags.Validator, msg.ValidatorAddr.String(),
)

Expand Down
2 changes: 0 additions & 2 deletions x/slashing/tags/tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (

// Slashing tags
var (
ActionValidatorUnjailed = "validator-unjailed"

Action = sdk.TagAction
Validator = "validator"
)
2 changes: 0 additions & 2 deletions x/staking/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,4 @@ var (
TagSrcValidator = tags.SrcValidator
TagDstValidator = tags.DstValidator
TagDelegator = tags.Delegator
TagMoniker = tags.Moniker
TagIdentity = tags.Identity
)
5 changes: 0 additions & 5 deletions x/staking/client/rest/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/rest"
"github.com/cosmos/cosmos-sdk/x/staking"
"github.com/cosmos/cosmos-sdk/x/staking/tags"

"github.com/gorilla/mux"
)
Expand Down Expand Up @@ -143,16 +142,12 @@ func delegatorTxsHandlerFn(cliCtx context.CLIContext, cdc *codec.Codec) http.Han
actions = append(actions, staking.MsgDelegate{}.Type())
case isUnbondTx:
actions = append(actions, staking.MsgUndelegate{}.Type())
actions = append(actions, tags.ActionCompleteUnbonding)
case isRedTx:
actions = append(actions, staking.MsgBeginRedelegate{}.Type())
actions = append(actions, tags.ActionCompleteRedelegation)
case noQuery:
actions = append(actions, staking.MsgDelegate{}.Type())
actions = append(actions, staking.MsgUndelegate{}.Type())
actions = append(actions, tags.ActionCompleteUnbonding)
actions = append(actions, staking.MsgBeginRedelegate{}.Type())
actions = append(actions, tags.ActionCompleteRedelegation)
default:
w.WriteHeader(http.StatusNoContent)
return
Expand Down
5 changes: 1 addition & 4 deletions x/staking/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ func handleMsgCreateValidator(ctx sdk.Context, msg types.MsgCreateValidator, k k

tags := sdk.NewTags(
tags.DstValidator, msg.ValidatorAddress.String(),
tags.Moniker, msg.Description.Moniker,
tags.Identity, msg.Description.Identity,
tags.Delegator, msg.DelegatorAddress.String(),
)

return sdk.Result{
Expand Down Expand Up @@ -194,8 +193,6 @@ func handleMsgEditValidator(ctx sdk.Context, msg types.MsgEditValidator, k keepe

tags := sdk.NewTags(
tags.DstValidator, msg.ValidatorAddress.String(),
tags.Moniker, description.Moniker,
tags.Identity, description.Identity,
)

return sdk.Result{
Expand Down
4 changes: 1 addition & 3 deletions x/staking/tags/tags.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// nolint
package tags

import (
sdk "github.com/cosmos/cosmos-sdk/types"
)

// staking tags
var (
ActionCompleteUnbonding = "complete-unbonding"
ActionCompleteRedelegation = "complete-redelegation"
Expand All @@ -13,7 +13,5 @@ var (
SrcValidator = sdk.TagSrcValidator
DstValidator = sdk.TagDstValidator
Delegator = sdk.TagDelegator
Moniker = "moniker"
Identity = "identity"
EndTime = "end-time"
)