tangle icon indicating copy to clipboard operation
tangle copied to clipboard

[TASK] Update chill to allow graceful exit from restaking

Open 1xstj opened this issue 1 year ago • 0 comments

Problem: Currently we don't have a proper path for restakers to "exit" from the system.

Chill extrinsic currently checks if can_exit is true

		pub fn chill(origin: OriginFor<T>) -> DispatchResult {
			let restaker_account = ensure_signed(origin.clone())?;
			// Ensure no role is assigned to the restaker_account before chilling.
			ensure!(Self::can_exit(restaker_account), Error::<T>::HasRoleAssigned);

			// chill
			pallet_staking::Pallet::<T>::chill(origin)
		}

And can_exit checks if no active roles:

	pub(crate) fn can_exit(account: T::AccountId) -> bool {
		let assigned_roles = AccountRolesMapping::<T>::get(account);
		if assigned_roles.is_empty() {
			// Role is cleared, account can chill, unbond and withdraw funds.
			return true
		}
		false
	}

But we cannot remove roles if we have an active job.

We need a "chill" mode similar to polkadot chill mode in staking where the validator will continue to process existing active jobs but will not be able to join new jobs. Then eventually once the validator is not part of any active jobs, they can exit from the system.

Question:

  • How to deal with restakers not part of any active jobs but part of KnownResults of phase1 jobs. Their exit might render the phase1 result useless.

1xstj avatar Feb 22 '24 21:02 1xstj