Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Investigate fungible trait Holds and Freezes overlap (#1873)
# Goal The goal of this PR is to investigate the overlap of `hold` and `frozen` in the frame system account, used by the balances pallet and the fungible trait (which replaced the Currency trait). Closes #1819 # Discussion Investigation indicates that it is not currently possible to create a situation where `frozen` overlaps with `hold` [currently indicated by `reserved` in the frame system account] and that `hold` can be slashed. - Use the `Democracy` pallet to create a proposal that would result in some tokens being placed on `hold`. The tokens on `hold` would always be returned to the user at some point in the future, they are not able to be slashed, as near as I can tell. - Use the `treasury` pallet to create a spend proposal that would result in a minimum of 100 tokens being used as a bond and placed on `hold`. These tokens will be slashed if the proposal is rejected. We can simulate a rejection using `sudo` and see that the tokens are slashed. - Validators and their Nominators can have their stake slashed. This is done using `hold`. However, experimentation with `hold` shows that conditions where `hold` and `frozen` overlap cause the transactions to fail. Tests were added to make sure this behavior does not change in the future. # Changes Two tests were added: 1. Create a treasury spend proposal and then attempt to stake with an amount that would overlap the `hold`. This transaction fails. 2. Create a stake and then attempt to create a treasury spend proposal that would require an amount of tokens that would overlap with the existing stake. This transaction fails. # How to Test - Confirm that the e2e tests pass. # Checklist - [ ] Chain spec updated - [ ] Custom RPC OR Runtime API added/changed? Updated js/api-augment. - [ ] Design doc(s) updated - [x] Tests added - [ ] Benchmarks added - [ ] Weights updated --------- Co-authored-by: Matthew Orris <--help>
- Loading branch information