Fix the max domain block weight usage #3212
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
close #3193
In main, the domain runtime uses a MAX value as the max block weight because even though we have a target max domain block weight the actual total domain block weight is probabilistic, which causes issues when calculating the weight usage and remaining weight in block, etc, see #3193 for more detail.
This PR fixes the issue by using a realistic value as the max block weight in the domain runtime instead of the MAX value. To workaround the probabilistic domain block weight, it introduces a customized
check_weight
extension, which is the same as the upstream one except themax_block
weight limit check is removed (the alternative is to continue using the MAX value in thecheck_weight
extension but a realistic value in other places but it is too hack and a lot of redundant code).Note this PR replaces the upstream
check_weight
extension with the customized one in a few more places in the EVM domain runtime, and it also fixes a minor issue about accounting thebase_extrinsic
weight in the bundle weight check.Code contributor checklist: