substrate icon indicating copy to clipboard operation
substrate copied to clipboard

Fast Unstake Pallet

Open kianenigma opened this issue 3 years ago • 10 comments

Fixes #8436

This is a pallet that does one thing and one thing only: allow you to unstake from the staking system quickly IFF you are not exposed (i.e. not in the Exposure of any validator) in any of the last BondingDuration eras. Optionally, this pallet allows one to join a pool on the fly as they unstake.

Multiple ideas exist to implement this, all of which have been discussed in #8436. This PR is probably the most conservative approach in terms of security, yet it is the least efficient for the chain. To be specific, the pallet will schedule background tasks to check the entire exposure table of the stash who wants to unstake over multiple blocks. This is not fast, does waste chain resources, but it is safe.

@rossbulat and I have the intention to merge this before 9.29 release and implement it in the staking dashboard as well, hopefully providing a much better UX for those who wish to migrate from staking to Pools.

TODO:

  • [x] Tests @rossbulat
  • [ ] Issue for future task: de-couple this from the nomination_pools pallet.

kianenigma avatar Aug 28 '22 12:08 kianenigma

/cmd queue -c fmt $ 1

kianenigma avatar Sep 08 '22 11:09 kianenigma

@kianenigma https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/1821792 was started for your command "$PIPELINE_SCRIPTS_DIR/fmt.sh" 1. Check out https://gitlab.parity.io/parity/mirrors/substrate/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment /cmd cancel 64-18b8c03f-5490-45c1-b956-56a81fbf8497 to cancel this command or /cmd cancel to cancel all commands in this pull request.

command-bot[bot] avatar Sep 08 '22 11:09 command-bot[bot]

@kianenigma Command "$PIPELINE_SCRIPTS_DIR/fmt.sh" 1 has finished. Result: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/1821792 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/1821792/artifacts/download.

command-bot[bot] avatar Sep 08 '22 11:09 command-bot[bot]

First superficial look at this PR: we need to explain what the heck "not exposed" means in layman's terms. Stating that it's not in the Exposure of any validator is not good enough, because it begs the question "what exactly is an Exposure for a validator?"

KiChjang avatar Sep 09 '22 07:09 KiChjang

First superficial look at this PR: we need to explain what the heck "not exposed" means in layman's terms. Stating that it's not in the Exposure of any validator is not good enough, because it begs the question "what exactly is an Exposure for a validator?"

https://github.com/paritytech/substrate/pull/12129/commits/c925741d271716d21f0e34b9f4f16e08707a8852

Do you want more docs for review and developer purposes, or for end users?

For the former, I think adding more context here is moot. This pallet relies on pallet_staking and concepts such as Exposure are explained there.

For the latter, I also think more than this is not useful because I don't think anyone wants (or is capable of) checking whether they are exposed or not. The wallet would identify this, and if the user is eligible, would report it to them. So the real audience here is wallet developers. s

kianenigma avatar Sep 09 '22 08:09 kianenigma

This pull request has been mentioned on Polkadot Forum. There might be relevant details there:

https://forum.polkadot.network/t/nomination-pools-integration/361/1

Polkadot-Forum avatar Sep 13 '22 13:09 Polkadot-Forum

Minor nitpicks but LGTM! :+1:

Ank4n avatar Sep 15 '22 15:09 Ank4n

/cmd queue -c fmt $ 1

kianenigma avatar Sep 20 '22 12:09 kianenigma

@kianenigma https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/1861972 was started for your command "$PIPELINE_SCRIPTS_DIR/fmt.sh" 1. Check out https://gitlab.parity.io/parity/mirrors/substrate/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment /cmd cancel 37-5c1b3b9b-da7c-4321-b653-9f26689237fc to cancel this command or /cmd cancel to cancel all commands in this pull request.

command-bot[bot] avatar Sep 20 '22 12:09 command-bot[bot]

@kianenigma Command "$PIPELINE_SCRIPTS_DIR/fmt.sh" 1 has finished. Result: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/1861972 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/1861972/artifacts/download.

command-bot[bot] avatar Sep 20 '22 12:09 command-bot[bot]

merging this, won't go to Polkadot yet.

kianenigma avatar Sep 23 '22 09:09 kianenigma

bot merge

kianenigma avatar Sep 23 '22 09:09 kianenigma

This pull request has been mentioned on Polkadot Forum. There might be relevant details there:

https://forum.polkadot.network/t/path-to-fast-unstake-in-polkadot-kusama/1539/1

Polkadot-Forum avatar Dec 23 '22 14:12 Polkadot-Forum

This pull request has been mentioned on Polkadot Forum. There might be relevant details there:

https://forum.polkadot.network/t/polkadot-digest-17-jan-2023/1706/1

Polkadot-Forum avatar Jan 17 '23 09:01 Polkadot-Forum