-
Notifications
You must be signed in to change notification settings - Fork 744
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
migrations: prevent accidentally using unversioned migrations instead of VersionedMigration
#3835
migrations: prevent accidentally using unversioned migrations instead of VersionedMigration
#3835
Conversation
VersionedMigration
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks very much for this! Just some minor comments.
…dastansam/polkadot-sdk into feat/unchecked-on-runtime-upgrade
/tip medium |
@liamaharon A referendum for a medium (80 DOT) tip was successfully submitted for @dastansam (16FqwPZ8GRC5U5D4Fu7W33nA55ZXzXGWHwmbnE1eT6pxuqcT on polkadot). |
The referendum has appeared on Polkassembly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah actually could you please make one more change, to the single-block-migration
example?
We no longer need to wrap the Migration in a mod version_unchecked
.
…dastansam/polkadot-sdk into feat/unchecked-on-runtime-upgrade
Head branch was pushed to by a user without write access
The CI pipeline was cancelled due to failure one of the required jobs. |
I think the normal |
e542796
… of `VersionedMigration` (#3835) closes #1324 #### Problem Currently, it is possible to accidentally use inner unversioned migration instead of `VersionedMigration` since both implement `OnRuntimeUpgrade`. #### Solution With this change, we make it clear that value of `Inner` is not intended to be used directly. It is achieved by bounding `Inner` to new trait `UncheckedOnRuntimeUpgrade`, which has the same interface (except `unchecked_` prefix) as `OnRuntimeUpgrade`. #### `try-runtime` functions Since developers can implement `try-runtime` for `Inner` value in `VersionedMigration` and have custom logic for it, I added the same `try-runtime` functions to `UncheckedOnRuntimeUpgrade`. I looked for a ways to not duplicate functions, but couldn't find anything that doesn't significantly change the codebase. So I would appreciate If you have any suggestions to improve this cc @liamaharon @xlc polkadot address: 16FqwPZ8GRC5U5D4Fu7W33nA55ZXzXGWHwmbnE1eT6pxuqcT --------- Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
… of `VersionedMigration` (paritytech#3835) closes paritytech#1324 #### Problem Currently, it is possible to accidentally use inner unversioned migration instead of `VersionedMigration` since both implement `OnRuntimeUpgrade`. #### Solution With this change, we make it clear that value of `Inner` is not intended to be used directly. It is achieved by bounding `Inner` to new trait `UncheckedOnRuntimeUpgrade`, which has the same interface (except `unchecked_` prefix) as `OnRuntimeUpgrade`. #### `try-runtime` functions Since developers can implement `try-runtime` for `Inner` value in `VersionedMigration` and have custom logic for it, I added the same `try-runtime` functions to `UncheckedOnRuntimeUpgrade`. I looked for a ways to not duplicate functions, but couldn't find anything that doesn't significantly change the codebase. So I would appreciate If you have any suggestions to improve this cc @liamaharon @xlc polkadot address: 16FqwPZ8GRC5U5D4Fu7W33nA55ZXzXGWHwmbnE1eT6pxuqcT --------- Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
closes #1324
Problem
Currently, it is possible to accidentally use inner unversioned migration instead of
VersionedMigration
since both implementOnRuntimeUpgrade
.Solution
With this change, we make it clear that value of
Inner
is not intended to be used directly. It is achieved by boundingInner
to new traitUncheckedOnRuntimeUpgrade
, which has the same interface (exceptunchecked_
prefix) asOnRuntimeUpgrade
.try-runtime
functionsSince developers can implement
try-runtime
forInner
value inVersionedMigration
and have custom logic for it, I added the sametry-runtime
functions toUncheckedOnRuntimeUpgrade
. I looked for a ways to not duplicate functions, but couldn't find anything that doesn't significantly change the codebase. So I would appreciate If you have any suggestions to improve thiscc @liamaharon @xlc
polkadot address: 16FqwPZ8GRC5U5D4Fu7W33nA55ZXzXGWHwmbnE1eT6pxuqcT