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

pallet-contracts v9 storage migration can result in huge PoV #12908

@Dinonard

Description

@Dinonard

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Description of bug

Hello,

as part of adding indeterministic instructions support for off-chain #12469, a storage migration function was added (link).

Migration is functionally very simple but doesn't take into account the possible large PoV size.
In case we have many contracts, it will explode.

For the case of Shibuya testnet, where there are 609 contract codes deployed, the PoV of the upgrade ends up being:
PoV size { header: 0.220703125kb, extrinsics: 3.5537109375kb, storage_proof: 23371.24609375kb }

The migration should be broken into multiple steps to limit the PoV size.


It would also be a good practice (maybe another issue ticket?) to more correctly estimate the PoV size in try-runtime, if possible.
Right now, I've received:
TryRuntime_on_runtime_upgrade executed without errors. Consumed weight = (77100000000 ps, 0 byte), total weight = (500000000000 ps, 5242880 byte) (15.42 %, 0.00 %). Tbh, I totally missed that it was 0 before.
Maybe something like this:

weight.saturating_accrue(T::DbWeight::get().reads_writes(1, 1));
weight.saturating_accrue(Weight::from_proof_size(OldPrefabWasmModule::max_encoded_len()));
weight.saturating_accrue(Weight::from_proof_size(PrefabWasmModule::max_encoded_len()));

Steps to reproduce

Attempting try-runtime off Shibuya or perhaps even Contracts parachain (haven't tested this).

Metadata

Metadata

Assignees

Labels

J2-unconfirmedIssue might be valid, but it’s not yet known.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions