Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Multi-stage pallet-contracts v9 migration#13063

Closed
Dinonard wants to merge 1 commit intoparitytech:masterfrom
Dinonard:feat/contracts-multi-stage-v9-migration
Closed

Multi-stage pallet-contracts v9 migration#13063
Dinonard wants to merge 1 commit intoparitytech:masterfrom
Dinonard:feat/contracts-multi-stage-v9-migration

Conversation

@Dinonard
Copy link
Contributor

@Dinonard Dinonard commented Jan 4, 2023

Summary

Using pallet-contracts V9 storage migration can result in huge PoV size, essentially stopping the block production.
This happened on Shibuya testnet and hardfork was required to recover it.

To bypass this limitation, a multi-stage storage migration logic was introduced (AstarNetwork/Astar#803).
This PR intends to add multi-stage migration logic directly into pallet-contracts, as requested in #12908.

Personally I'm not sure if code such as this should be part of pallet-contracts or core substrate.
I'm very much looking forward to review & comments 🙂 .

Solution Overview

A new extrinsic call migrate_storage is introduced.
Caller has to specify the version to which migration is being done and can specify max allowed weight limit of the migration.

Extrinsic call is used because unlike on_initialize or on_idle logic, it gives more control in case something goes wrong. If we specify too large weigh limit, our call would just get rejected (or we could override in the tx queue).

The migration step will execute migration logic until weight limit has been reached. At this point, migration state is saved and can be reused in the following call to resume migration from the point where it stopped.

OPEN QUESTIONS

  • Do we want to emit event in case of successful migration step?
  • Do we want to introduce a flag via which we can enable/disable the migrate_storage extrinsic call?
  • Not sure if PoV size calculation is correct (seems to be an overestimate) so that needs to be checked.

@Dinonard
Copy link
Contributor Author

Dinonard commented Jan 4, 2023

Hi @athei, here's my first proposal for the solution as discussed here.

I migrated solution used in Astar into pallet-contracts but expect things will need to be changed.

Before I start polishing and testing the PR, I'd like to get solution/design locked in.

@athei
Copy link
Member

athei commented Jan 17, 2023

I will look into this. Just have my hands full right now. Thanks for the PR.

@stale
Copy link

stale bot commented Feb 17, 2023

Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the A3-stale label Feb 17, 2023
@stale stale bot closed this Mar 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants