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

feat: migrate crab backing to use pallet! #560

Merged
merged 7 commits into from
Mar 31, 2021

Conversation

songtianyi
Copy link
Contributor

@songtianyi songtianyi commented Mar 23, 2021

Part of #561.

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

Upgrade guidelines used.

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

Common notes

  • their Trait is renamed Config
  • all storages are now generic over T
  • module prefix used by storages is now the PalletInfo::name given by construct_runtime.
  • no longer RawEvent.

The metadata for CrabBacking before migration

   {
          name: CrabBacking,
          storage: {
            prefix: DarwiniaCrabBacking,
            items: []
          },
          calls: null,
          events: null,
          constants: [
            {
              name: ModuleId,
              type: ModuleId,
              value: da/crabk,
              documentation: []
            }
          ],
          errors: [],
          index: 34
        },

The metadata for CrabBacking after migration

  {
          name: DarwiniaCrabBacking,
          storage: {
            prefix: DarwiniaCrabBacking,
            items: []
          },
          calls: null,
          events: null,
          constants: [
            {
              name: ModuleId,
              type: ModuleId,
              value: da/crabk,
              documentation: []
            }
          ],
          errors: [],
          index: 34
        },
       

@songtianyi songtianyi marked this pull request as draft March 23, 2021 06:54
@AurevoirXavier AurevoirXavier self-requested a review March 23, 2021 11:55
@songtianyi songtianyi marked this pull request as ready for review March 24, 2021 06:05
@songtianyi songtianyi force-pushed the songtianyi-producal-marco-based-crab-issue-backing branch from 5ba5bd3 to c8ba4bd Compare March 24, 2021 06:31
@hackfisher hackfisher added the BK-Storage [Break] This changes storage; next release should be major. label Mar 24, 2021
@hackfisher
Copy link
Contributor

hackfisher commented Mar 24, 2021

To keep the crab backing pallet storage prefix unchanged,

  • ensure that the name of the pallet given to construct_runtime! is the same as the name the pallet was giving to decl_storage, update it to DarwiniaCrabBacking .

  • or do a storage migration from the old prefix used to the new prefix used.

CrabBacking: darwinia_crab_backing::{Module, Storage, Config<T>} = 34,

@songtianyi
Copy link
Contributor Author

paritytech/substrate#8391

it seems no solution to specify the storge prefix yet.
I'm trying to do this in contruct_runtime!

@songtianyi songtianyi force-pushed the songtianyi-producal-marco-based-crab-issue-backing branch from c8ba4bd to 1818292 Compare March 24, 2021 10:09
@songtianyi
Copy link
Contributor Author

paritytech/substrate#8391

it seems no solution to specify the storge prefix yet.
I'm trying to do this in contruct_runtime!

rename CrabBacking to DarwiniaCrabBacking, so the module name changed

@songtianyi songtianyi changed the title feat: migrate crab->backing from declarative macro to procedural macro feat: migrate crab backing and issuing to pallet! Mar 25, 2021
@songtianyi songtianyi force-pushed the songtianyi-producal-marco-based-crab-issue-backing branch from 35e8612 to 046acba Compare March 25, 2021 07:25
@AurevoirXavier AurevoirXavier added the P-Low [Priority] Low label Mar 25, 2021
@hackfisher
Copy link
Contributor

hackfisher commented Mar 26, 2021

@songtianyi Compilation failed and suggest to submit pull requests for each pallet migration.

@songtianyi songtianyi marked this pull request as draft March 26, 2021 05:24
@songtianyi songtianyi force-pushed the songtianyi-producal-marco-based-crab-issue-backing branch from 046acba to c48831e Compare March 26, 2021 10:17
@songtianyi songtianyi changed the title feat: migrate crab backing and issuing to pallet! feat: migrate crab backing to use pallet! Mar 26, 2021
@songtianyi songtianyi marked this pull request as ready for review March 26, 2021 11:02
@AurevoirXavier AurevoirXavier marked this pull request as draft March 28, 2021 19:38
@AurevoirXavier
Copy link
Member

Could you follow #568's style?

@songtianyi songtianyi marked this pull request as ready for review March 29, 2021 07:42
@AurevoirXavier
Copy link
Member

AurevoirXavier commented Mar 31, 2021

No storage in this pallet. Migration is not needed.

The storage prefix changes doesn't affect anything.

@AurevoirXavier AurevoirXavier removed the BK-Storage [Break] This changes storage; next release should be major. label Mar 31, 2021
@hackfisher hackfisher merged commit 61436d5 into master Mar 31, 2021
@hackfisher hackfisher deleted the songtianyi-producal-marco-based-crab-issue-backing branch March 31, 2021 10:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P-Low [Priority] Low
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants