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

Explicit storage version for all pallets #1295

Open
wischli opened this issue Mar 31, 2023 · 2 comments
Open

Explicit storage version for all pallets #1295

wischli opened this issue Mar 31, 2023 · 2 comments
Assignees
Labels
I11-cleaning No mandatory issue that leave the repo more readable/organized P2-nice-to-have Issue is worth doing. Q1-easy Can be done by primarily duplicating and adapting code.

Comments

@wischli
Copy link
Contributor

wischli commented Mar 31, 2023

Description

So far, only pallet-loans has its underlying storage versioned. Other pallets do not. This is not troublesome as once we need to bump the storage version of a pallet, in case of a migration, the on_chain_storage_version will default to 0. However, we should not fallback to implicit versioning and rather make it explicit IMO.

  • Set StorageVersion via pallet macro for all pallets instead of custom StorageValue
const STORAGE_VERSION: StorageVersion = StorageVersion::new(0);

#[pallet::pallet]
#[pallet::generate_store(pub(super) trait Store)]
#[pallet::storage_version(STORAGE_VERSION)]

Research/based on

Substrate

How will this affect the code base

Less "magic"

What are foreseen obstacles or hurdles to overcome?

None

@wischli wischli added Q1-easy Can be done by primarily duplicating and adapting code. P2-nice-to-have Issue is worth doing. I11-cleaning No mandatory issue that leave the repo more readable/organized labels Mar 31, 2023
@wischli wischli mentioned this issue Mar 31, 2023
3 tasks
@wischli wischli self-assigned this May 2, 2023
@wischli
Copy link
Contributor Author

wischli commented May 2, 2023

I will soon™️ tackle this.

@wischli
Copy link
Contributor Author

wischli commented Jul 7, 2023

This will be mandatory sooner or later as querying an unset StorageVersion panics since v0.9.43 instead of defaulting to 0.

paritytech/substrate#13417

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I11-cleaning No mandatory issue that leave the repo more readable/organized P2-nice-to-have Issue is worth doing. Q1-easy Can be done by primarily duplicating and adapting code.
Projects
None yet
Development

No branches or pull requests

1 participant