From c5d752a05f7dfd90c84f8d529e5bbd56fdadd77a Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Tue, 26 Jul 2022 07:39:29 +0000 Subject: [PATCH] docs: update outdated events in specs (#602) * docs: update x/bank events * docs: update x/crisis events * docs: update x/distribution events * docs: update x/evidence events * docs: update x/feegrant events * docs: update x/gov events * docs: update x/slashing events * docs: update x/staking events * docs: add x/collection events * docs: update x/foundation events * docs: add x/token events * docs: add common spec of events into docs * docs: fix typo * docs: update CHANGELOG.md * docs: narrow the context * Update docs/core/event.md * Update docs/core/event.md --- CHANGELOG.md | 1 + docs/core/event.md | 18 ++++++++++++++++ x/bank/spec/04_events.md | 11 +++++----- x/collection/spec/03_events.md | 7 ++++++ x/crisis/spec/03_events.md | 1 - x/distribution/spec/06_events.md | 37 +++++++++++++++----------------- x/evidence/spec/04_events.md | 3 +-- x/feegrant/spec/04_events.md | 26 +++++++++++----------- x/foundation/spec/03_events.md | 2 +- x/gov/spec/04_events.md | 29 +++++++++++-------------- x/slashing/spec/06_events.md | 31 +++++++++++++------------- x/staking/spec/07_events.md | 20 +++++++---------- x/token/spec/03_events.md | 7 ++++++ 13 files changed, 107 insertions(+), 86 deletions(-) create mode 100644 docs/core/event.md create mode 100644 x/collection/spec/03_events.md create mode 100644 x/token/spec/03_events.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 92a0675711..e3eb306264 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -87,3 +87,4 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (docs) [\#483](https://github.com/line/lbm-sdk/pull/483) update documents on x/stakingplus * (docs) [\#490](https://github.com/line/lbm-sdk/pull/490) update documents on x/consortium +* (docs) [\#602](https://github.com/line/lbm-sdk/pull/602) update outdated events in specs diff --git a/docs/core/event.md b/docs/core/event.md new file mode 100644 index 0000000000..ddd0325ffe --- /dev/null +++ b/docs/core/event.md @@ -0,0 +1,18 @@ + +# Events of LBM-SDK + +Note: the content of this document is based on the actual implementation in version 0.45.6 of the cosmos-sdk. As we do not intend to introduce a new specification, it's a bug of the documentation if you find any differences between this document and the implementation. + +Note: these specifications are subject to change. + +## Common events + +In its process, every message emits an event of type `message` which has an attribute of a key `action`. This attribute has a value of `TypeURL` of the message. `TypeURL` is just a message name of the message, prefixed by `/`. For example, `TypeURL` of a message `MsgSend` in x/bank would be `/cosmos.bank.v1beta1.MsgSend`. + +This event MUST precede any other events in its process of the message. + +## Ordering + +The ordering of the events MUST be preserved in `Events` of `TxResponse`. + +Note: the field `Logs` is non-deterministic as cosmos-sdk says. diff --git a/x/bank/spec/04_events.md b/x/bank/spec/04_events.md index e71b820571..00b7102371 100644 --- a/x/bank/spec/04_events.md +++ b/x/bank/spec/04_events.md @@ -11,22 +11,21 @@ The bank module emits the following events: ### MsgSend | Type | Attribute Key | Attribute Value | -| -------- | ------------- | ------------------ | +|----------|---------------|--------------------| | transfer | recipient | {recipientAddress} | +| transfer | sender | {senderAddress} | | transfer | amount | {amount} | -| message | module | bank | -| message | action | send | | message | sender | {senderAddress} | +| message | module | bank | ### MsgMultiSend | Type | Attribute Key | Attribute Value | -| -------- | ------------- | ------------------ | +|----------|---------------|--------------------| +| message | sender | {senderAddress} | | transfer | recipient | {recipientAddress} | | transfer | amount | {amount} | | message | module | bank | -| message | action | multisend | -| message | sender | {senderAddress} | ## Keeper events diff --git a/x/collection/spec/03_events.md b/x/collection/spec/03_events.md new file mode 100644 index 0000000000..55013ea7c2 --- /dev/null +++ b/x/collection/spec/03_events.md @@ -0,0 +1,7 @@ + + +# Events + +The collection module emits proto events defined in [the Protobuf reference](../../../docs/core/proto-docs.md#lbm/collection/v1/event.proto). diff --git a/x/crisis/spec/03_events.md b/x/crisis/spec/03_events.md index 90070e4828..c5af7d5945 100644 --- a/x/crisis/spec/03_events.md +++ b/x/crisis/spec/03_events.md @@ -14,5 +14,4 @@ The crisis module emits the following events: |-----------|---------------|------------------| | invariant | route | {invariantRoute} | | message | module | crisis | -| message | action | verify_invariant | | message | sender | {senderAddress} | diff --git a/x/distribution/spec/06_events.md b/x/distribution/spec/06_events.md index 7e70f0beb4..c3d6f7300c 100644 --- a/x/distribution/spec/06_events.md +++ b/x/distribution/spec/06_events.md @@ -10,8 +10,8 @@ The distribution module emits the following events: | Type | Attribute Key | Attribute Value | |-----------------|---------------|--------------------| +| proposer_reward | amount | {proposerReward} | | proposer_reward | validator | {validatorAddress} | -| proposer_reward | reward | {proposerReward} | | commission | amount | {commissionAmount} | | commission | validator | {validatorAddress} | | rewards | amount | {rewardAmount} | @@ -21,28 +21,25 @@ The distribution module emits the following events: ### MsgSetWithdrawAddress -| Type | Attribute Key | Attribute Value | -|----------------------|------------------|----------------------| -| set_withdraw_address | withdraw_address | {withdrawAddress} | -| message | module | distribution | -| message | action | set_withdraw_address | -| message | sender | {senderAddress} | +| Type | Attribute Key | Attribute Value | +|----------------------|------------------|-------------------| +| set_withdraw_address | withdraw_address | {withdrawAddress} | +| message | module | distribution | +| message | sender | {senderAddress} | ### MsgWithdrawDelegatorReward -| Type | Attribute Key | Attribute Value | -|---------|---------------|---------------------------| -| withdraw_rewards | amount | {rewardAmount} | -| withdraw_rewards | validator | {validatorAddress} | -| message | module | distribution | -| message | action | withdraw_delegator_reward | -| message | sender | {senderAddress} | +| Type | Attribute Key | Attribute Value | +|------------------|---------------|--------------------| +| withdraw_rewards | amount | {rewardAmount} | +| withdraw_rewards | validator | {validatorAddress} | +| message | module | distribution | +| message | sender | {senderAddress} | ### MsgWithdrawValidatorCommission -| Type | Attribute Key | Attribute Value | -|------------|---------------|-------------------------------| -| withdraw_commission | amount | {commissionAmount} | -| message | module | distribution | -| message | action | withdraw_validator_commission | -| message | sender | {senderAddress} | +| Type | Attribute Key | Attribute Value | +|---------------------|---------------|--------------------| +| withdraw_commission | amount | {commissionAmount} | +| message | module | distribution | +| message | sender | {senderAddress} | diff --git a/x/evidence/spec/04_events.md b/x/evidence/spec/04_events.md index 35fd77b3f5..afcff2f45a 100644 --- a/x/evidence/spec/04_events.md +++ b/x/evidence/spec/04_events.md @@ -11,8 +11,7 @@ The `x/evidence` module emits the following events: ### MsgSubmitEvidence | Type | Attribute Key | Attribute Value | -| --------------- | ------------- | --------------- | +|-----------------|---------------|-----------------| | submit_evidence | evidence_hash | {evidenceHash} | | message | module | evidence | | message | sender | {senderAddress} | -| message | action | submit_evidence | diff --git a/x/feegrant/spec/04_events.md b/x/feegrant/spec/04_events.md index 7790b37fdf..cd89c12f8e 100644 --- a/x/feegrant/spec/04_events.md +++ b/x/feegrant/spec/04_events.md @@ -10,21 +10,21 @@ The feegrant module emits the following events: ### MsgGrantAllowance -| Type | Attribute Key | Attribute Value | -| ------- | ------------- | ---------------- | -| message | action | set_feegrant | -| message | granter | {granterAddress} | -| message | grantee | {granteeAddress} | +| Type | Attribute Key | Attribute Value | +|--------------|---------------|------------------| +| set_feegrant | granter | {granterAddress} | +| set_feegrant | grantee | {granteeAddress} | ### MsgRevokeAllowance -| ------- | ------------- | ---------------- | -| message | granter | {granterAddress} | -| message | grantee | {granteeAddress} | + +| Type | Attribute Key | Attribute Value | +|-----------------|---------------|------------------| +| revoke_feegrant | granter | {granterAddress} | +| revoke_feegrant | grantee | {granteeAddress} | ## Exec fee allowance -| Type | Attribute Key | Attribute Value | -| ------- | ------------- | ---------------- | -| message | action | use_feegrant | -| message | granter | {granterAddress} | -| message | grantee | {granteeAddress} | +| Type | Attribute Key | Attribute Value | +|--------------|---------------|------------------| +| use_feegrant | granter | {granterAddress} | +| use_feegrant | grantee | {granteeAddress} | diff --git a/x/foundation/spec/03_events.md b/x/foundation/spec/03_events.md index f1b1f9ab9b..3578b3fe79 100644 --- a/x/foundation/spec/03_events.md +++ b/x/foundation/spec/03_events.md @@ -4,4 +4,4 @@ order: 3 # Events -The foundation module emits proto events defined in the Protobuf reference. TODO: use buf schema registry. +The foundation module emits proto events defined in [the Protobuf reference](../../../docs/core/proto-docs.md#lbm/foundation/v1/event.proto). diff --git a/x/gov/spec/04_events.md b/x/gov/spec/04_events.md index 300d4d187c..95f8a4e0fc 100644 --- a/x/gov/spec/04_events.md +++ b/x/gov/spec/04_events.md @@ -9,7 +9,7 @@ The governance module emits the following events: ## EndBlocker | Type | Attribute Key | Attribute Value | -| ----------------- | --------------- | ---------------- | +|-------------------|-----------------|------------------| | inactive_proposal | proposal_id | {proposalID} | | inactive_proposal | proposal_result | {proposalResult} | | active_proposal | proposal_id | {proposalID} | @@ -20,46 +20,43 @@ The governance module emits the following events: ### MsgSubmitProposal | Type | Attribute Key | Attribute Value | -| ------------------- | ------------------- | --------------- | +|---------------------|---------------------|-----------------| | submit_proposal | proposal_id | {proposalID} | -| submit_proposal [0] | voting_period_start | {proposalID} | | proposal_deposit | amount | {depositAmount} | | proposal_deposit | proposal_id | {proposalID} | | message | module | governance | -| message | action | submit_proposal | | message | sender | {senderAddress} | +| submit_proposal | proposal_type | {proposalType} | +| submit_proposal [0] | voting_period_start | {proposalID} | - [0] Event only emitted if the voting period starts during the submission. ### MsgVote | Type | Attribute Key | Attribute Value | -| ------------- | ------------- | --------------- | +|---------------|---------------|-----------------| | proposal_vote | option | {voteOption} | | proposal_vote | proposal_id | {proposalID} | | message | module | governance | -| message | action | vote | | message | sender | {senderAddress} | ### MsgVoteWeighted -| Type | Attribute Key | Attribute Value | -| ------------- | ------------- | ------------------------ | -| proposal_vote | option | {weightedVoteOptions} | -| proposal_vote | proposal_id | {proposalID} | -| message | module | governance | -| message | action | vote | -| message | sender | {senderAddress} | +| Type | Attribute Key | Attribute Value | +|---------------|---------------|-----------------------| +| proposal_vote | option | {weightedVoteOptions} | +| proposal_vote | proposal_id | {proposalID} | +| message | module | governance | +| message | sender | {senderAddress} | ### MsgDeposit | Type | Attribute Key | Attribute Value | -| -------------------- | ------------------- | --------------- | +|----------------------|---------------------|-----------------| | proposal_deposit | amount | {depositAmount} | | proposal_deposit | proposal_id | {proposalID} | -| proposal_deposit [0] | voting_period_start | {proposalID} | | message | module | governance | -| message | action | deposit | | message | sender | {senderAddress} | +| proposal_deposit [0] | voting_period_start | {proposalID} | - [0] Event only emitted if the voting period starts during the submission. diff --git a/x/slashing/spec/06_events.md b/x/slashing/spec/06_events.md index 8f259ae46c..0079691627 100644 --- a/x/slashing/spec/06_events.md +++ b/x/slashing/spec/06_events.md @@ -10,36 +10,37 @@ The slashing module emits the following events/tags: ### MsgUnjail -| Type | Attribute Key | Attribute Value | -| ------- | ------------- | --------------- | -| message | module | slashing | +| Type | Attribute Key | Attribute Value | +|---------|---------------|--------------------| +| message | module | slashing | | message | sender | {validatorAddress} | ## Keeper ## BeginBlocker: HandleValidatorSignature -| Type | Attribute Key | Attribute Value | -| ----- | ------------- | --------------------------- | -| slash | address | {validatorConsensusAddress} | -| slash | power | {validatorPower} | -| slash | reason | {slashReason} | -| slash | jailed [0] | {validatorConsensusAddress} | - -- [0] Only included if the validator is jailed. - | Type | Attribute Key | Attribute Value | -| -------- | ------------- | --------------------------- | +|----------|---------------|-----------------------------| | liveness | address | {validatorConsensusAddress} | | liveness | missed_blocks | {missedBlocksCounter} | | liveness | height | {blockHeight} | +| slash | address | {validatorConsensusAddress} | +| slash | power | {validatorPower} | +| slash | reason | {slashReason} | +| slash | jailed [0] | {validatorConsensusAddress} | + +- [0] Only included if the validator is jailed. ### Slash -+ same as `"slash"` event from `HandleValidatorSignature`, but without the `jailed` attribute. +| Type | Attribute Key | Attribute Value | +|-------|---------------|-----------------------------| +| slash | address | {validatorConsensusAddress} | +| slash | power | {validatorPower} | +| slash | reason | {slashReason} | ### Jail | Type | Attribute Key | Attribute Value | -| ----- | ------------- | ------------------ | +|-------|---------------|--------------------| | slash | jailed | {validatorAddress} | diff --git a/x/staking/spec/07_events.md b/x/staking/spec/07_events.md index f219fa2ca4..3bab0add7e 100644 --- a/x/staking/spec/07_events.md +++ b/x/staking/spec/07_events.md @@ -9,56 +9,53 @@ The staking module emits the following events: ## EndBlocker | Type | Attribute Key | Attribute Value | -| --------------------- | --------------------- | ------------------------- | +|-----------------------|-----------------------|---------------------------| | complete_unbonding | amount | {totalUnbondingAmount} | | complete_unbonding | validator | {validatorAddress} | | complete_unbonding | delegator | {delegatorAddress} | | complete_redelegation | amount | {totalRedelegationAmount} | +| complete_redelegation | delegator | {delegatorAddress} | | complete_redelegation | source_validator | {srcValidatorAddress} | | complete_redelegation | destination_validator | {dstValidatorAddress} | -| complete_redelegation | delegator | {delegatorAddress} | ## Msg's ### MsgCreateValidator | Type | Attribute Key | Attribute Value | -| ---------------- | ------------- | ------------------ | +|------------------|---------------|--------------------| | create_validator | validator | {validatorAddress} | | create_validator | amount | {delegationAmount} | | message | module | staking | -| message | action | create_validator | | message | sender | {senderAddress} | ### MsgEditValidator | Type | Attribute Key | Attribute Value | -| -------------- | ------------------- | ------------------- | +|----------------|---------------------|---------------------| | edit_validator | commission_rate | {commissionRate} | | edit_validator | min_self_delegation | {minSelfDelegation} | | message | module | staking | -| message | action | edit_validator | | message | sender | {senderAddress} | ### MsgDelegate | Type | Attribute Key | Attribute Value | -| -------- | ------------- | ------------------ | +|----------|---------------|--------------------| | delegate | validator | {validatorAddress} | | delegate | amount | {delegationAmount} | +| delegate | new_shares | {newShares} | | message | module | staking | -| message | action | delegate | | message | sender | {senderAddress} | ### MsgUndelegate | Type | Attribute Key | Attribute Value | -| ------- | ------------------- | ------------------ | +|---------|---------------------|--------------------| | unbond | validator | {validatorAddress} | | unbond | amount | {unbondAmount} | | unbond | completion_time [0] | {completionTime} | | message | module | staking | -| message | action | begin_unbonding | | message | sender | {senderAddress} | - [0] Time is formatted in the RFC3339 standard @@ -66,13 +63,12 @@ The staking module emits the following events: ### MsgBeginRedelegate | Type | Attribute Key | Attribute Value | -| ---------- | --------------------- | --------------------- | +|------------|-----------------------|-----------------------| | redelegate | source_validator | {srcValidatorAddress} | | redelegate | destination_validator | {dstValidatorAddress} | | redelegate | amount | {unbondAmount} | | redelegate | completion_time [0] | {completionTime} | | message | module | staking | -| message | action | begin_redelegate | | message | sender | {senderAddress} | - [0] Time is formatted in the RFC3339 standard diff --git a/x/token/spec/03_events.md b/x/token/spec/03_events.md new file mode 100644 index 0000000000..9e36afab47 --- /dev/null +++ b/x/token/spec/03_events.md @@ -0,0 +1,7 @@ + + +# Events + +The token module emits proto events defined in [the Protobuf reference](../../../docs/core/proto-docs.md#lbm/token/v1/event.proto).