Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the max domain block weight usage #3212

Merged
merged 6 commits into from
Nov 7, 2024
Merged

Fix the max domain block weight usage #3212

merged 6 commits into from
Nov 7, 2024

Conversation

NingLin-P
Copy link
Member

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 the max_block weight limit check is removed (the alternative is to continue using the MAX value in the check_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 the base_extrinsic weight in the bundle weight check.

Code contributor checklist:

It is the same as the upstream check_weight extension except the max_block weight limit check
is removed since there is only a target max block weight but the actual total block weight is
probabilistic

Signed-off-by: linning <[email protected]>
Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks good to me, just some minor typos.

domains/pallets/domain-check-weight/src/lib.rs Outdated Show resolved Hide resolved
domains/runtime/evm/src/lib.rs Outdated Show resolved Hide resolved
@NingLin-P NingLin-P added this pull request to the merge queue Nov 7, 2024
Merged via the queue into main with commit c163775 Nov 7, 2024
8 checks passed
@NingLin-P NingLin-P deleted the domain-max-weight branch November 7, 2024 12:26
@NingLin-P NingLin-P added need to audit This change needs to be audited audit-P3 Low audit priority labels Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
audit-P3 Low audit priority need to audit This change needs to be audited
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The max domain block weight usage
2 participants