Skip to content

Investigate fungible trait Holds and Freezes overlap. #1819

@mattheworris

Description

@mattheworris

As referenced here: Deprecate Currency; introduce holds and freezing into fungible traits
and implemented in the following PRs: #1779 #1818

The following comment indicates that we need to investigate some test cases where Holds are slashed and ensure that the affected pallets handle their bookkeeping for Freezes correctly:

Freezes are essentially the same as locks, except that they overlap with Holds. Since Holds are designed to be infallibly slashed, this means that any logic using a Freeze must handle the possibility of the frozen amount being reduced, potentially to zero. A permissionless function should be provided in order to allow bookkeeping to be updated in this instance.

Discussion

  • Implement e2e tests that exercise the overlap between Holds and Freezes
    • Build a test where an account with a Freeze and a Hold and the Hold is slashed
    • Ensure the capacity pallet handles the logic correctly without any exploits
      • Check if amount staked is reduced to correlate with the amount slashed. Users should not be able to continue receiving the same capacity when tokens are slashed.
    • Ensure that a user can stake token to network and participate in governance with the same token amount (frozen amount).
    • Ensure the time-release pallet handles the logic correctly without any exploits

Changes

  • Add e2e test with simultaneous Hold and Freeze.

How to Test

  • Confirm that the new e2e tests pass.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions