This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
migration(democracy): unreserve deposits and clear locks #14226
Merged
paritytech-processbot
merged 35 commits into
master
from
liam-democracy-unreserve-funds
Jun 13, 2023
Merged
migration(democracy): unreserve deposits and clear locks #14226
paritytech-processbot
merged 35 commits into
master
from
liam-democracy-unreserve-funds
Jun 13, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Closed
12 tasks
liamaharon
changed the title
migration(democracy): unreserve all deposits and unlock all stake
migration(democracy): unreserve all deposits and clear locks
May 25, 2023
liamaharon
changed the title
migration(democracy): unreserve all deposits and clear locks
migration(democracy): unreserve deposits and clear locks
May 25, 2023
liamaharon
added
A0-please_review
Pull request needs code review.
C1-low
PR touches the given topic and has a low impact on builders.
D3-trivial 🧸
PR contains trivial changes in a runtime directory that do not require an audit
B1-note_worthy
Changes should be noted in the release notes
T1-runtime
This PR/Issue is related to the topic “runtime”.
labels
May 25, 2023
I just found a way to handle the Balances types cleaner. Switching this to a draft while I improve that, also going to add some unit tests. |
liamaharon
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
May 26, 2023
liamaharon
added
A0-please_review
Pull request needs code review.
and removed
A3-in_progress
Pull request is in progress. No review needed at this stage.
labels
May 29, 2023
ggwpez
reviewed
Jun 13, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not super familiar with the pallet but LGTM.
Going to approve after checking on DotSama myself.
frame/democracy/src/migrations/unlock_and_unreserve_all_funds.rs
Outdated
Show resolved
Hide resolved
frame/democracy/src/migrations/unlock_and_unreserve_all_funds.rs
Outdated
Show resolved
Hide resolved
frame/democracy/src/migrations/unlock_and_unreserve_all_funds.rs
Outdated
Show resolved
Hide resolved
frame/democracy/src/migrations/unlock_and_unreserve_all_funds.rs
Outdated
Show resolved
Hide resolved
kianenigma
reviewed
Jun 13, 2023
frame/democracy/src/migrations/unlock_and_unreserve_all_funds.rs
Outdated
Show resolved
Hide resolved
kianenigma
approved these changes
Jun 13, 2023
kianenigma
reviewed
Jun 13, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to post an example output of try-runtime prior to final ask for review.
sam0x17
approved these changes
Jun 13, 2023
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
…mocracy-unreserve-funds
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
…h/substrate into liam-democracy-unreserve-funds
bot merge |
nathanwhit
pushed a commit
to nathanwhit/substrate
that referenced
this pull request
Jul 19, 2023
…14226) * unlock and unreserve all migration * log total amount to unlock * clippy * clippy * simplify balance types * add tests * fix comment * fix std features * remove redundant dev-dep * address comments * remove redundant std * estimate weights * fix comments * fix tests * clippy * track democracy bugged deposits * improve pre_migration logs * oliver comments from tips pr * run pre and post hooks in tests * flexible dbweight type * Update frame/democracy/src/migrations/unlock_and_unreserve_all_funds.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update frame/democracy/src/migrations/unlock_and_unreserve_all_funds.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Update frame/democracy/src/migrations/unlock_and_unreserve_all_funds.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * docs * Update frame/democracy/src/lib.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update frame/democracy/src/migrations/unlock_and_unreserve_all_funds.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * add log target * fix visibility * lint * use log target --------- Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
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.
B1-note_worthy
Changes should be noted in the release notes
C1-low
PR touches the given topic and has a low impact on builders.
D3-trivial 🧸
PR contains trivial changes in a runtime directory that do not require an audit
T1-runtime
This PR/Issue is related to the topic “runtime”.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Partial paritytech/polkadot-sdk#485
Overview
Adds a migration that unreserves all deposits and clears locks held by the
democracy
pallet.I've verified this works using
try-runtime-cli
and the latest Polkadot state (testing with Kusama state blocked by my last Q below).Details
democracy
contains aDepositOf
storage item containing all the amounts reserved by this pallet, and aVoters
storage item containing all the accounts that have locks held in the context of this pallet.pre_upgrade
collects pre-migration data useful for validating the migration was successful, and also checks the integrity of deposited balances.on_runtime_upgrade
unreserves and unlocks the balances.post_upgrade
checks that no more locks exist for the pallet, and reserved balances were reduced by the expected amount.try-runtime-cli
on-runtime-upgrade
logsQuestions for reviewers / todos:
This currently assumes that thedemocracy
pallet is part of the runtime. We need to run it for Kusama where it has already been removed from the runtime. What's the cleanest way to go about this?How do I calculate the weight of theremove_lock
andunreserve
calls?remove_lock
triggers someERROR main runtime::system: Logic error: Unexpected underflow in reducing consumer
error logs. I have verified that a non-zero lock always exists beforeremove_lock
is called, even when it results in this log. Are they safe to ignore?