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.

Overweight on_runtime_upgrade could be problematic #10064

@ferrell-code

Description

@ferrell-code

<T as frame_system::Config>::BlockWeights::get().max_block

In the recent storage migrations of pallets (example above) we return the MAXIMUM_BLOCK_WEIGHT for the migrate() method. This creates a weird output when you migrate multiple instances in the runtime, example try-runtime output:

2021-10-18 19:34:55 TryRuntime_on_runtime_upgrade executed without errors. Consumed weight = 5500100000000, total weight = 500000000000 (11.0002)

My understanding is that in this case weight being greater than max-weight doesn't matter as it calls register_extra_weight_unchecked for on_runtime_upgrade (executes regardless of weight) and therefore weight is just a placeholder to ensure nothing else other than the storage migration will be executed that block.

But doesn't that mean that if a storage migration happened to take longer than a block to execute using on_runtime_upgrade() that would stop block production as it's weight is unchecked? I could be confused so any clarification would be helpful :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions