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

Update claims pallet to FRAME v2 #3032

Merged
3 commits merged into from
Jun 12, 2021
Merged

Conversation

shaunxw
Copy link
Contributor

@shaunxw shaunxw commented May 16, 2021

Part of #2882

Converts the Claims 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.

So users of the Claims 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 Claims pallet.

Comment on lines +151 to +152
#[pallet::constant]
type Prefix: Get<&'static [u8]>;
Copy link
Contributor Author

@shaunxw shaunxw May 16, 2021

Choose a reason for hiding this comment

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

Here introduced a metadata difference compared to FRAME v1 version. The constant type should be &[u8], however there is no way to change the type for metadata(if I didn't missing any v2 new syntax). Need to wait for paritytech/substrate#8827 being solved.

Copy link
Member

@shawntabrizi shawntabrizi May 16, 2021

Choose a reason for hiding this comment

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

does this metadata change really matter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The change will make Prefix type as & 'static[u8]. Not sure if polkadotjs handles this type, and if not, I think it would result a createTypes error(which would probably break apps). @jacogr could you please help to confirm?

Copy link
Contributor Author

@shaunxw shaunxw May 17, 2021

Choose a reason for hiding this comment

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

I just checked CI. Yes there's a createType error, and polkadotjs API can't be initialized because of it https://gitlab.parity.io/parity/polkadot/-/jobs/928510 (Line 198)

2021-05-16 15:57:58 REGISTRY: Unable to resolve type &'static[u8], it will fail on construction
2021-05-16 15:57:58 API/INIT: Error: FATAL: Unable to initialize the API: createType(&'static[u8]):: Cannot construct unknown type &'static[u8]

Copy link
Contributor

@jacogr jacogr May 18, 2021

Choose a reason for hiding this comment

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

polkadot-js/api#3545

In general, and really not getting in the way here (which probably means I am), but I have mixed feelings about this PR -

  1. It needs to be done, since we want all converted
  2. It is absolutely a nightmare to test this end-to-end to ensure nothing has been broken (so if something does break, this becomes a support horror)
  3. It is not very active (most have claimed), but when used it just need to work flawlessly

So all-in-all, needs to be done, but not quite seeing the overall benefit since there is no heavy traffic to it. I'm almost in the "if it ain't broke, don't fix it" camp here :)

EDIT: On 2 above, generally actually have to get the W3F guys to test this one end-to-end

@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. labels May 16, 2021
@KiChjang KiChjang mentioned this pull request May 23, 2021
9 tasks
@shawntabrizi
Copy link
Member

bot merge

@ghost
Copy link

ghost commented Jun 12, 2021

Trying merge.

@ghost ghost merged commit c8b3f11 into paritytech:master Jun 12, 2021
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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