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

Migrate node authorization pallet to FRAME v2 #8337

Merged
merged 7 commits into from
Mar 17, 2021
Merged

Conversation

kaichaosun
Copy link
Contributor

Related to #7882 #8293

@kaichaosun kaichaosun added A0-please_review Pull request needs code review. 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. labels Mar 12, 2021
@gui1117 gui1117 added B3-apinoteworthy and removed B0-silent Changes should not be mentioned in any release notes labels Mar 16, 2021
@gui1117
Copy link
Contributor

gui1117 commented Mar 16, 2021

⚠️ Breaking Change ⚠️

From checking upgrade guidelines

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

So users of the pallet must be careful about the name they used in construct_runtime!. Hence the runtime-migration label, which might not be needed depending on the configuration of the pallet.

Copy link
Contributor

@gui1117 gui1117 left a comment

Choose a reason for hiding this comment

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

looks good to me.

let sender = ensure_signed(origin)?;

ensure!(node.0.len() < T::MaxPeerIdLength::get() as usize, Error::<T>::PeerIdTooLong);
ensure!(Owners::<T>::contains_key(&node), Error::<T>::NotClaimed);
ensure!(Owners::<T>::get(&node) == sender, Error::<T>::NotOwner);
let pre_owner = Owners::<T>::get(&node).ok_or(Error::<T>::NotClaimed)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

I would have prefered to have a PR which only does the migration without any other changes, it would make it easier to review.

@gui1117 gui1117 requested a review from ascjones March 16, 2021 14:03
Copy link
Contributor

@ascjones ascjones left a comment

Choose a reason for hiding this comment

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

LGTM. Can you confirm the metadata pre and post migration is the same?

@kaichaosun
Copy link
Contributor Author

@ascjones Here is the diff: https://www.diffchecker.com/spxo73UK
The difference is expected, which is a small refactor and @thiolliere also mentioned in the comments.

@gui1117 gui1117 merged commit abd39a8 into master Mar 17, 2021
@gui1117 gui1117 deleted the node-auth-frame-v2 branch March 17, 2021 13:32
hirschenberger pushed a commit to hirschenberger/substrate that referenced this pull request Apr 14, 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. C1-low PR touches the given topic and has a low impact on builders.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants