Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Ank4n opened this issue Nov 16, 2024 · 1 comment
Open
Labels
I4-refactor Code needs refactoring.

Comments

@Ank4n
Copy link
Contributor

Ank4n commented Nov 16, 2024

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.
@Ank4n Ank4n added the I4-refactor Code needs refactoring. label Nov 16, 2024
@Ank4n Ank4n added this to AHM Nov 16, 2024
@gui1117
Copy link
Contributor

gui1117 commented Nov 20, 2024

This refactor could also fix #475
(If it gets easier to implement)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I4-refactor Code needs refactoring.
Projects
Status: No status
Development

No branches or pull requests

2 participants