We need to insert a lot of data to storage. In standalone version we can do it via System.SetStorage with sudo weight override. But in parachains this approach maybe can break our chain. What are the best practice for big parachain migration?
-
Can you describe roughly what this storage migration does?– pepyakinCommented Apr 8, 2022 at 12:19
-
Bulk insert new data to storage.– VeniaminCommented Apr 8, 2022 at 14:45
-
Can you elaborate on it more? As stated, the question can get good but generic answers. However, potentially there is a better solution for the particular problem.– pepyakinCommented Apr 8, 2022 at 15:06
-
Here is a relevant question - substrate.stackexchange.com/questions/1329/…– Werner SCommented Apr 9, 2022 at 9:29
-
For example we need to setup vestings for crowdloan contributions (around 50k inserts), can we do some kind of bulk insert, or it better to deploy new wasm with migration?– VeniaminCommented Apr 19, 2022 at 10:58
Add a comment
|
1 Answer
you can refact the huge runtime migration to an temporarily extrinsic which can be executed multiple times and each time just migrate part of the data which not exceed max weight in one block
-
We developed migration pallet. It stores whole big migration under one key and then every block in on_initialize hook it takes part of migration and stores it under right key. All transactions are disallowed (BaseFilter in system pallet) while migration is running, so state will be consistent– VeniaminCommented Apr 22, 2022 at 12:42
-