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

Migrate pallet-session and session-historical to pallet attribute macro #8815

Conversation

stanly-johnson
Copy link
Contributor

Part of #7882.

Converts the session and session-historical pallet to the new pallet attribute macro introduced in #6877.

Following the upgrade guidelines here: https://crates.parity.io/frame_support/attr.pallet.html#upgrade-guidelines.

⚠️ Breaking Change ⚠️

From https://crates.parity.io/frame_support/attr.pallet.html#checking-upgrade-guidelines

storages now use PalletInfo for module_prefix instead of the one given to decl_storage: Thus any use of this pallet in construct_runtime! should be careful to update name in order not to break storage or to upgrade storage (moreover for instantiable pallet). If pallet is published, make sure to warn about this breaking change.

@KiChjang KiChjang added A0-please_review Pull request needs code review. B3-apinoteworthy 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 labels May 15, 2021
@KiChjang
Copy link
Contributor

@stanly-johnson Please use tabs in the modified files per our coding standards. Thanks!

Copy link
Contributor

@KiChjang KiChjang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Migration looks good, but I can still see spaces with some of these files.

frame/session/src/historical/mod.rs Show resolved Hide resolved
frame/session/src/historical/mod.rs Outdated Show resolved Hide resolved
frame/session/src/historical/offchain.rs Outdated Show resolved Hide resolved
frame/session/src/lib.rs Show resolved Hide resolved
frame/session/src/lib.rs Show resolved Hide resolved
frame/session/src/lib.rs Outdated Show resolved Hide resolved
frame/session/src/lib.rs Outdated Show resolved Hide resolved
@KiChjang
Copy link
Contributor

CI is spitting out errors:

error: use of deprecated type alias `pallet_session::Module`: use `Pallet` instead
   --> frame/staking/src/lib.rs:657:4
    |
657 |         <pallet_session::Module<T>>::disable(validator)
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `-D deprecated` implied by `-D warnings`
error: use of deprecated type alias `pallet_session::Module`: use `Pallet` instead
   --> frame/staking/src/lib.rs:661:4
    |
661 |         <pallet_session::Module<T>>::validators()
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^
error: use of deprecated type alias `pallet_session::historical::Module`: use `Pallet` instead
   --> frame/staking/src/lib.rs:665:4
    |
665 |         <pallet_session::historical::Module<T>>::prune_up_to(up_to);
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors

}

decl_storage! {
trait Store for Module<T: Config> as Session {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change. The historical pallet will no longer use the Session storage.

This needs a storage migration.

@thiolliere thiolliere self-requested a review June 16, 2021 13:37
@stale
Copy link

stale bot commented Jul 16, 2021

Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it. label Jul 16, 2021
@shawntabrizi shawntabrizi removed the A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it. label Jul 16, 2021
@shawntabrizi
Copy link
Contributor

Still needs a storage migration

@stale
Copy link

stale bot commented Aug 15, 2021

Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it. label Aug 15, 2021
@stale stale bot closed this Aug 29, 2021
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. A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it. 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants