cosmos-sdk/x/slashing/spec
Tyler 2188dd0f3c
feat: add coins burned to slash event (#9458)
<!--
The default pull request template is for types feat, fix, or refactor.
For other templates, add one of the following parameters to the url:
- template=docs.md
- template=other.md
-->

## Description

Adds the amount of coins slashed from the validator to the `Slash` event. Additionally, before this PR, the jail/slash events were emitted **BEFORE** the slash/jail functions were even ran, which could result in a false positive event if an error occurred in these functions. ~~These events were moved to the end of the functions that implement the logic for them instead.~~ This PR moves the events to be emitted after the logic is executed. 

Closes: #9138 

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review. -->

- +Add `amount_slashed` to slash event
- +Slash now returns the amount of tokens burned
- +Events moved to be emitted after the logic is executed
- +Add test to test the slash return amount
~~- +Add EventType `Jail` to separate it from the `Slash` event~~
~~- +Move slash/jail events into the functions that execute the logic for it~~
~~- -Remove `Reason` attribute from slash event (didn't appear to be consistent with what was happening in code)~~

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [x] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [x] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [x] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [x] updated the relevant documentation or specification
- [x] reviewed "Files changed" and left comments if necessary
- [x] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [x] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - @ryanchristo 
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed 
- [x] reviewed state machine logic - not applicable
- [x] reviewed API design and naming - @ryanchristo 
- [x] reviewed documentation is accurate - @ryanchristo 
- [x] reviewed tests and test coverage - @ryanchristo 
- [ ] manually tested (if applicable)
2021-07-05 14:33:30 +00:00
..
01_concepts.md
02_state.md chore: add markdownlint to lint commands (#9353) 2021-05-27 15:31:04 +00:00
03_messages.md Robert/docs slashing (#8329) 2021-01-16 00:03:08 +01:00
04_begin_block.md
05_hooks.md chore: add markdownlint to lint commands (#9353) 2021-05-27 15:31:04 +00:00
06_events.md feat: add coins burned to slash event (#9458) 2021-07-05 14:33:30 +00:00
07_tombstone.md Robert/docs slashing (#8329) 2021-01-16 00:03:08 +01:00
08_params.md Robert/docs slashing (#8329) 2021-01-16 00:03:08 +01:00
README.md

README.md

x/slashing

Abstract

This section specifies the slashing module of the Cosmos SDK, which implements functionality first outlined in the Cosmos Whitepaper in June 2016.

The slashing module enables Cosmos SDK-based blockchains to disincentivize any attributable action by a protocol-recognized actor with value at stake by penalizing them ("slashing").

Penalties may include, but are not limited to:

  • Burning some amount of their stake
  • Removing their ability to vote on future blocks for a period of time.

This module will be used by the Cosmos Hub, the first hub in the Cosmos ecosystem.

Contents

  1. Concepts
  2. State
  3. Messages
  4. Begin-Block
  5. 05_hooks.md
  6. Events
  7. Staking Tombstone
  8. Parameters