Skip to main content

Questions tagged [migration]

Related to runtime upgrades, a one time conversion of chain state.

Filter by
Sorted by
Tagged with
8 votes
2 answers
358 views

How to perform a large migration?

If I want to migrate the Balance::Locks to a new structure. Imagine there are millions of accounts in the storage. This is what I came out. Is this the right way? Split them into multiple blocks. If ...
AurevoirXavier's user avatar
  • 10.7k
7 votes
2 answers
127 views

How to identify node update storage migrations?

I am working on Substrate-based node upgrades. I stick to Polkadot releases and start from polkadot-v0.8.25 to the latest versions. While upgrading I need to make sure that I don’t miss any storage ...
Maksim Ramanenkau's user avatar
6 votes
1 answer
134 views

Parachain large migration best practices

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 ...
Veniamin's user avatar
5 votes
2 answers
61 views

Is there a canonical resource describing when migrations are needed

My understanding is that when anything about the storage type is changed for example the encoded type stored, the keys, prefix etc then a storage migration is required. But when else? Is there a ...
gatsey's user avatar
  • 183
5 votes
1 answer
175 views

Migrate keytype of StorageMap without breakin API

Assume we have a StorageMap MyMap of which we want to extend the type of the decoded keys from KeyTypeOld to an enum including the old type as well as a new one. Before pub type MyMap = StorageMap<...
William Freudenberger's user avatar
5 votes
2 answers
99 views

Where should pallet migrations be executed?

I have seen two methods of executing runtime migrations: Execute the migration code directly in the pallet's on_runtime_upgrade hook Create a struct and implement the OnRuntimeUpgrade trait. Include ...
sea212's user avatar
  • 549
5 votes
1 answer
57 views

using String in ink version 4

so I am migrating my contract from version 3 to 4 my goal is to use the open brush as well but we can not use the open brush in ink version 4 because it still needs the nightly features and Ink v4 ...
Rahul navgire's user avatar
5 votes
1 answer
259 views

Removal of storage prefix from database

I am currently writing a migration to remove a pallet and all its memory from our runtime. Unfortunately, I cannot manage to check for the existence of the pallet's prefix in the pre- and post upgrade ...
William Freudenberger's user avatar
5 votes
2 answers
437 views

Storage Migration Guide Using #[pallet::storage]

I am new to both substrate and rust so trying to educate myself. I've the read documentation for both and am now going through the various tutorials and guides. I'm currently on the Basic Storage ...
jpataylor's user avatar
  • 321
5 votes
1 answer
87 views

How to reset a pallet

I'm planning to reset a pallet. To do this, I've developed a migration process aimed at clearing all storage associated with the MyPallet key. Additionally, I've followed up by renaming the pallet. I'...
magecnion's user avatar
  • 244
5 votes
1 answer
71 views

How to determine if a parachain runtime migration is too big?

I want to write runtime storage migration for our parachain. This time it will scan large storage maps with more than 10k entries. This may results in very large PoV block size. I'm wondering what the ...
h4x3rotab's user avatar
  • 717
4 votes
1 answer
344 views

Testing a migration with `try-runtime`

I have written a migration for the phragmen pallet in Substrate and now I want to test it. I would want to use the current state of Kusama/Polkadot to make sure the migration works correctly. To ...
Szegoo's user avatar
  • 682
4 votes
2 answers
61 views

Need to migrate u32 to Vec<T::AccountId>

I have one storagemap which stores u32 values, now I need to migrate this to Vec<T::AccountId> How to do this?
Ajit's user avatar
  • 827
4 votes
1 answer
177 views

How do I fix "SpecVersionNeedsToIncrease" error?

I Just clone this https://github.com/OAK-Foundation/substrate-node-template/tree/nicks-v2 for storage migration. After launch on polkadot ,this error shows: I'm using following commands to run: ./...
Deepak Chaudhary's user avatar
4 votes
2 answers
224 views

How do I do a multi-block migration?

I noticed that my migration is too big and will take up more than one block. How do I do a multi-block migration?
Bruno's user avatar
  • 8,315
4 votes
2 answers
126 views

How to add storage migration in parachain?

I have successfully performed storage migration on standalone chain. But how to do this for parachain ? Like, How/what wasm should be upload of new version and Where Should I upload ? Is there any ...
Deepak Chaudhary's user avatar
4 votes
1 answer
68 views

Can't read storage item from migration script, however can read from polkadot.js.app

Here are the details, I need to do a storage migration for a pallet. I can read the storage item from the polkadot.js.app, as shown below: however, I can not read it from migration script(returned ...
Wenfeng Wang's user avatar
4 votes
0 answers
63 views

How to migrate blockchain data from Moonbeam network to a custom Substrate-based chain?

I deployed an ERC-721(NFT) contract on Moonbeam some time ago. Now I have added the NFT pallet to our Substrate-based chain. How can I migrate the data from the Moonbeam network chain data to our ...
Pankaj's user avatar
  • 2,021
3 votes
1 answer
128 views

Sync error while upgrading Polkadot SDK from 1.0 to 1.6

We're in the process of updating the Polimec runtime and node from the Polkadot SDK 1.0 to 1.6. We're doing the final tests before the merge and we are encountering an issue while syncing the ...
Leonardo Razovic's user avatar
3 votes
1 answer
80 views

Potential storage issue with try-runtime tool

Hey guys I'm seeing a weird thing with the following migration code: pub struct SomeMigration; impl OnRuntimeUpgrade for SomeMigration { fn on_runtime_upgrade() -> Weight { let ...
Georgi Zlatarev's user avatar
3 votes
2 answers
102 views

I'm getting some issue during storage migration

I'm trying to trigger the storage migration on polkadot UI for our parachain. I'm trying different types to do this but getting some issues: Type 1 : If I simply upload the wasm file from sudo > ...
Deepak Chaudhary's user avatar
3 votes
2 answers
147 views

How to write pallet rename data migration?

I want to rename one of our collective pallet instances to be visible in the PolkaddotJs App. I think the best option would be to migrate raw data. I assume that all pallet data has the same trie path ...
Dzmitry Lahoda's user avatar
3 votes
1 answer
110 views

Perform large migration between substrate versions

We want to perform a large migration on a chain composed with standard pallets ( balance, babe, ... ) to a most recent substrate tag which is polkadot-v0.9.18. Is there a way to call all the ...
Dubs's user avatar
  • 294
3 votes
1 answer
164 views

Encoded error while performing a storage migration

This is my first time migrating data, and I'd like to receive general guidance about what steps and command lines I need to use. I've been working with the node-template before to implement it in my ...
Didier M's user avatar
3 votes
1 answer
182 views

How to migrate from Kusama to Polkadot?

I want to migrate my production parachain from Kusama or Polkadot. How can I achieve this?
sea212's user avatar
  • 549
3 votes
1 answer
98 views

Should I do storage migration after remove fields from storage struct type?

I have a map storage, which stores structures. I've just removed a field from the structure, should I write storage migration codes for that? Could substrate work with existing values without a ...
Chino Chang's user avatar
3 votes
2 answers
46 views

Is it possible to bootstrap a parachain node from pre-existing solo chainstate?

Let's imagine a scenario where a team is running a substrate private network and have all their chainstate that they want to move to a parachain after acquiring a slot. My question is, when the team ...
Purple_Turtle's user avatar
3 votes
1 answer
144 views

Substrate `translate` function

I am trying to understand the usage of the translate function that is frequently used when writing migrations. Is this function only being used to do changes to some existing storage values(I don't ...
Szegoo's user avatar
  • 682
3 votes
1 answer
68 views

Solochain to Parachain Block Production Problem - "Discarding slot xxx, block production took too long"

The following is a current issue when migrating from a Solochain to a Parachain (presently as a test on the Rococo relay chain): On the Rococo chain, we are unable to produce new blocks - it is ...
Josh's user avatar
  • 425
3 votes
1 answer
80 views

Exported method `TryRuntime_on_runtime_upgrade` is not found

cargo run --features try-runtime try-runtime \ --execution Native \ --chain dev \ on-runtime-upgrade \ live \ --uri ws://xxxxxxxx I implemented try-runtime according to the ...
junyuan wei's user avatar
3 votes
0 answers
31 views

How to migrate / backup & restore ink smart contract storage?

Is there a way to backup ink smart contract storage and later restore on another chain? Lets say we have chain with 3 validators and deployed smart contract containing certain information in its ...
Alex 's user avatar
  • 83
3 votes
0 answers
82 views

Steps to import a parachain running in a production environment to test environment?

I am using export-state to copy a parachain running in production environment to development with all the configuration and blocks data. I am following these steps. Can any one please review the steps,...
Syed Kamran's user avatar
3 votes
1 answer
191 views

Export state of a running chain and run it as alice

Hello everyone, I'm trying to spin up a test chain(with imported real chain data) with alice(so I can start it from genesis and start producing blocks with --alice flag) and after dumping the state of ...
flipchan's user avatar
  • 369
2 votes
2 answers
386 views

How to export the current running chain data and import it in a new chain?

The use case is that maybe the existing chain has bricked down (not producing block anymore possibly due to no block having been produced in the past epoch), or I want to copy the current production ...
Jimmy Chu's user avatar
  • 185
2 votes
1 answer
124 views

Forked Parity pallet, didn't migrate storage, deployed to chain. How to clear original storage from the live chain?

We started a chain using pallet_collator_selection and later forked it. Both the original and the forked pallet use the LastAuthoredBlock StorageItem. We did not execute a storage migration from the ...
Garandor's user avatar
  • 121
2 votes
2 answers
78 views

Change "dmq_mqc_head" for a given parachain

Recently, I did a reset to a local relay-chain and re-added the parachains with their old context. One of those parachains has inbound downward messages which produces an invalid dmq_head and leads to ...
Rodrigo Quelhas's user avatar
2 votes
2 answers
68 views

Number of and writes of StorageMap drain

I was wondering about the number of reads and writes when draining a StorageMap which consists of n items. Is the answer (n, 1) or (n, n)?
0x5hmoo's user avatar
  • 189
2 votes
1 answer
207 views

Migrating storage without creating a new storage item

I am using Substrate V3 (using decl_storage) and have an existing storage defined like this: pub Foo get(fn get_foo) config(): map hasher(blake2_128_concat) u32 => H160; I would like to change ...
Nahu's user avatar
  • 347
2 votes
1 answer
66 views

Reclaim used space of a removed StorageItem on a live chain

I am changing the collator_selection pallet by removing the LastAuthoredBlock StorageItem and adding an unrelated one, so although the chain is live, no data migration is needed. What happens with the ...
Garandor's user avatar
  • 121
2 votes
1 answer
56 views

What happens if `on_runtime_upgrade` during migration fails?

In parachain context, imagine we have declared a migration within type Executvie where we want to migrate some state from pallet A to pallet B in on_runtime_upgrade. In the new wasm the pallet A gets ...
Kailai's user avatar
  • 383
2 votes
1 answer
101 views

Does changing an enum require a storage migration? What about `Error` and `Event`

Say I have instances of this enum stored on-chain: enum Enum { V0, V1, } And suppose now that I change the enum in some way: enum Enum { V0, V2, V1, } This is what the substrate ...
mkl's user avatar
  • 344
2 votes
1 answer
84 views

How can we restart the chain if it becomes stuck during data migration?

I performed a runtime upgrade on the chain, but due to a migration failure, the chain stopped producing blocks. The logs only show that the migration failed. When I attempt to restart the validators, ...
Pankaj's user avatar
  • 2,021
2 votes
1 answer
40 views

EVM solo to para migration on Genesis

I need to migrate the state of an EVM solochain (not substrate) into a Frontier-based parachain. The original chain has been running for a while with high activity, so the state is fairly big. I am ...
Bernardo Rodrigues's user avatar
2 votes
1 answer
73 views

Are pallet migrations triggered automatically by default or we need to pass each pallets migration explicitly in Executive Type?

Recently did a runtime upgrade on our node which broke all existing ink contracts. Later included the pallet contracts migration in Executive Type which fixed the issue. My impression was all runtime ...
lordofdalords's user avatar
2 votes
1 answer
109 views

How to selectively populate state from a snapshot of one chain onto another?

Goal To use a full snapshot at some block height of one chain and selectively pull in select parts of this state. Use cases Migrating state from another chain. Example: A snapshot of only assets ...
Nuke's user avatar
  • 1,842
2 votes
1 answer
65 views

Migrating to new code base

We have a prototype of substrate-based blockchain running with few nodes. After some time running and testing we came up with new version of code-base, which consists of the same runtime, pallets and ...
Yevhen V's user avatar
2 votes
0 answers
73 views

How to solve Failed to get runtime version issue?

I recently upgraded the chain from version 0.9.36 to 1.0.0. Following this update, when attempting to perform a runtime upgrade on the blockchain, I encountered an error that resulted in the chain no ...
Ajit's user avatar
  • 827
2 votes
1 answer
58 views

revert a chain migration

We executed a chain migration that was not intended ( it was already executed one time and was executed again 2 times ) https://github.com/paritytech/substrate/blob/polkadot-v0.9.18/frame/system/src/...
Dubs's user avatar
  • 294
2 votes
0 answers
38 views

Elections phragmen migration

I am working on Substrate-based node upgrades for solo-chain. I stick to Polkadot releases and during the upgrade from polkadot-release-v0.8.27 to polkadot-v0.8.28 I found a storage migration. This ...
Maksim Ramanenkau's user avatar
1 vote
1 answer
81 views

Querying events from storage migration

I'm currently attempting to perform a migration process that involves querying events emitted from a specific pallet. The objective of this migration is to extract relevant data from these events and ...
magecnion's user avatar
  • 244