Improve handling of unset `StorageVersion` (#13417)
* Improve handling of unset `StorageVersion` When a user is forgetting to set the storage version in a pallet and calls `current_storage_version` to compare it against the `on_chain_storage_version` it will now fail to compile the code. Before the pallet macro just returned `StorageVersion::default()` for `current_storage_version` leading to potential issues with migrations. Besides that it also checks in `post_upgrade` that the pallet storage version was upgraded and thus, no migration was missed. * Use correct `Cargo.lock` * Fixes * Fix test * Update frame/support/test/tests/pallet.rs * Ensure we don't set a storage version when the pallet is missing the attribute * Fix merge conflict * Update frame/support/procedural/src/pallet/expand/hooks.rs Co-authored-by:Roman Useinov <roman.useinov@gmail.com> * Update frame/support/procedural/src/pallet/expand/hooks.rs Co-authored-by:
Roman Useinov <roman.useinov@gmail.com> * Fix compilation * Do not run everything with `try-runtime` * Fix test * Apply suggestions from code review Co-authored-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix `no-metadata-docs` --------- Co-authored-by:
Roman Useinov <roman.useinov@gmail.com> Co-authored-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: parity-processbot <>
parent
0e55bace
Showing
- substrate/Cargo.lock 1 addition, 0 deletionssubstrate/Cargo.lock
- substrate/frame/support/procedural/src/pallet/expand/hooks.rs 53 additions, 0 deletions...trate/frame/support/procedural/src/pallet/expand/hooks.rs
- substrate/frame/support/procedural/src/pallet/expand/pallet_struct.rs 13 additions, 7 deletions...ame/support/procedural/src/pallet/expand/pallet_struct.rs
- substrate/frame/support/src/dispatch.rs 26 additions, 12 deletionssubstrate/frame/support/src/dispatch.rs
- substrate/frame/support/src/migrations.rs 30 additions, 4 deletionssubstrate/frame/support/src/migrations.rs
- substrate/frame/support/src/traits.rs 2 additions, 2 deletionssubstrate/frame/support/src/traits.rs
- substrate/frame/support/src/traits/metadata.rs 21 additions, 1 deletionsubstrate/frame/support/src/traits/metadata.rs
- substrate/frame/support/test/Cargo.toml 8 additions, 2 deletionssubstrate/frame/support/test/Cargo.toml
- substrate/frame/support/test/tests/derive_no_bound.rs 47 additions, 16 deletionssubstrate/frame/support/test/tests/derive_no_bound.rs
- substrate/frame/support/test/tests/pallet.rs 124 additions, 20 deletionssubstrate/frame/support/test/tests/pallet.rs
- substrate/frame/support/test/tests/pallet_ui/compare_unset_storage_version.rs 27 additions, 0 deletions...ort/test/tests/pallet_ui/compare_unset_storage_version.rs
- substrate/frame/support/test/tests/pallet_ui/compare_unset_storage_version.stderr 7 additions, 0 deletions...test/tests/pallet_ui/compare_unset_storage_version.stderr
- substrate/frame/support/test/tests/runtime_metadata.rs 1 addition, 1 deletionsubstrate/frame/support/test/tests/runtime_metadata.rs
- substrate/frame/system/src/extensions/check_non_zero_sender.rs 3 additions, 3 deletions...rate/frame/system/src/extensions/check_non_zero_sender.rs
- substrate/primitives/api/Cargo.toml 1 addition, 1 deletionsubstrate/primitives/api/Cargo.toml
- substrate/primitives/api/proc-macro/Cargo.toml 2 additions, 1 deletionsubstrate/primitives/api/proc-macro/Cargo.toml
- substrate/scripts/ci/gitlab/pipeline/test.yml 2 additions, 2 deletionssubstrate/scripts/ci/gitlab/pipeline/test.yml
Please register or sign in to comment