Skip to content

DecodeAll check for post_migrate hook #241

Closed
paritytech/substrate
#13013
@ggwpez

Description

@ggwpez

There are a few cases when migrations did not verify that the resulting state of a pallet is decodable with the new runtime.
This can easily happen when using StorageMap::translate since it just ignores un-decodable elements and carries them over into the new runtime.

We could add a check that tries to decode the whole state after a migration (or batch thereof) to verify that the state is not corrupted.
Sure there could still be un-decodable data in storage in the form of blobs (eg pallet-preimage) but decoding errors needs to be handled in these cases anyway. This would help but not completly solve with the introduction of BoundedVec.
Migrations still need to truncate any unbounded vectors or use WeakBoundedVec instead since otherwise someone could front-run the migration. cc @kianenigma

Metadata

Metadata

Assignees

Labels

I5-enhancementAn additional feature request.T1-FRAMEThis PR/Issue is related to core FRAME, the framework.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions