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

Migrate assets pallet to new macros #7984

Merged
12 commits merged into from
Feb 4, 2021

Conversation

dvdplm
Copy link
Contributor

@dvdplm dvdplm commented Jan 26, 2021

Converts the Assets pallet to the new pallet attribute macro introduced in #6877.

Part of #7882.

Upgrade guidelines used.

⚠️ 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: 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 Assets 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 Assets pallet.

@github-actions github-actions bot added the A3-in_progress Pull request is in progress. No review needed at this stage. label Jan 26, 2021
@dvdplm dvdplm added A7-needspolkadotpr C1-low PR touches the given topic and has a low impact on builders. labels Jan 26, 2021
@dvdplm dvdplm requested a review from ascjones January 26, 2021 10:55
@dvdplm dvdplm self-assigned this Jan 26, 2021
@dvdplm dvdplm marked this pull request as ready for review January 26, 2021 13:52
@github-actions github-actions bot 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 Jan 26, 2021
@dvdplm
Copy link
Contributor Author

dvdplm commented Feb 1, 2021

@ascjones Do you know how we should handle the deprecation of RawEvent? Should we still provide the type alias or rather try to track down uses and update (or both)?

@gui1117
Copy link
Contributor

gui1117 commented Feb 3, 2021

@ascjones Do you know how we should handle the deprecation of RawEvent? Should we still provide the type alias or rather try to track down uses and update (or both)?

we can also have a deprecated alias. This could help other to migrate.

before this PR raw event was:

enum RawEvent<AccountId, Balance, AssetId> {...};
type Event<C: Config> = RawEvent<C::AccounId,...>;

Maybe we can now do:

#[deprecated(...)]
type RawEvent<T> = Event<T>;

But at the same time this is a breaking RawEvent as its generic are different

frame/assets/src/lib.rs Outdated Show resolved Hide resolved
dvdplm and others added 3 commits February 4, 2021 08:45
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
@dvdplm
Copy link
Contributor Author

dvdplm commented Feb 4, 2021

But at the same time this is a breaking RawEvent as its generic are different

Right, so people would get a compiler error and also the deprecation message? That seems good.

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 🚀

@gui1117
Copy link
Contributor

gui1117 commented Feb 4, 2021

bot merge

@ghost
Copy link

ghost commented Feb 4, 2021

Trying merge.

@ghost ghost merged commit 169b16f into master Feb 4, 2021
@ghost ghost deleted the dp-migrate-pallet-assets-to-new-procmacro branch February 4, 2021 11:23
@dvdplm
Copy link
Contributor Author

dvdplm commented Feb 4, 2021

@thiolliere I added the D1-runtime-migration label here but I don't think that is actually needed for pallet-assets (not used in Polkadot). Do you agree?

@gui1117
Copy link
Contributor

gui1117 commented Feb 4, 2021

@thiolliere I added the D1-runtime-migration label here but I don't think that is actually needed for pallet-assets (not used in Polkadot). Do you agree?

Yes I think it is better to have all the commit with potential need for migration labelled as such. It is useful for other builders

This pull request was closed.
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.

3 participants