-
Notifications
You must be signed in to change notification settings - Fork 378
Contracts: Use RuntimeUpgrade hooks instead of Hooks::on_runtime_upgrade #2570
Conversation
1004e35
to
e4c4423
Compare
The background here is that we want to upgrade |
e4c4423
to
481c29d
Compare
481c29d
to
c1d0523
Compare
Note:
Should we get rid of them in this PR? |
I am not entirely sure we need some reviews here. |
This is being printed because the pallets declare a on runtime upgrade. |
Since we've touched the DMP pallet migration here, we may also want to include the DMP Migration struct into all of the runtimes that uses the DMP pallet, so that they get the right storage version. |
@bkchr anything else blocking here? if not can you ✅ 🙏 |
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.
Didn't we already executed the migrations for almost all chains?
cumulus_pallet_parachain_system::migration::Migration<Runtime>, | ||
cumulus_pallet_xcmp_queue::migration::Migration<Runtime>, | ||
cumulus_pallet_dmp_queue::migration::Migration<Runtime>, |
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.
We probably already have applied these migrations?
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.
but isn't is good practice to keep it here for next time we update these chains?
Sorry for not having said this earlier, but I did not thought of this before. Basically you don't want to carry around all the migrations that were ever written. For 3 migrations it probably doesn't make such a big difference, but at some point you will see an impact on the size of the wasm file, which is bad. Because you will pay for useless code size. So, the best would actually be to split up all the |
The only exception to that is the DMP one; we've touched the storage version there, so I think it's a good idea to leave it there as we did bump the storage version. |
gotcha, so should I undo all changes that don't touch the chain my team owns (contracts-rococo). All teams willing to upgrade their chain should just run try-runtime and fix all the errors themself, then once the upgrade is done , they can adjust the migration, to drop what's not necessary for the next upgrade. This is what the new design unlock right? The migration code is configured by the runtime instead of the pallet and leave the responsibility to the runtime to pick and choose the migrations that are needed, using try-runtime to ensure that everything is properly configured |
Fyi that's what we do now in our multiblock migration framework we are shipping soon (for pallets-contract), plus as a bonus we make sure at compile time that there are no versions missing (ie if you go from 9 -> 11, we ensure that you have v9,10,11) |
Yes |
Co-authored-by: Bastian Köcher <[email protected]>
removed all but our stuff, anyone that runs a migration on a chain should probably run try-runtime and fixed the errors. |
bot merge |
We are trying to upgrade
contracts-rococo
to the latest version, buttry-runtime
fails because some pallets do not export a struct that implementsOnRuntimeUpgrade
that we can pass toframe_executive::Executive
.This PR brings the following changes:
OnRuntimeUpgrade
structs for the palletscontracts-rococo
depends onSTORAGE_VERSION
for pallets that have aSTORAGE_VERSION
that does not match the one set by the migrationon_runtime_upgrade
hooks forcumulus_pallet_parachain_system
,cumulus_pallet_xcmp_queue
,cumulus_pallet_dmp_queue
(palletscontracts-rococo
depends on) and instead move these migrations to the runtime through frame_executiveDepends on paritytech/substrate#14045