polkadot-sdk icon indicating copy to clipboard operation
polkadot-sdk copied to clipboard

Introduce `MaxParachainBlockWeight` and related functionality

Open bkchr opened this issue 1 month ago • 4 comments

This pull request introduces MaxParachainBlockWeight to calculate the max weight per parachain block. This is a preparation for Block Bundling which requires that the maximum block weight is dynamic. Block bundling requires a dynamic maximum block weight because it bundles multiple blocks into one PoV. Each PoV gets 2s of execution time and 10MiB of proof size. These resources need to be split up between all the blocks of one PoV. This doesn't require the weight to be dynamic. However, it gets complicated when a transaction should be applied that requires more resources than what one of these blocks can provide, e.g. for doing a runtime upgrade. In this case MaxParachainBlockWeight supports to increase the block weight of one block to take up the weight of the full PoV. The feature will not only be useful for things like runtime upgrade, but also could enable users to pay for running some huge contracts or whatever. For more information, please refer to the docs provided in the code of this pull request.

For MaxParachainBlockWeight to work correctly, it provides a pre-inherent hook and a transaction extension. Both are required to track the weight correctly.

bkchr avatar Nov 13 '25 16:11 bkchr

Seems quite complex to me, maybe we should do a tentative deployment to Westend from this branch with the extension included before merging.

I don't want to directly deploy this to production. :) Not sure what you want to test there on Westend. I have also more tests in another branch where zombienet tests are running based on this stuff.

bkchr avatar Nov 14 '25 12:11 bkchr

/cmd fmt

bkchr avatar Nov 14 '25 18:11 bkchr

/cmd fmt

tdimitrov avatar Dec 04 '25 12:12 tdimitrov

All GitHub workflows were cancelled due to failure one of the required jobs. Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/20105940184 Failed job name: cargo-clippy