6

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?

5
  • Can you describe roughly what this storage migration does?
    – pepyakin
    Apr 8, 2022 at 12:19
  • Bulk insert new data to storage.
    – Veniamin
    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.
    – pepyakin
    Apr 8, 2022 at 15:06
  • Here is a relevant question - substrate.stackexchange.com/questions/1329/…
    – Werner S
    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?
    – Veniamin
    Apr 19, 2022 at 10:58

1 Answer 1

2

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

2
  • 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
    – Veniamin
    Apr 22, 2022 at 12:42
  • can you share the link to this migration pallet?
    – flipchan
    Jul 7, 2022 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.