Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Automatic withdraw_unbonded upon unbond #12582

Merged
merged 22 commits into from
Dec 15, 2022

Conversation

gpestana
Copy link
Contributor

@gpestana gpestana commented Oct 30, 2022

This PR changes the flow of fn unbond to try to release unbonding chunks if the slots are full. Before unbonding, fn unbond will check if there are still chunk slots available for the controller's account. If no available chunk slots, then the fn withdrawn_unbond will be implicitly called to free up space in the chunk queue and proceed with the unbond. The call to fn unbound may still fail with NoMoreChunks if it was not possible to unlock free chunks due to the unbonding duration.

@gpestana gpestana self-assigned this Oct 30, 2022
@gpestana gpestana marked this pull request as draft October 30, 2022 10:05
@gpestana gpestana force-pushed the staking_interface-ensure_unbond branch from f90291e to 4e0e816 Compare November 1, 2022 18:00
@gpestana gpestana changed the title Preventing max unbonding pools slots filled in nomination pools Prevents max unbonding chunk slots from being filled when unbonding in the staking pallet Nov 1, 2022
@gpestana gpestana force-pushed the staking_interface-ensure_unbond branch from 4e0e816 to 9e569f5 Compare November 1, 2022 18:06
@gpestana gpestana marked this pull request as ready for review November 8, 2022 08:24
@github-actions github-actions bot added the A0-please_review Pull request needs code review. label Nov 8, 2022
@gpestana gpestana added A3-in_progress Pull request is in progress. No review needed at this stage. and removed A0-please_review Pull request needs code review. labels Nov 14, 2022
@gpestana gpestana added B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D9-needsaudit 👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited labels Dec 8, 2022
@kianenigma kianenigma changed the title Prevents max unbonding chunk slots from being filled when unbonding in the staking pallet Automatic withdraw_unbonded upon unbond Dec 8, 2022
@gpestana gpestana added B7-runtimenoteworthy and removed B0-silent Changes should not be mentioned in any release notes labels Dec 8, 2022
@kianenigma
Copy link
Contributor

Needs rebase.

@gpestana
Copy link
Contributor Author

/cmd queue -c bench-bot $ pallet dev pallet_staking

@command-bot
Copy link

command-bot bot commented Dec 14, 2022

@gpestana https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2158490 was started for your command "$PIPELINE_SCRIPTS_DIR/bench-bot.sh" pallet dev pallet_staking. 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 77-6b5c5f2c-e605-48ea-985c-1d6e76f5f111 to cancel this command or /cmd cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Dec 14, 2022

@gpestana Command "$PIPELINE_SCRIPTS_DIR/bench-bot.sh" pallet dev pallet_staking has finished. Result: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2158490 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2158490/artifacts/download.

@jakoblell jakoblell added D1-audited 👍 PR contains changes to fund-managing logic that has been properly reviewed and externally audited and removed D9-needsaudit 👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited labels Dec 14, 2022
@gpestana
Copy link
Contributor Author

bot merge

@paritytech-processbot paritytech-processbot bot merged commit f763ff6 into master Dec 15, 2022
@paritytech-processbot paritytech-processbot bot deleted the staking_interface-ensure_unbond branch December 15, 2022 08:57
@Polkadot-Forum
Copy link

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

https://forum.polkadot.network/t/polkadot-release-analysis-v0-9-36/1529/1

karapetyantv added a commit to mixbytes/lido-dot-ksm that referenced this pull request Jan 9, 2023
After changes introduced in paritytech/substrate#12582
unbond method now additionaly calls withdraw_unbond_kill
ltfschoen pushed a commit to ltfschoen/substrate that referenced this pull request Feb 22, 2023
* Prevents max unbonding chunk slots from being filled when unbonding in the staking pallet

* hardcode num_slashing to unlock chunks automatically

* refactor withdraw logic to do_withdraw; idiomatic rust improvements

* a

* callable unbond() to return a DispatchWithPostInfo to dynamically update the consumed weight

* refunds overpaid fees when unbond with withdraw

* fetches real slashing spans before withdrawal call

* nits

* addresses PR comments

* Adds more testing

* fixes doc comments

* Fixes weight refunding logic for fn unbond

* generalizes  to return used weight or dispatch error

* Update frame/staking/src/pallet/mod.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update frame/staking/src/pallet/mod.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Addresses PR comments

* Add comment to speculative num spans

* adds missing add_slashing_spans in withdraw_unbonded_kill benchmarks

* ".git/.scripts/bench-bot.sh" pallet dev pallet_staking

* fix publish

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: command-bot <>
ark0f pushed a commit to gear-tech/substrate that referenced this pull request Feb 27, 2023
* Prevents max unbonding chunk slots from being filled when unbonding in the staking pallet

* hardcode num_slashing to unlock chunks automatically

* refactor withdraw logic to do_withdraw; idiomatic rust improvements

* a

* callable unbond() to return a DispatchWithPostInfo to dynamically update the consumed weight

* refunds overpaid fees when unbond with withdraw

* fetches real slashing spans before withdrawal call

* nits

* addresses PR comments

* Adds more testing

* fixes doc comments

* Fixes weight refunding logic for fn unbond

* generalizes  to return used weight or dispatch error

* Update frame/staking/src/pallet/mod.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update frame/staking/src/pallet/mod.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Addresses PR comments

* Add comment to speculative num spans

* adds missing add_slashing_spans in withdraw_unbonded_kill benchmarks

* ".git/.scripts/bench-bot.sh" pallet dev pallet_staking

* fix publish

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: command-bot <>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. C1-low PR touches the given topic and has a low impact on builders. D1-audited 👍 PR contains changes to fund-managing logic that has been properly reviewed and externally audited
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants