A0-4022: Enable pallet contract migrations v12 to v15 #1610
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
polkadot-1.2.0
has a pallet contracts storage version 15, whereas the current Testnet has 12. There are 3 migrations to be done:v13
- due to change Contracts Add deposit for dependencies paritytech/substrate#14079 storage mapContractInfoOf
receives a new field calleddelegate_dependencies
. This is a map that stores all contract account that calls this account via low-level functiondelegate_call
(e.g. used by contract upgrade scenario). Whatv13
migration does is just adds emptydelegate_dependencies
field to eachContractInfoOf
element (31 175 on AlephZero Testnet).v14
- due to change Contracts: migrate to fungible traits paritytech/substrate#14020 pallet contract start to use Holds API over deprecated Reserve API. In practice, it changes nothing, other than that for each account that is the owner of the uploaded code, there will beBalances.Holds
set for all such accounts - holds as total still use reserved funds fromSystem.Accounts
.v14
migration iterates over all members ofCodeInfoOf
map. (6 502 on AlephZero Testnet).v15
- due to change Contracts remove deposit accounts paritytech/substrate#14589 that essentially reverts logic contracts: Don't rely on reserved balances keeping an account alive paritytech/substrate#13369 and v10 pallet contract migration, that addeddeposit_account
field toContractInfoOf
. The reason it was needed in the first place was the change introduced in Substrate 0.9.42 version that required ED to be present on free funds.v15
migration iterates over all elements of ContractInfoOf map and:Testing
This change needs to be tested on feature net to measure impact on a chain (prediction is that those will be significant migrations, at least that heavy as in 12 release). To address that, we limited multi block migration weight to 1/4 of max block weight,