diff --git a/.pending/bugfixes/sdk/3966-fixed-multiple- b/.pending/bugfixes/sdk/3966-fixed-multiple- new file mode 100644 index 000000000000..8ffae93169d5 --- /dev/null +++ b/.pending/bugfixes/sdk/3966-fixed-multiple- @@ -0,0 +1,2 @@ +#3966 fixed multiple assigns to action tags +#3793 add delegator tag for MsgCreateValidator and deleted unused moniker and identity tags diff --git a/x/slashing/handler.go b/x/slashing/handler.go index 70a28089d0d0..b623ac9b4e9d 100644 --- a/x/slashing/handler.go +++ b/x/slashing/handler.go @@ -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(), ) diff --git a/x/slashing/tags/tags.go b/x/slashing/tags/tags.go index 12c1d616f406..cb92e3cd662f 100644 --- a/x/slashing/tags/tags.go +++ b/x/slashing/tags/tags.go @@ -1,13 +1,6 @@ package tags -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - // Slashing tags var ( - ActionValidatorUnjailed = "validator-unjailed" - - Action = sdk.TagAction Validator = "validator" ) diff --git a/x/staking/alias.go b/x/staking/alias.go index cee0c7b4c475..cbc20d7dca06 100644 --- a/x/staking/alias.go +++ b/x/staking/alias.go @@ -4,7 +4,6 @@ package staking import ( "github.com/cosmos/cosmos-sdk/x/staking/keeper" "github.com/cosmos/cosmos-sdk/x/staking/querier" - "github.com/cosmos/cosmos-sdk/x/staking/tags" "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -172,15 +171,3 @@ var ( ErrMinSelfDelegationDecreased = types.ErrMinSelfDelegationDecreased ErrSelfDelegationBelowMinimum = types.ErrSelfDelegationBelowMinimum ) - -var ( - ActionCompleteUnbonding = tags.ActionCompleteUnbonding - ActionCompleteRedelegation = tags.ActionCompleteRedelegation - - TagAction = tags.Action - TagSrcValidator = tags.SrcValidator - TagDstValidator = tags.DstValidator - TagDelegator = tags.Delegator - TagMoniker = tags.Moniker - TagIdentity = tags.Identity -) diff --git a/x/staking/client/rest/query.go b/x/staking/client/rest/query.go index 63fcc6d24b92..3f1e9bfd2997 100644 --- a/x/staking/client/rest/query.go +++ b/x/staking/client/rest/query.go @@ -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" ) @@ -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 diff --git a/x/staking/handler.go b/x/staking/handler.go index dc60b1bb842e..a3d166b8b41c 100644 --- a/x/staking/handler.go +++ b/x/staking/handler.go @@ -60,7 +60,7 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) ([]abci.ValidatorUpdate, sdk.T } resTags.AppendTags(sdk.NewTags( - tags.Action, ActionCompleteUnbonding, + tags.Action, tags.ActionCompleteUnbonding, tags.Delegator, dvPair.DelegatorAddress.String(), tags.SrcValidator, dvPair.ValidatorAddress.String(), )) @@ -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{ @@ -192,14 +191,12 @@ func handleMsgEditValidator(ctx sdk.Context, msg types.MsgEditValidator, k keepe k.SetValidator(ctx, validator) - tags := sdk.NewTags( + resTags := sdk.NewTags( tags.DstValidator, msg.ValidatorAddress.String(), - tags.Moniker, description.Moniker, - tags.Identity, description.Identity, ) return sdk.Result{ - Tags: tags, + Tags: resTags, } } @@ -218,13 +215,13 @@ func handleMsgDelegate(ctx sdk.Context, msg types.MsgDelegate, k keeper.Keeper) return err.Result() } - tags := sdk.NewTags( + resTags := sdk.NewTags( tags.Delegator, msg.DelegatorAddress.String(), tags.DstValidator, msg.ValidatorAddress.String(), ) return sdk.Result{ - Tags: tags, + Tags: resTags, } } @@ -242,13 +239,13 @@ func handleMsgUndelegate(ctx sdk.Context, msg types.MsgUndelegate, k keeper.Keep } finishTime := types.MsgCdc.MustMarshalBinaryLengthPrefixed(completionTime) - tags := sdk.NewTags( + resTags := sdk.NewTags( tags.Delegator, msg.DelegatorAddress.String(), tags.SrcValidator, msg.ValidatorAddress.String(), tags.EndTime, completionTime.Format(time.RFC3339), ) - return sdk.Result{Data: finishTime, Tags: tags} + return sdk.Result{Data: finishTime, Tags: resTags} } func handleMsgBeginRedelegate(ctx sdk.Context, msg types.MsgBeginRedelegate, k keeper.Keeper) sdk.Result { diff --git a/x/staking/tags/tags.go b/x/staking/tags/tags.go index a99135171efb..55be61848e77 100644 --- a/x/staking/tags/tags.go +++ b/x/staking/tags/tags.go @@ -1,10 +1,10 @@ -// nolint package tags import ( sdk "github.com/cosmos/cosmos-sdk/types" ) +// staking tags var ( ActionCompleteUnbonding = "complete-unbonding" ActionCompleteRedelegation = "complete-redelegation" @@ -13,7 +13,5 @@ var ( SrcValidator = sdk.TagSrcValidator DstValidator = sdk.TagDstValidator Delegator = sdk.TagDelegator - Moniker = "moniker" - Identity = "identity" EndTime = "end-time" )