AHM: Staking Migration Plan
As the code for staking is almost end-to-end (e2e) code-complete, we can draw a more concrete plan as to how the migration is going to work. This plan outlines the necessary steps to ensure a smooth transition from the current staking system to the new one.
Pallets List and Action Plan
The following pallets need to be migrated or updated as part of the staking migration plan:
- Pallet-staking: This pallet requires manual storage item migration. The code will not exist in the RC, and manual migration code with
#[storage_alias]
is needed. - Pallet-nomination-pools: This pallet can be migrated as-is.
- Pallet-delegated-staking: This pallet can be migrated as-is.
- Pallet-fast-unstake: This pallet can be migrated as-is.
- Pallet-bags-list: This pallet needs to be re-generated upon receiving or migrated as-is. It's recommended to re-generate upon receiving.
Added Pallets to RC Runtime
The following pallets will be added to the RC runtime:
- Pallet-staking-ah-client: This pallet is an example of how to implement the staking client in the RC runtime. You can refer to the westend-next code for more information.
Deleted from the RC Runtime/State
The following pallet will be deleted from the RC runtime/state:
- Pallet-election-provider-multi-phase: This pallet is not migrated and will be removed.
Added Pallets to AH Runtime
The following pallets will be added to the AH runtime:
- Pallet-election-provider-multi-block: This pallet includes the
self
,signed
,unsigned
, andverifier
modules. You can refer to the ah-next code for more information. - Pallet-staking-rc-client: This pallet is an example of how to implement the staking client in the AH runtime. You can refer to the ah-next code for more information.
Sequence of Events
The following sequence of events will occur during the migration:
- Upgrade RC to have the migration pallets + the pallets named above: The RC runtime will be upgraded to include the necessary pallets for the migration.
- Must happen when
active_era == current_era
(no pending validators): The upgrade must occur when there are no pending validators, and ideally at the first session of an era. - No further transactions allowed, state is mostly fixed: Once the upgrade is complete, no further transactions will be allowed, and the state will be mostly fixed.
- This upgrade should link
pallet-session
<>pallet-staking-ah-client
: The upgrade will link thepallet-session
andpallet-staking-ah-client
pallets. - Start migration: The migration will begin.
pallet-staking-ah-client
should not send session-reports until the migration is over: Thepallet-staking-ah-client
will not send session reports until the migration is complete.- Once migration is over on the RC side, remove this guard and let session reports be sent over: Once the migration is complete on the RC side, the guard will be removed, and session reports will be sent over.
- Staking will conduct the next election as soon as it can: The staking system will conduct the next election as soon as possible.
- The rewards on the first era will likely be more than usual, to compensate for the delay caused by the migration: The rewards on the first era may be higher than usual to compensate for the delay caused by the migration.
Bots
Both bots need to be running parity devops by the time migration happens:
- P0: Staking miner: The staking miner bot will be running parity devops.
- P1: New rebag-bot: The new rebag-bot will be running parity devops.
Checklist / Considerations
The following checklist and considerations need to be addressed:
- Rust e2e tests: Rust e2e tests need to be conducted.
- Slashing test in ZN: A slashing test in ZN needs to be conducted.
- Systematize ZN tests: ZN tests need to be systematized.
- Minting new tokens in AH -- is this an issue in any way?: Minting new tokens in AH may be an issue and needs to be addressed.
- XCM weights: XCM weights need to be updated.
- Staking System Command Center: The staking system command center needs to be updated.
Runtime Configurations
The runtime configurations for Westend, Kusama, and Polkadot need to be finalized and signed off by @kianenigma.
Westend
The runtime configuration for Westend needs to be finalized and signed off.
Kusama
The runtime configuration for Kusama needs to be finalized and signed off.
Polkadot
As the staking migration plan is being implemented, it's essential to address any questions or concerns that may arise. Below is a Q&A article that provides more information on the staking migration plan.
Q: What is the purpose of the staking migration plan?
A: The staking migration plan is designed to upgrade the staking system to a new and improved version, ensuring a smoother and more efficient experience for users.
Q: What are the key components of the staking migration plan?
A: The key components of the staking migration plan include:
- Upgrading the RC runtime to include the necessary pallets for the migration
- Migrating the pallet-staking pallet to the new staking system
- Adding the pallet-staking-ah-client pallet to the AH runtime
- Deleting the pallet-election-provider-multi-phase pallet from the RC runtime/state
- Adding the pallet-election-provider-multi-block pallet to the AH runtime
- Conducting the next election as soon as possible
- Updating the rewards on the first era to compensate for the delay caused by the migration
Q: What is the timeline for the staking migration plan?
A: The timeline for the staking migration plan is as follows:
- Upgrade RC to have the migration pallets + the pallets named above: This will occur when
active_era == current_era
(no pending validators) and ideally at the first session of an era. - No further transactions allowed, state is mostly fixed: This will occur once the upgrade is complete.
- This upgrade should link
pallet-session
<>pallet-staking-ah-client
: This will occur once the upgrade is complete. - Start migration: This will occur once the upgrade is complete.
pallet-staking-ah-client
should not send session-reports until the migration is over: This will occur once the migration begins.- Once migration is over on the RC side, remove this guard and let session reports be sent over: This will occur once the migration is complete on the RC side.
- Staking will conduct the next election as soon as it can: This will occur once the migration is complete.
- The rewards on the first era will likely be more than usual, to compensate for the delay caused by the migration: This will occur once the migration is complete.
Q: What are the benefits of the staking migration plan?
A: The benefits of the staking migration plan include:
- A smoother and more efficient experience for users
- Improved security and reliability
- Increased scalability and flexibility
- Enhanced user experience
Q: What are the potential risks of the staking migration plan?
A: The potential risks of the staking migration plan include:
- Technical issues during the migration process
- Delays in the migration process
- Loss of user data or funds
- Security vulnerabilities
Q: How can users prepare for the staking migration plan?
A: Users can prepare for the staking migration plan by:
- Ensuring they have the latest version of the software
- Backing up their data and funds
- Monitoring the migration process closely
- Following instructions from the development team
Q: What is the role of the development team in the staking migration plan?
A: The development team plays a crucial role in the staking migration plan, including:
- Developing and testing the new staking system
- Conducting the migration process
- Providing support and guidance to users
- Monitoring the migration process and addressing any issues that arise
Q: How can users provide feedback on the staking migration plan?
A: Users can provide feedback on the staking migration plan by:
- Submitting bug reports or issues
- Providing suggestions for improvement
- Participating in community discussions and forums
- Reaching out to the development team directly
Q: What is the expected outcome of the staking migration plan?
A: The expected outcome of the staking migration plan is a smoother and more efficient experience for users, with improved security and reliability, increased scalability and flexibility, and an enhanced user experience.