Skip to content

[AHM] refactor: Move disable logic from pallet-staking to pallet-session #6508

@Ank4n

Description

@Ank4n

Context

The initial discussion on this took place here.

Currently the validator disable logic is mostly contained in pallet-staking, which passes the information to pallet-session, that then calls the pallets registered as SessionHandler.

But staking does not have a concept of disabling in itself, and everything needed to apply disable logic can also be done in pallet-staking. The larger issue with current code is that, it becomes incompatible (or at least very inefficient) when staking moves to AH and communication between staking <> session becomes async.

Proposed disable flow post AH migration

  • Offence is reported and verified on RC.
  • Any disable logic applied and propagated by pallet_session. It should also keep track of OffenceSeverity (same as SlashPerbill) in its DisabledValidators storage.
  • An offence report (Offender, Session, SlashPerbill) is sent to AH for slashing.

In practice, pallet_staking will be replaced by pallet_staking_client (or a more suitable name) that will fill in the gaps. That is, it will act as OnOffenceHandler and SessionManager on RC, and async communicate with Staking/AH.

Refactor tasks

  • Move validator logic completely to pallet-session. pallet-staking should not know anything about disabling.
  • The DisabledValidators list is maintained in two places: pallet-session and pallet-staking. The pallet-staking storage should be removed and the offense severity should be migrated to pallet-session.

Metadata

Metadata

Assignees

Labels

I4-refactorCode needs refactoring.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions