From 020cbd123728516de9aed2c9bee6a42c1149c1e9 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 17 Dec 2018 16:27:49 -0500 Subject: [PATCH 01/13] Remove dup tags from x/gov EndBlocker --- x/gov/handler.go | 16 +++++++--------- x/gov/tags/tags.go | 1 + 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/x/gov/handler.go b/x/gov/handler.go index 4c2d298ff37c..0b5ed6212310 100644 --- a/x/gov/handler.go +++ b/x/gov/handler.go @@ -88,9 +88,9 @@ func handleMsgVote(ctx sdk.Context, keeper Keeper, msg MsgVote) sdk.Result { } // Called every block, process inflation, update validator set -func EndBlocker(ctx sdk.Context, keeper Keeper) (resTags sdk.Tags) { +func EndBlocker(ctx sdk.Context, keeper Keeper) sdk.Tags { logger := ctx.Logger().With("module", "x/gov") - resTags = sdk.NewTags() + resTags := sdk.NewTags() inactiveIterator := keeper.InactiveProposalQueueIterator(ctx, ctx.BlockHeader().Time) for ; inactiveIterator.Valid(); inactiveIterator.Next() { @@ -101,8 +101,7 @@ func EndBlocker(ctx sdk.Context, keeper Keeper) (resTags sdk.Tags) { keeper.DeleteProposal(ctx, proposalID) keeper.DeleteDeposits(ctx, proposalID) // delete any associated deposits (burned) - resTags = resTags.AppendTag(tags.Action, tags.ActionProposalDropped) - resTags = resTags.AppendTag(tags.ProposalID, []byte(string(proposalID))) + resTags = resTags.AppendTag(tags.ProposalResult, tags.ActionProposalDropped) logger.Info( fmt.Sprintf("proposal %d (%s) didn't meet minimum deposit of %s (had only %s); deleted", @@ -124,15 +123,15 @@ func EndBlocker(ctx sdk.Context, keeper Keeper) (resTags sdk.Tags) { activeProposal := keeper.GetProposal(ctx, proposalID) passes, tallyResults := tally(ctx, keeper, activeProposal) - var action []byte + var tagValue []byte if passes { keeper.RefundDeposits(ctx, activeProposal.GetProposalID()) activeProposal.SetStatus(StatusPassed) - action = tags.ActionProposalPassed + tagValue = tags.ActionProposalPassed } else { keeper.DeleteDeposits(ctx, activeProposal.GetProposalID()) activeProposal.SetStatus(StatusRejected) - action = tags.ActionProposalRejected + tagValue = tags.ActionProposalRejected } activeProposal.SetTallyResult(tallyResults) @@ -142,8 +141,7 @@ func EndBlocker(ctx sdk.Context, keeper Keeper) (resTags sdk.Tags) { logger.Info(fmt.Sprintf("proposal %d (%s) tallied; passed: %v", activeProposal.GetProposalID(), activeProposal.GetTitle(), passes)) - resTags = resTags.AppendTag(tags.Action, action) - resTags = resTags.AppendTag(tags.ProposalID, []byte(string(proposalID))) + resTags = resTags.AppendTag(tags.ProposalResult, tagValue) } activeIterator.Close() diff --git a/x/gov/tags/tags.go b/x/gov/tags/tags.go index 33986f9720d3..ac6c80bc89b8 100644 --- a/x/gov/tags/tags.go +++ b/x/gov/tags/tags.go @@ -19,4 +19,5 @@ var ( VotingPeriodStart = "voting-period-start" Depositor = "depositor" Voter = "voter" + ProposalResult = "proposal-result" ) From ba70cc449df853a8ae44221d09df58a0228ef207 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 17 Dec 2018 16:37:32 -0500 Subject: [PATCH 02/13] Remove dup tag from x/slashing BeginBlocker --- x/slashing/tick.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/x/slashing/tick.go b/x/slashing/tick.go index 41af4b9aec22..966564e00f1d 100644 --- a/x/slashing/tick.go +++ b/x/slashing/tick.go @@ -1,7 +1,6 @@ package slashing import ( - "encoding/binary" "fmt" abci "github.com/tendermint/tendermint/abci/types" @@ -11,12 +10,8 @@ import ( ) // slashing begin block functionality -func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, sk Keeper) (tags sdk.Tags) { - - // Tag the height - heightBytes := make([]byte, 8) - binary.LittleEndian.PutUint64(heightBytes, uint64(req.Header.Height)) - tags = sdk.NewTags("height", heightBytes) +func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, sk Keeper) sdk.Tags { + tags := sdk.NewTags("slashing-height", []byte(fmt.Sprintf("%d", req.Header.Height))) // Iterate over all the validators which *should* have signed this block // store whether or not they have actually signed it and slash/unbond any @@ -37,5 +32,5 @@ func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, sk Keeper) (tags } } - return + return tags } From 3b78313377a390a31d0dc46e33b4ab27a8dbc493 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 18 Dec 2018 16:26:44 -0500 Subject: [PATCH 03/13] Create tags sub package in slashing module and use new height tag --- x/slashing/tags/tags.go | 11 +++++++++++ x/slashing/tick.go | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 x/slashing/tags/tags.go diff --git a/x/slashing/tags/tags.go b/x/slashing/tags/tags.go new file mode 100644 index 000000000000..455bf3bba6c0 --- /dev/null +++ b/x/slashing/tags/tags.go @@ -0,0 +1,11 @@ +package tags + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// Slashing tags +var ( + Action = sdk.TagAction + SlashingHeight = "slashing-height" +) diff --git a/x/slashing/tick.go b/x/slashing/tick.go index 966564e00f1d..0202036ac101 100644 --- a/x/slashing/tick.go +++ b/x/slashing/tick.go @@ -7,11 +7,12 @@ import ( tmtypes "github.com/tendermint/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/slashing/tags" ) // slashing begin block functionality func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, sk Keeper) sdk.Tags { - tags := sdk.NewTags("slashing-height", []byte(fmt.Sprintf("%d", req.Header.Height))) + tags := sdk.NewTags(tags.SlashingHeight, []byte(fmt.Sprintf("%d", req.Header.Height))) // Iterate over all the validators which *should* have signed this block // store whether or not they have actually signed it and slash/unbond any From 39b8d6677425531e8b822c4e4591c82c0cbb5696 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 18 Dec 2018 17:06:32 -0500 Subject: [PATCH 04/13] Actually de-dep governance tags + add tags docs for gov module --- docs/spec/governance/tags.md | 38 ++++++++++++++++++++++++++++++++++++ x/gov/handler.go | 19 ++++++++++++++---- 2 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 docs/spec/governance/tags.md diff --git a/docs/spec/governance/tags.md b/docs/spec/governance/tags.md new file mode 100644 index 000000000000..01acc976e7b9 --- /dev/null +++ b/docs/spec/governance/tags.md @@ -0,0 +1,38 @@ +# Tags + +The governance module emits the following events/tags: + +## BeginBlocker + +| Key | Value | +|------------------------------|----------------------------------------------------| +| proposal-result-{proposalID} | proposal-passed|proposal-rejected|proposal-dropped | + +## Handlers + +### MsgSubmitProposal + +| Key | Value | +|-------------------------|--------------------------| +| action | proposal-vote | +| proposer | {proposerAccountAddress} | +| proposal-id | {proposalID} | +| voting-period-start [0] | {proposalID} | + +* [0] Tag only emitted if the voting period starts during the submission. + +### MsgVote + +| Key | Value | +|-------------|-----------------------| +| action | proposal-vote | +| voter | {voterAccountAddress} | +| proposal-id | {proposalID} | + +### MsgDeposit + +| Key | Value | +|-------------|---------------------------| +| action | proposal-vote | +| depositor | {depositorAccountAddress} | +| proposal-id | {proposalID} | diff --git a/x/gov/handler.go b/x/gov/handler.go index 0b5ed6212310..1b9c83327f75 100644 --- a/x/gov/handler.go +++ b/x/gov/handler.go @@ -98,10 +98,14 @@ func EndBlocker(ctx sdk.Context, keeper Keeper) sdk.Tags { keeper.cdc.MustUnmarshalBinaryLengthPrefixed(inactiveIterator.Value(), &proposalID) inactiveProposal := keeper.GetProposal(ctx, proposalID) + keeper.DeleteProposal(ctx, proposalID) keeper.DeleteDeposits(ctx, proposalID) // delete any associated deposits (burned) - resTags = resTags.AppendTag(tags.ProposalResult, tags.ActionProposalDropped) + resTags = resTags.AppendTag( + fmt.Sprintf("%s-%d", tags.ProposalResult, proposalID), + tags.ActionProposalDropped, + ) logger.Info( fmt.Sprintf("proposal %d (%s) didn't meet minimum deposit of %s (had only %s); deleted", @@ -138,10 +142,17 @@ func EndBlocker(ctx sdk.Context, keeper Keeper) sdk.Tags { keeper.SetProposal(ctx, activeProposal) keeper.RemoveFromActiveProposalQueue(ctx, activeProposal.GetVotingEndTime(), activeProposal.GetProposalID()) - logger.Info(fmt.Sprintf("proposal %d (%s) tallied; passed: %v", - activeProposal.GetProposalID(), activeProposal.GetTitle(), passes)) + logger.Info( + fmt.Sprintf( + "proposal %d (%s) tallied; passed: %v", + activeProposal.GetProposalID(), activeProposal.GetTitle(), passes, + ), + ) - resTags = resTags.AppendTag(tags.ProposalResult, tagValue) + resTags = resTags.AppendTag( + fmt.Sprintf("%s-%d", tags.ProposalResult, proposalID), + tagValue, + ) } activeIterator.Close() From 51918dc2bb072cab2754dbcdcb1e7e6b41530c98 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Wed, 19 Dec 2018 09:46:47 -0500 Subject: [PATCH 05/13] Update slashing tags and add docs --- docs/spec/slashing/tags.md | 12 ++++++++++++ x/slashing/handler.go | 6 +++++- x/slashing/tags/tags.go | 6 ++++-- x/slashing/tick.go | 5 +---- 4 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 docs/spec/slashing/tags.md diff --git a/docs/spec/slashing/tags.md b/docs/spec/slashing/tags.md new file mode 100644 index 000000000000..d98958dba330 --- /dev/null +++ b/docs/spec/slashing/tags.md @@ -0,0 +1,12 @@ +# Tags + +The slashing module emits the following events/tags: + +## Handlers + +### MsgUnjail + +| Key | Value | +|------------------------|----------------------------| +| action | validator-unjailed | +| validator | {validatorOperatorAddress} | diff --git a/x/slashing/handler.go b/x/slashing/handler.go index a4a1aeb3099f..e55dfa0a82c8 100644 --- a/x/slashing/handler.go +++ b/x/slashing/handler.go @@ -2,6 +2,7 @@ package slashing import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/slashing/tags" ) func NewHandler(k Keeper) sdk.Handler { @@ -49,7 +50,10 @@ func handleMsgUnjail(ctx sdk.Context, msg MsgUnjail, k Keeper) sdk.Result { // unjail the validator k.validatorSet.Unjail(ctx, consAddr) - tags := sdk.NewTags("validator", []byte(msg.ValidatorAddr.String())) + tags := sdk.NewTags( + tags.Action, tags.ActionValidatorUnjailed, + tags.Validator, []byte(msg.ValidatorAddr.String()), + ) return sdk.Result{ Tags: tags, diff --git a/x/slashing/tags/tags.go b/x/slashing/tags/tags.go index 455bf3bba6c0..9ab5a48bd260 100644 --- a/x/slashing/tags/tags.go +++ b/x/slashing/tags/tags.go @@ -6,6 +6,8 @@ import ( // Slashing tags var ( - Action = sdk.TagAction - SlashingHeight = "slashing-height" + ActionValidatorUnjailed = []byte("validator-unjailed") + + Action = sdk.TagAction + Validator = "validator" ) diff --git a/x/slashing/tick.go b/x/slashing/tick.go index 0202036ac101..92482ce51a95 100644 --- a/x/slashing/tick.go +++ b/x/slashing/tick.go @@ -7,13 +7,10 @@ import ( tmtypes "github.com/tendermint/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/slashing/tags" ) // slashing begin block functionality func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, sk Keeper) sdk.Tags { - tags := sdk.NewTags(tags.SlashingHeight, []byte(fmt.Sprintf("%d", req.Header.Height))) - // Iterate over all the validators which *should* have signed this block // store whether or not they have actually signed it and slash/unbond any // which have missed too many blocks in a row (downtime slashing) @@ -33,5 +30,5 @@ func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, sk Keeper) sdk.Ta } } - return tags + return sdk.Tags{} } From 6f5f648fcee8ea021c058418831945db07695da6 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Wed, 19 Dec 2018 10:05:18 -0500 Subject: [PATCH 06/13] Update x/gov tags and docs --- docs/spec/governance/tags.md | 6 +++--- x/gov/handler.go | 10 ++-------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/docs/spec/governance/tags.md b/docs/spec/governance/tags.md index 01acc976e7b9..64cf233c7fd0 100644 --- a/docs/spec/governance/tags.md +++ b/docs/spec/governance/tags.md @@ -4,9 +4,9 @@ The governance module emits the following events/tags: ## BeginBlocker -| Key | Value | -|------------------------------|----------------------------------------------------| -| proposal-result-{proposalID} | proposal-passed|proposal-rejected|proposal-dropped | +| Key | Value | +|-----------------|----------------------------------------------------| +| proposal-result | proposal-passed|proposal-rejected|proposal-dropped | ## Handlers diff --git a/x/gov/handler.go b/x/gov/handler.go index 1b9c83327f75..fbde6a62220c 100644 --- a/x/gov/handler.go +++ b/x/gov/handler.go @@ -102,10 +102,7 @@ func EndBlocker(ctx sdk.Context, keeper Keeper) sdk.Tags { keeper.DeleteProposal(ctx, proposalID) keeper.DeleteDeposits(ctx, proposalID) // delete any associated deposits (burned) - resTags = resTags.AppendTag( - fmt.Sprintf("%s-%d", tags.ProposalResult, proposalID), - tags.ActionProposalDropped, - ) + resTags = resTags.AppendTag(tags.ProposalResult, tags.ActionProposalDropped) logger.Info( fmt.Sprintf("proposal %d (%s) didn't meet minimum deposit of %s (had only %s); deleted", @@ -149,10 +146,7 @@ func EndBlocker(ctx sdk.Context, keeper Keeper) sdk.Tags { ), ) - resTags = resTags.AppendTag( - fmt.Sprintf("%s-%d", tags.ProposalResult, proposalID), - tagValue, - ) + resTags = resTags.AppendTag(tags.ProposalResult, tagValue) } activeIterator.Close() From 241fef925bc3502cd75dd40a0dbba18af3277da0 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Wed, 19 Dec 2018 10:57:05 -0500 Subject: [PATCH 07/13] Update staking tags and implement tags doc --- docs/spec/governance/tags.md | 8 ++--- docs/spec/staking/tags.md | 58 ++++++++++++++++++++++++++++++++++++ x/stake/handler.go | 28 ++++++++++------- 3 files changed, 79 insertions(+), 15 deletions(-) create mode 100644 docs/spec/staking/tags.md diff --git a/docs/spec/governance/tags.md b/docs/spec/governance/tags.md index 64cf233c7fd0..6c97a2b49db4 100644 --- a/docs/spec/governance/tags.md +++ b/docs/spec/governance/tags.md @@ -2,11 +2,11 @@ The governance module emits the following events/tags: -## BeginBlocker +## EndBlocker -| Key | Value | -|-----------------|----------------------------------------------------| -| proposal-result | proposal-passed|proposal-rejected|proposal-dropped | +| Key | Value | +|-----------------|------------------------------------------------------| +| proposal-result | proposal-passed\|proposal-rejected\|proposal-dropped | ## Handlers diff --git a/docs/spec/staking/tags.md b/docs/spec/staking/tags.md new file mode 100644 index 000000000000..05c98a9caf10 --- /dev/null +++ b/docs/spec/staking/tags.md @@ -0,0 +1,58 @@ +# Tags + +The staking module emits the following events/tags: + +## EndBlocker + +| Key | Value | +|-----------------------|-------------------------------------------| +| action | complete-unbonding\|complete-redelegation | +| delegator | {delegatorAccountAddress} | +| source-validator | {srcOperatorAddress} | +| destination-validator | {dstOperatorAddress} | + +## Handlers + +### MsgCreateValidator + +| Key | Value | +|-----------------------|----------------------| +| destination-validator | {dstOperatorAddress} | +| moniker | {validatorMoniker} | +| identity | {validatorIdentity} | + +### MsgEditValidator + +| Key | Value | +|-----------------------|----------------------| +| destination-validator | {dstOperatorAddress} | +| moniker | {validatorMoniker} | +| identity | {validatorIdentity} | + +### MsgDelegate + +| Key | Value | +|-----------------------|-------------------------------------------| +| delegator | {delegatorAccountAddress} | +| destination-validator | {dstOperatorAddress} | + +### MsgBeginRedelegate + +| Key | Value | +|-----------------------|-------------------------------------------| +| delegator | {delegatorAccountAddress} | +| source-validator | {srcOperatorAddress} | +| destination-validator | {dstOperatorAddress} | +| end-time [0] | {delegationFinishTime} | + +* [0] Time is formatted in the RFC3339 standard + +### MsgBeginUnbonding + +| Key | Value | +|------------------|---------------------------| +| delegator | {delegatorAccountAddress} | +| source-validator | {srcOperatorAddress} | +| end-time [0] | {delegationFinishTime} | + +* [0] Time is formatted in the RFC3339 standard diff --git a/x/stake/handler.go b/x/stake/handler.go index f8792da786b5..408ca52a338e 100644 --- a/x/stake/handler.go +++ b/x/stake/handler.go @@ -2,6 +2,7 @@ package stake import ( "bytes" + "time" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/common" @@ -34,7 +35,9 @@ func NewHandler(k keeper.Keeper) sdk.Handler { } // Called every block, update validator set -func EndBlocker(ctx sdk.Context, k keeper.Keeper) (validatorUpdates []abci.ValidatorUpdate, endBlockerTags sdk.Tags) { +func EndBlocker(ctx sdk.Context, k keeper.Keeper) ([]abci.ValidatorUpdate, sdk.Tags) { + resTags := sdk.NewTags() + // Calculate validator set changes. // // NOTE: ApplyAndReturnValidatorSetUpdates has to come before @@ -44,7 +47,7 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) (validatorUpdates []abci.Valid // unbonded after the Endblocker (go from Bonded -> Unbonding during // ApplyAndReturnValidatorSetUpdates and then Unbonding -> Unbonded during // UnbondAllMatureValidatorQueue). - validatorUpdates = k.ApplyAndReturnValidatorSetUpdates(ctx) + validatorUpdates := k.ApplyAndReturnValidatorSetUpdates(ctx) // Unbond all mature validators from the unbonding queue. k.UnbondAllMatureValidatorQueue(ctx) @@ -56,7 +59,8 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) (validatorUpdates []abci.Valid if err != nil { continue } - endBlockerTags.AppendTags(sdk.NewTags( + + resTags.AppendTags(sdk.NewTags( tags.Action, ActionCompleteUnbonding, tags.Delegator, []byte(dvPair.DelegatorAddr.String()), tags.SrcValidator, []byte(dvPair.ValidatorAddr.String()), @@ -70,14 +74,16 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) (validatorUpdates []abci.Valid if err != nil { continue } - endBlockerTags.AppendTags(sdk.NewTags( + + resTags.AppendTags(sdk.NewTags( tags.Action, tags.ActionCompleteRedelegation, tags.Delegator, []byte(dvvTriplet.DelegatorAddr.String()), tags.SrcValidator, []byte(dvvTriplet.ValidatorSrcAddr.String()), tags.DstValidator, []byte(dvvTriplet.ValidatorDstAddr.String()), )) } - return + + return validatorUpdates, resTags } //_____________________________________________________________________ @@ -215,12 +221,12 @@ func handleMsgBeginUnbonding(ctx sdk.Context, msg types.MsgBeginUnbonding, k kee } finishTime := types.MsgCdc.MustMarshalBinaryLengthPrefixed(ubd.MinTime) - tags := sdk.NewTags( tags.Delegator, []byte(msg.DelegatorAddr.String()), tags.SrcValidator, []byte(msg.ValidatorAddr.String()), - tags.EndTime, finishTime, + tags.EndTime, []byte(ubd.MinTime.Format(time.RFC3339)), ) + return sdk.Result{Data: finishTime, Tags: tags} } @@ -232,12 +238,12 @@ func handleMsgBeginRedelegate(ctx sdk.Context, msg types.MsgBeginRedelegate, k k } finishTime := types.MsgCdc.MustMarshalBinaryLengthPrefixed(red.MinTime) - - tags := sdk.NewTags( + resTags := sdk.NewTags( tags.Delegator, []byte(msg.DelegatorAddr.String()), tags.SrcValidator, []byte(msg.ValidatorSrcAddr.String()), tags.DstValidator, []byte(msg.ValidatorDstAddr.String()), - tags.EndTime, finishTime, + tags.EndTime, []byte(red.MinTime.Format(time.RFC3339)), ) - return sdk.Result{Data: finishTime, Tags: tags} + + return sdk.Result{Data: finishTime, Tags: resTags} } From d7df05594d7f309b3d0f86432c9d9cc16c0f3777 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Wed, 19 Dec 2018 11:16:29 -0500 Subject: [PATCH 08/13] Add delegation module tags doc --- docs/spec/distribution/tags.md | 30 ++++++++++++++++++++++++++++++ x/distribution/handler.go | 4 ---- 2 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 docs/spec/distribution/tags.md diff --git a/docs/spec/distribution/tags.md b/docs/spec/distribution/tags.md new file mode 100644 index 000000000000..c526ae0c27b3 --- /dev/null +++ b/docs/spec/distribution/tags.md @@ -0,0 +1,30 @@ +# Tags + +The distribution module emits the following events/tags: + +## Handlers + +### MsgSetWithdrawAddress + +| Key | Value | +|-----------|---------------------------| +| delegator | {delegatorAccountAddress} | + +### MsgWithdrawDelegatorRewardsAll + +| Key | Value | +|-----------|---------------------------| +| delegator | {delegatorAccountAddress} | + +### MsgWithdrawDelegatorReward + +| Key | Value | +|------------------|---------------------------| +| delegator | {delegatorAccountAddress} | +| source-validator | {srcOperatorAddress} | + +### MsgWithdrawValidatorRewardsAll + +| Key | Value | +|------------------|----------------------| +| source-validator | {srcOperatorAddress} | diff --git a/x/distribution/handler.go b/x/distribution/handler.go index c1268944ccf0..acd93d26a7a1 100644 --- a/x/distribution/handler.go +++ b/x/distribution/handler.go @@ -31,7 +31,6 @@ func NewHandler(k keeper.Keeper) sdk.Handler { // now we just perform action and save func handleMsgModifyWithdrawAddress(ctx sdk.Context, msg types.MsgSetWithdrawAddress, k keeper.Keeper) sdk.Result { - k.SetDelegatorWithdrawAddr(ctx, msg.DelegatorAddr, msg.WithdrawAddr) tags := sdk.NewTags( @@ -43,7 +42,6 @@ func handleMsgModifyWithdrawAddress(ctx sdk.Context, msg types.MsgSetWithdrawAdd } func handleMsgWithdrawDelegatorRewardsAll(ctx sdk.Context, msg types.MsgWithdrawDelegatorRewardsAll, k keeper.Keeper) sdk.Result { - k.WithdrawDelegationRewardsAll(ctx, msg.DelegatorAddr) tags := sdk.NewTags( @@ -55,7 +53,6 @@ func handleMsgWithdrawDelegatorRewardsAll(ctx sdk.Context, msg types.MsgWithdraw } func handleMsgWithdrawDelegatorReward(ctx sdk.Context, msg types.MsgWithdrawDelegatorReward, k keeper.Keeper) sdk.Result { - err := k.WithdrawDelegationReward(ctx, msg.DelegatorAddr, msg.ValidatorAddr) if err != nil { return err.Result() @@ -71,7 +68,6 @@ func handleMsgWithdrawDelegatorReward(ctx sdk.Context, msg types.MsgWithdrawDele } func handleMsgWithdrawValidatorRewardsAll(ctx sdk.Context, msg types.MsgWithdrawValidatorRewardsAll, k keeper.Keeper) sdk.Result { - err := k.WithdrawValidatorRewardsAll(ctx, msg.ValidatorAddr) if err != nil { return err.Result() From 2bf8bf95f45434e14f07857d72e6775cdbf52fb5 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Wed, 19 Dec 2018 11:25:32 -0500 Subject: [PATCH 09/13] Add banking module tags doc --- docs/spec/bank/tags.md | 12 ++++++++++++ x/bank/handler.go | 1 - x/slashing/tick.go | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 docs/spec/bank/tags.md diff --git a/docs/spec/bank/tags.md b/docs/spec/bank/tags.md new file mode 100644 index 000000000000..103c598390dc --- /dev/null +++ b/docs/spec/bank/tags.md @@ -0,0 +1,12 @@ +# Tags + +The bank module emits the following events/tags: + +## Handlers + +### MsgSend + +| Key | Value | +|-----------|---------------------------| +| sender | {senderAccountAddress} | +| recipient | {recipientAccountAddress} | diff --git a/x/bank/handler.go b/x/bank/handler.go index ea3ee4398c43..9b4095700050 100644 --- a/x/bank/handler.go +++ b/x/bank/handler.go @@ -20,7 +20,6 @@ func NewHandler(k Keeper) sdk.Handler { // Handle MsgSend. func handleMsgSend(ctx sdk.Context, k Keeper, msg MsgSend) sdk.Result { // NOTE: totalIn == totalOut should already have been checked - tags, err := k.InputOutputCoins(ctx, msg.Inputs, msg.Outputs) if err != nil { return err.Result() diff --git a/x/slashing/tick.go b/x/slashing/tick.go index 92482ce51a95..15fb9cd18f57 100644 --- a/x/slashing/tick.go +++ b/x/slashing/tick.go @@ -30,5 +30,5 @@ func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, sk Keeper) sdk.Ta } } - return sdk.Tags{} + return sdk.EmptyTags() } From 8110d5f4774baac7dd8f175191fabfa8f0df28a1 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Wed, 19 Dec 2018 11:31:12 -0500 Subject: [PATCH 10/13] Minor cleanup --- cmd/gaia/app/app.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/cmd/gaia/app/app.go b/cmd/gaia/app/app.go index 4930f44ef5d0..c5b1cef11234 100644 --- a/cmd/gaia/app/app.go +++ b/cmd/gaia/app/app.go @@ -193,7 +193,6 @@ func MakeCodec() *codec.Codec { // application updates every end block func (app *GaiaApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { - // mint new tokens for the previous block mint.BeginBlocker(ctx, app.mintKeeper) @@ -215,7 +214,6 @@ func (app *GaiaApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) ab // application updates every end block // nolint: unparam func (app *GaiaApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { - tags := gov.EndBlocker(ctx, app.govKeeper) validatorUpdates, endBlockerTags := stake.EndBlocker(ctx, app.stakeKeeper) tags = append(tags, endBlockerTags...) From a6294dcaa7fce61e778c3247d3f00d7c4dd9304e Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Wed, 19 Dec 2018 12:30:59 -0500 Subject: [PATCH 11/13] Fix docs --- docs/spec/slashing/tags.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/spec/slashing/tags.md b/docs/spec/slashing/tags.md index d98958dba330..a9f2e59d3a8b 100644 --- a/docs/spec/slashing/tags.md +++ b/docs/spec/slashing/tags.md @@ -6,7 +6,7 @@ The slashing module emits the following events/tags: ### MsgUnjail -| Key | Value | -|------------------------|----------------------------| -| action | validator-unjailed | -| validator | {validatorOperatorAddress} | +| Key | Value | +|-----------|----------------------------| +| action | validator-unjailed | +| validator | {validatorOperatorAddress} | From 3ee301fc46eb3a39af7e464096450c4d71274551 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Wed, 19 Dec 2018 14:25:27 -0500 Subject: [PATCH 12/13] Add pending log entry --- PENDING.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PENDING.md b/PENDING.md index 8027de1208a2..dfe5419ab630 100644 --- a/PENDING.md +++ b/PENDING.md @@ -38,6 +38,9 @@ IMPROVEMENTS * Gaia * SDK + * [\#3137](https://github.com/cosmos/cosmos-sdk/pull/3137) Add tag documentation + for each module along with cleaning up a few existing tags in the governance, + slashing, and staking modules. * Tendermint From 781b1aa942437f6eb61d424f9c0385542dc471e2 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Wed, 19 Dec 2018 16:13:34 -0500 Subject: [PATCH 13/13] Add back proposal ID tag to gov EndBlocker --- x/gov/handler.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/x/gov/handler.go b/x/gov/handler.go index fbde6a62220c..a39468967289 100644 --- a/x/gov/handler.go +++ b/x/gov/handler.go @@ -102,6 +102,7 @@ func EndBlocker(ctx sdk.Context, keeper Keeper) sdk.Tags { keeper.DeleteProposal(ctx, proposalID) keeper.DeleteDeposits(ctx, proposalID) // delete any associated deposits (burned) + resTags = resTags.AppendTag(tags.ProposalID, []byte(fmt.Sprintf("%d", proposalID))) resTags = resTags.AppendTag(tags.ProposalResult, tags.ActionProposalDropped) logger.Info( @@ -146,6 +147,7 @@ func EndBlocker(ctx sdk.Context, keeper Keeper) sdk.Tags { ), ) + resTags = resTags.AppendTag(tags.ProposalID, []byte(fmt.Sprintf("%d", proposalID))) resTags = resTags.AppendTag(tags.ProposalResult, tagValue) }