-
Notifications
You must be signed in to change notification settings - Fork 754
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
Redundant weight subtraction #7002
Comments
If always 1/4 of the block is used for block initialization, this clearly needs to be removed from the
That looks like its valid. |
As I understood, normal extrinsics can only occupy 75% of the block (if we use with_sensible_defaults), and operational will be set to 25% of the block. And mandatory stuff such as block initializations doesn't have any limitations. With all of these constraints how come normal extrinsics can fill the entire block that makes it prevent other extrinsics fail inclusion? For me the constraints looks already fine without the substraction. |
For sure mandatory and block initialization can take more, but this is the problem. If always 30% is used by default in a block and you have configured normal transactions to take up to 75%, they will be able to fill the rest of the entire block. The weight of an entire block is fixed and the 75% will be taken from this fixed weight. |
Ok as far as I understood, then the average block initialization weight is a sort of an upper cap to let mandatory executions safely include in a block. And to prevent normal transactions fill the entire block, we subtract the average block init weight from the capacity. (In case of mandatory executions take more as expected) |
I can not really follow this thought. Mandatory execution are also for example inherents, which are probably not included in the average block initialization costs. But inherents actually should also be included there to prevent the issue of transactions being able to fill the entire block. CC @ggwpez
That is right :) |
The doc of
Dont know if the pool still operates like this, but it seems like a bit of a hack to me. Not sure if the TX pool still operates like this? |
Can you please elaborate? What would you do instead? |
My comment was a bit vague since i dont know how the TX pool handles this. I though if the runtime rejects an extrinsic for being overweight, then it does not stay in the pool: polkadot-sdk/substrate/client/basic-authorship/src/basic_authorship.rs Lines 488 to 489 in 311ea43
I guess the only way to decide this is to try to include them as first TX in a block. If that does not work then it should not be retried. |
Is there an existing issue?
Experiencing problems? Have you tried our Stack Exchange first?
Description of bug
Issue 1: Redundant Block Initialization Cost Subtraction
Title: Redundant subtraction of initialization costs from
max_extrinsic
weightsDescription:
The current implementation in
BlockWeightsBuilder::build()
subtracts the block initialization cost from each dispatch class'smax_extrinsic
weight. This appears to be redundant because:Current code:
This double accounting of initialization costs could unnecessarily restrict the maximum size of individual extrinsics.
Issue 2: Incorrect Base Extrinsic Weight Subtraction
Title:
max_extrinsic
incorrectly includesbase_extrinsic
subtraction, contradicting documentationDescription:
There's an inconsistency between the documentation and implementation regarding
base_extrinsic
handling inWeightsPerClass
:max_extrinsic
should NOT include thebase_extrinsic
cost:BlockWeightsBuilder::build()
subtractsbase_extrinsic
:This leads to double-counting of the base cost because:
Unexpected Scenario
For example, when a substrate node that consists frontier, and the maximum block gas limit is set to 50,000,000 gas. Due to these cost subtractions, eventually the maximum gas limit for a single transaction can only consume 43,333,333 gas. Which means, even though that a maximum value is set, it can't even reach it. If a transaction's gas limit is set higher than 43,333,333 it responds with an error,
exceeds block gas limit
Steps to reproduce
No response
The text was updated successfully, but these errors were encountered: