-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: account migration #338
Conversation
runtime/src/migrations.rs
Outdated
} | ||
|
||
const TARGET: &'static str = "runtime::account_data_migration"; | ||
pub struct Migration; |
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.
Might wanna give this a more descriptive name.
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.
I mean it is the only Migration in the account_data_migration
module :P
/// Ensures post-upgrade that | ||
/// 1. Number of accounts has not changed. | ||
/// 2. Each account exists in storage and decodes. | ||
/// 3. Each account has a provider val >0. |
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.
Was this something you wrote? I was thinking how it was even possible to get an old lifecycle runtime upgrade hook from upstream to execute in our chain, but if you wrote a brand new one, it does the job just fine.
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.
Yeah I wrote this from scratch.
Co-authored-by: Keith <[email protected]>
Fixes minor issues with the last account migration and vastly improves test coverage / sanity checks.
Issues fixed
Account
straight intoinstead of
which caused
free
to be set tononce
,reserved
to be set toconsumers
, etc.::mutate
while the state was still undecodable, leading to the new state being set in storage with everything exceptdata
reset to defaults (zero). Switching to::insert
and passing the entire new state resolves this issue.Other changes
pre_upgrade
andpost_upgrade
checks