Problem
Manual storage migration checks from the release checklist slow down release process and introduce possibility of a human error.
Context
In order to improve current release process (read more) we review the release checklist. There are several items related to the runtime storage migration:
- previously completed migrations are removed for any public (non-private/test) networks (check 1);
- no migrations added in the last release that would need to be removed (check 2);
- verify new migrations complete successfully, and the runtime state is correctly updated for any public (non-private/test) networks (check 3);
These checks are manual and I believe can have an alternative automated solution.
A release engineer (anyone who leads a particular release) might have a little context of old and new migrations within the runtimes. The engineer must check where (networks) the last runtime builds were applied and get the full context of all new migrations.
It might take a lot of time within the release process. As a result the check might be ignored and not work.
Proposal 1, idempotent migrations
First two checks can be dropped with the rule to include only idempotent migrations into the runtime. This would mean that any migration included in a runtime can be run multiple times and result will be always the same.
Frame already provides supporting tools to write such migrations: StorageVersion storage key, GetStorageVersion trait.
Runtime owners will need to verify new migrations during PR reviews and a note can be left to guide contributors (example).
This will be a general solution, any exception for a particular release is possible and should be led by an owner.
Proposal 2, automated tests for migrations
The third check can be dropped if we treat migrations as common functionality (ex. dispatchable call). An engineer (owner) should test migrations during development and provide an automation tests (unit / integration).
There are some additional tools provided by frame to automate and check correctness of a state: pre_upgrade and post_upgrade hooks.
This will be a general solution, the owner if required checks migration results during the release process or/and after the deployment.
Problem
Manual storage migration checks from the release checklist slow down release process and introduce possibility of a human error.
Context
In order to improve current release process (read more) we review the release checklist. There are several items related to the runtime storage migration:
These checks are manual and I believe can have an alternative automated solution.
A release engineer (anyone who leads a particular release) might have a little context of old and new migrations within the runtimes. The engineer must check where (networks) the last runtime builds were applied and get the full context of all new migrations.
It might take a lot of time within the release process. As a result the check might be ignored and not work.
Proposal 1, idempotent migrations
First two checks can be dropped with the rule to include only idempotent migrations into the runtime. This would mean that any migration included in a runtime can be run multiple times and result will be always the same.
Frame already provides supporting tools to write such migrations: StorageVersion storage key, GetStorageVersion trait.
Runtime owners will need to verify new migrations during PR reviews and a note can be left to guide contributors (example).
This will be a general solution, any exception for a particular release is possible and should be led by an owner.
Proposal 2, automated tests for migrations
The third check can be dropped if we treat migrations as common functionality (ex. dispatchable call). An engineer (owner) should test migrations during development and provide an automation tests (unit / integration).
There are some additional tools provided by frame to automate and check correctness of a state: pre_upgrade and post_upgrade hooks.
This will be a general solution, the owner if required checks migration results during the release process or/and after the deployment.