Skip to content

Commit

Permalink
docs: update outdated events in specs (Finschia#602)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
0Tech authored and dudong2 committed Aug 1, 2022
1 parent 9505081 commit c5d752a
Show file tree
Hide file tree
Showing 13 changed files with 107 additions and 86 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 18 additions & 0 deletions docs/core/event.md
Original file line number Diff line number Diff line change
@@ -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.
11 changes: 5 additions & 6 deletions x/bank/spec/04_events.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions x/collection/spec/03_events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!--
order: 3
-->

# Events

The collection module emits proto events defined in [the Protobuf reference](../../../docs/core/proto-docs.md#lbm/collection/v1/event.proto).
1 change: 0 additions & 1 deletion x/crisis/spec/03_events.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ The crisis module emits the following events:
|-----------|---------------|------------------|
| invariant | route | {invariantRoute} |
| message | module | crisis |
| message | action | verify_invariant |
| message | sender | {senderAddress} |
37 changes: 17 additions & 20 deletions x/distribution/spec/06_events.md
Original file line number Diff line number Diff line change
Expand Up @@ -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} |
Expand All @@ -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} |
3 changes: 1 addition & 2 deletions x/evidence/spec/04_events.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
26 changes: 13 additions & 13 deletions x/feegrant/spec/04_events.md
Original file line number Diff line number Diff line change
Expand Up @@ -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} |
2 changes: 1 addition & 1 deletion x/foundation/spec/03_events.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
29 changes: 13 additions & 16 deletions x/gov/spec/04_events.md
Original file line number Diff line number Diff line change
Expand Up @@ -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} |
Expand All @@ -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.
31 changes: 16 additions & 15 deletions x/slashing/spec/06_events.md
Original file line number Diff line number Diff line change
Expand Up @@ -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} |
20 changes: 8 additions & 12 deletions x/staking/spec/07_events.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,70 +9,66 @@ 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

### 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
7 changes: 7 additions & 0 deletions x/token/spec/03_events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!--
order: 3
-->

# Events

The token module emits proto events defined in [the Protobuf reference](../../../docs/core/proto-docs.md#lbm/token/v1/event.proto).

0 comments on commit c5d752a

Please sign in to comment.