Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A0-4022: Enable pallet contract migrations v12 to v15 #1610

Merged
merged 4 commits into from
Feb 20, 2024

Conversation

Marcin-Radecki
Copy link
Contributor

@Marcin-Radecki Marcin-Radecki commented Feb 8, 2024

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 map ContractInfoOf receives a new field called delegate_dependencies. This is a map that stores all contract account that calls this account via low-level function delegate_call (e.g. used by contract upgrade scenario). What v13 migration does is just adds empty delegate_dependencies field to each ContractInfoOf 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 be Balances.Holds set for all such accounts - holds as total still use reserved funds from System.Accounts. v14 migration iterates over all members of CodeInfoOf 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 added deposit_account field to ContractInfoOf. 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:
    • decrease consumer counter for a deposit account,
    • transfers all balance of the deposit account to the contract account,
    • hold that balance on the contract account,
    • reap deposit account.

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,

@Marcin-Radecki Marcin-Radecki merged commit ebd98ce into release-13 Feb 20, 2024
59 checks passed
@Marcin-Radecki Marcin-Radecki deleted the A0-4022 branch February 20, 2024 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants