cosmos-sdk/x/staking/types
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
..
authz.go x/authz: audit updates (#9042) 2021-05-06 18:23:48 +00:00
authz.pb.go x/authz: Add DelegateAuthorization, UndelegateAuthorization (#8472) 2021-02-20 06:57:57 +00:00
authz_test.go x/authz: audit updates (#9042) 2021-05-06 18:23:48 +00:00
codec.go x/authz: audit updates (#9042) 2021-05-06 18:23:48 +00:00
commission.go Exclude proto files from format (#5706) 2020-02-27 07:53:22 -03:00
commission_test.go Replace tmcrypto.PubKey by our own cryptotypes.PubKey (#7419) 2020-11-09 16:01:43 +00:00
data_test.go Clean Any interface (#8167) 2020-12-18 14:55:25 +00:00
delegation.go codec: Rename codec and marshaler interfaces (#9226) 2021-04-29 10:46:22 +00:00
delegation_test.go Replace tmcrypto.PubKey by our own cryptotypes.PubKey (#7419) 2020-11-09 16:01:43 +00:00
errors.go Remove Redundant Staking Errors (#9231) 2021-05-19 12:20:17 +00:00
events.go Added a "new_shares" attribute inside the delegate event type (#9214) 2021-04-29 06:57:46 +00:00
expected_keepers.go feat: add coins burned to slash event (#9458) 2021-07-05 14:33:30 +00:00
exported.go on-chain power reduction param conversion basic work 2021-01-27 20:24:00 +10:00
genesis.go codec: Rename codec and marshaler interfaces (#9226) 2021-04-29 10:46:22 +00:00
genesis.pb.go Update gogo proto deps with v1.3.2 security fixes (#8350) 2021-01-15 19:45:34 +00:00
historical_info.go codec: Rename codec and marshaler interfaces (#9226) 2021-04-29 10:46:22 +00:00
historical_info_test.go codec: Rename codec and marshaler interfaces (#9226) 2021-04-29 10:46:22 +00:00
hooks.go feat!: add error handling to staking hooks (#9571) 2021-06-30 10:13:07 +00:00
keys.go Merge cosmos-sdk master 2021-02-03 22:36:29 +10:00
keys_test.go Merge cosmos-sdk master 2021-02-03 22:36:29 +10:00
msg.go Remove Redundant Staking Errors (#9231) 2021-05-19 12:20:17 +00:00
msg_test.go revert 8909 (#8960) 2021-04-06 11:40:17 +00:00
params.go revert: Turn staking power reduction into an on-chain param (#9495) 2021-06-14 14:45:15 +00:00
params_test.go Rename GRPCRouter (#8079) 2020-12-04 15:06:50 +00:00
pool.go x/staking: gRPC query Service (#6490) 2020-07-14 17:41:30 +00:00
querier.go x/staking: gRPC query Service (#6490) 2020-07-14 17:41:30 +00:00
query.pb.go Update gogo proto deps with v1.3.2 security fixes (#8350) 2021-01-15 19:45:34 +00:00
query.pb.gw.go gRPC gateway issue with colons in the account url path (#8649) 2021-02-22 11:30:45 +00:00
staking.pb.go revert: Turn staking power reduction into an on-chain param (#9495) 2021-06-14 14:45:15 +00:00
tx.pb.go fix make protoc error (#8799) 2021-03-05 15:23:01 +00:00
validator.go codec: Rename codec and marshaler interfaces (#9226) 2021-04-29 10:46:22 +00:00
validator_test.go Less function to not use default power reduction 2021-02-02 13:12:05 +10:00