Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove old storage version and set new default #932

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gregdhill
Copy link
Member

@gregdhill gregdhill commented Feb 16, 2023

Prevents the capacity migration from re-running and removes the completed v1 to v6 migration.

#[pallet::pallet]
#[pallet::generate_store(trait Store)]
#[pallet::storage_version(STORAGE_VERSION)]
Copy link
Member

Choose a reason for hiding this comment

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

What does this do, exactly? Does it set it to 0 when building genesis, or does it set the default to 1? What I'm saying is, kintsugi and interlay might actually get set to 0..

Also, the whole situation with palletVersion/storageVersion is a bit of a mess. I thought we'd use palletVersion, since that storage item already exists on polkadotjs. But then I found this pr, which changed the old palletVersion to storageVersion. It turns out that the palletVersion is no longer used and that the item shown by polkadotjs is actualy the storageVersion: polkadot-js/api#546.

Copy link
Member

Choose a reason for hiding this comment

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

@sander2 & @gregdhill


When performing an upgrade, we need to obtain the values for current_storage_version and on_chain_storage_version.

During the genesis build, we set the value for on_chain_storage_version, and in the macro, we set the value for current_storage_version.

For the runtime upgrade:

  • Retrieve both values and compare them.
  • In the code before the runtime upgrade Increment current_storage_version by one ie is the STORAGE_VERSION constant value.
  • If the migration is successful, increment on_chain_storage_version by one as well.
  • Both the on_chain_storage_version and current_storage_version should be the same if the runtime upgrade is successful.
  • But since we already have performed multiple runtime upgrades we need to make sure that on_chain_storage_version matches the current_storage_version. PR 1106 fixes it.

References:


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants