Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Rewrite proportional slashing to to not leak dust into chunks that should not be slashed. #11810

@kianenigma

Description

@kianenigma

The purpose of proportional slashing, as per #10982 and #11782 to slash certain chunks and the active ledger, and leave the rest untouched.

This helps applications like nomination pools on top of the current staking provide better guarantees to their users.

For example, in Ledger { active: 10, unlokcing: vec![(10, 10) (10, 11)] }, we want to slash 5 from active and 5 from first unlocking chunk, instead of slashing 10 out of active.

The current implementation does achieve this, but since all slashes are rounded down, it is very likely that the sum of the proportional slashes are not enough to cover the slash, and some very small dust amount is slashed from the "first chunk that should have not been affected".

Examples of this can be found in proportional_ledger_slash_works tests.

This is not a big deal, but fixing it will clean up both the code and the interface a bit. All changes must be contained in fn slash in impl Ledger.

Metadata

Metadata

Assignees

No one assigned

    Labels

    I4-annoyanceThe client behaves within expectations, however this “expected behaviour” itself is at issue.I7-refactorCode needs refactoring.Z2-mediumCan be fixed by a coder with good Rust knowledge but little knowledge of the codebase.

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions