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

docs: update outdated events in specs #602

Merged
merged 17 commits into from
Jul 26, 2022
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current lbm-sdk is based on cosmos-sdk v0.45.1. But we need to bump up

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cosmos-sdk version up issue was added in #575 . Please check it later.


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 proceed to any other events in its process of the message.
0Tech marked this conversation as resolved.
Show resolved Hide resolved

## 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 |
Copy link

@ByunghyunBang ByunghyunBang Jul 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why message.actions are removed at document?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some modules do not have the event of type `message' in its document. So, I decided to put the event into the common document, and remove it from the individual module's.

| 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).