runtime/session-info: use `Executive` for migration

This issue has been created since 2022-01-13.

@kianenigma brought this to my attention:

We're using a deprecated mechanism for runtime migration in session-info:

#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
fn on_runtime_upgrade() -> Weight {
migration::migrate_to_latest::<T>()
}
}

instead, we should do something like https://github.com/paritytech/polkadot/pull/4710/files.
It would be good to write some pre/post-conditions as well, e.g. ensuring the length of Sessions is preserved.

This is also true for the Configuration pallet.

bkchr wrote this answer on 2022-01-13

While @kianenigma is right, for concrete blockchain implementations I don't see such a huge need for putting everything into the runtime lib.rs file. The point being here is that this stuff isn't reused by others and they are not getting fucked that easily. For migrations in Polkadot it is completly okay to remove them after they are applied on chain, because they will never be required anymore.

ordian wrote this answer on 2022-01-14

I guess the main benefit is being able to test with try-runtime and writing down the migration invariants explicitly.

bkchr wrote this answer on 2022-01-14

Try runtime also works on pallet level.

kianenigma wrote this answer on 2022-01-14

Yes try-runtime works for both.

While Basti's argument is correct, I think it will still make life easier for everyone if we stick to doing migrations via the top level runtime only. At the minimum, it makes it a few clicks easier to track which migration went into which release.

That being said, i don't think this needs an issue. If this is already release/deployed, then too late. Else, we can only change it until the next release, so better make a PR directly rather than an issue that could get lost :p

ordian wrote this answer on 2022-01-14

If this is already release/deployed, then too late

I believe it will be released in 0.9.16, which is not cut yet.
I opened this issue as a good-first-issue for new joiners.

ECJ222 wrote this answer on 2022-01-17

Can I take on this issue?

ordian wrote this answer on 2022-01-17

Can I take on this issue?

please do!

ECJ222 wrote this answer on 2022-01-26

Hi @ordian,

Please could you write a short description of this issue?

ordian wrote this answer on 2022-01-27

I'm going to close the issue, because we already branched off for the next release and it doesn't make sense to change it in the version after next because the migration will not run anymore.

More Details About Repo
Owner Name paritytech
Repo Name polkadot
Full Name paritytech/polkadot
Language Rust
Created Date 2018-08-09
Updated Date 2022-09-27
Star Count 6266
Watcher Count 479
Fork Count 1387
Issue Count 590

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
CRLF is not supported when parsing frontmatter 4 2022-09-13 2022-09-17
run.dlang.io times out when using "all dmd compilers" 3 2021-08-26 2022-09-05
[Feature Request] Allow search in app installed and updates 1 2022-05-30 2022-09-18
[Feature Request] Display Min and Target SDK in app details 2 2022-05-30 2022-09-27
[Feature Request] Add history of download and installation/update 0 2022-06-01 2022-09-25
Github action not pulling Zenodo data 3 2021-12-01 2022-03-23
MUFC-Bournemouth game 2016 0 2021-08-22 2022-08-31
[major] "new centering modes that fix the long-standing problem with yaw affecting pitch and vice versa" is broken only now for me 2 2021-09-22 2022-08-30
Issue with pylsp (No such file or directory) 5 2021-10-31 2022-09-21
Generate boilerplate of custom egg inside a non-.g file. 0 2021-07-18 2022-07-23
sessionState.getDownloaded() value exceeds the size of the torrent to be downloaded. 7 2021-02-07 2022-09-04
Issues with `setup_theme` command on Windows OS 2 2022-02-27 2022-09-17
Support nested formats 1 2021-09-11 2022-08-16
zarr does not like attrs added by intake-esm 2 2021-02-18 2022-09-13
how can change the bias parameter in hand-written model? 3 2021-03-21 2022-09-15
TypedPropertyRector throws PHPStan\ShouldNotHappenException: Cannot create PHPStan\Type\UnionType 3 2021-12-15 2022-08-27
Regex support in sender/recipient_canonical maps 0 2022-08-14 2022-09-25
Add locale support for Romanian 5 2015-04-18 2022-09-02
Apple Cinema Display 27" working with 50% brightness or less with Dockstation Dell WD15 1 2021-12-06 2022-09-14
Azuracast does not install 2 2021-12-16 2022-09-29
[Segment Tree] Searching for the first element greater than a given amount (My code) 2 2022-08-06 2022-09-02
question/ntr: Perimenopause and postmenopause 5 2022-07-22 2022-08-31
Typo in definition of Cardiac myxoma 1 2022-07-25 2022-08-31
“blobsaver” is damaged and can’t be opened. You should move it to the Trash. 2 2021-05-22 2022-05-03
.must does not return error exit code for failing commands 2 2021-05-13 2022-09-24
Squares are off by 1px 1 2021-08-06 2022-09-20
Symfony 6.0 2 2021-12-14 2022-01-05
PyTeal Examples - Asset.py and Security_Token.py 1 2022-01-11 2022-09-15
自动运行脚本里的docker命令无权限执行 0 2021-01-20 2022-09-25
[Home Screen updates - Inbox] Inbox minor UI glitches fixes 0 2022-04-20 2022-07-26
Easier Way to Clean Unhealthy Instances from Ring 4 2021-12-16 2022-09-19
Watchpack Error (watcher): Error: EMFILE: too many open files 3 2020-11-28 2022-09-29
Increase local timeout for wsmanfault / restart 4 2021-06-07 2022-09-17
Azure / sonic-mgmt repo: not able to run any test due to error 0 2021-10-28 2022-09-19
Session cookie disappears after login or logout 1 2021-11-06 2022-09-29
phone can't get camera 9 2020-08-13 2022-08-06
Get warning about batching not configured when it is actually configured 4 2020-04-06 2022-09-12
[Bug]Fix retain cycle issue 2 2021-08-27 2022-08-30
DynamoDbExtensionContext information lacks of the Class being read/wrote 7 2021-08-02 2022-09-24
[App]: UI summary differs from json summary 7 2022-03-16 2022-09-25
thehive.service script in systemd issue 1 2021-12-01 2022-07-20
Added column with fulltext index with `ADD COLUMN` leads to a table with plain index 0 2021-09-15 2022-09-19
Nerd font support 4 2020-07-17 2022-01-04
The extension would only work when opening a c file 1 2022-03-03 2022-09-22
[Feature] Extend tsconfig and babel configuration 4 2021-06-10 2022-08-29
[BUG] - CF Templates from Examples fail if Region doesn't support arm Lambda Functions 1 2022-04-04 2022-08-29
antd.variable.css 中重复定义 --ant-primary-color 1 2022-08-04 2022-09-15
translate/v3: TestListGlossaries failed 3 2021-11-01 2022-09-04
Hamburger menu not opening, input fields have no borders (older model iPhones) 0 2022-02-18 2022-09-15
Cannot reference MAUI-Blazor project from another MAUI-Blazor project on iOS 11 2021-11-23 2022-09-17