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

Migrate pallet-transaction-payment to new pallet attribute macro #9087

Merged
9 commits merged into from
Jun 25, 2021
Merged

Migrate pallet-transaction-payment to new pallet attribute macro #9087

9 commits merged into from
Jun 25, 2021

Conversation

koushiro
Copy link
Contributor

@koushiro koushiro commented Jun 11, 2021

Part of #7882

Migrate the pallet-transaction-payment to the new pallet attribute macro.

⚠️ 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.

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.

cc @shawntabrizi @thiolliere

polkadot and kusama use TransactionPayment as pallet name, thus no need for migration

polkadot companion: paritytech/polkadot#3267

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
@koushiro koushiro changed the title Migrate pallet-transaciont-payment to new pallet attribute macro Migrate pallet-transaction-payment to new pallet attribute macro Jun 11, 2021
@shawntabrizi shawntabrizi added 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. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit A0-please_review Pull request needs code review. labels Jun 12, 2021
@gui1117
Copy link
Contributor

gui1117 commented Jun 14, 2021

⚠️ 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.

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.

polkadot and kusama use TransactionPayment for pallet name, so no need for migration there.

pub(super) type StorageVersion<T: Config> = StorageValue<_, Releases, ValueQuery>;

#[pallet::genesis_config]
pub struct GenesisConfig<T> {
Copy link
Contributor

Choose a reason for hiding this comment

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

I removed the generic here as it is not needed

(but also I think we should remove the GenesisConfig completly and remove the Releases storage. If people wonder about which version their pallet is, then they should look at the pallet version stored.
Note that substrate node sand polkadot/kusama nodes don't run this genesis config (it is not configured in construct_runtime).
But we can do in a follow-up PR)

@gui1117
Copy link
Contributor

gui1117 commented Jun 23, 2021

some tests needs fix.

EDIT: I think it is about having proper mock environment in some tests.

koushiro added 2 commits June 24, 2021 12:06
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
@gui1117 gui1117 requested a review from KiChjang June 24, 2021 09:12
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.

Mostly syntax changes; if it compiles, it works.

@KiChjang
Copy link
Contributor

bot merge

@ghost
Copy link

ghost commented Jun 25, 2021

Trying merge.

@ghost ghost merged commit df50122 into paritytech:master Jun 25, 2021
@koushiro koushiro deleted the migrate-pallet-transaction-payment branch June 25, 2021 04:07
athei pushed a commit that referenced this pull request Jun 25, 2021
…9087)

* Migrate pallet-transaciont-payment to new pallet attribute macro

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* remove generic from genesis config

* fix test

* fix tests

* fix deprecated

* fix tests

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
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. 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. 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.

4 participants