-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Introduce BlockWeightsForAsyncBacking and MAXIMUM_BLOCK_WEIGHT_FOR_ASYNC_BACKING to bridges primitives
#2966
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,6 +54,14 @@ const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(constants::WEIGHT_REF_TI | |
| .saturating_div(2) | ||
| .set_proof_size(polkadot_primitives::MAX_POV_SIZE as u64); | ||
|
|
||
| /// We allow for 2 seconds of compute with a 6 second average block. | ||
| /// | ||
| /// This is a copy-paste of system parachain runtimes switched to async backing (https://github.com/paritytech/polkadot-sdk/pull/2949). | ||
bkontur marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const MAXIMUM_BLOCK_WEIGHT_FOR_ASYNC_BACKING: Weight = Weight::from_parts( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes no sense? Either the runtime is running using async backing or not. This means you should update
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Runtime's Here we try to keep bridges primitives in sync.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm okay. |
||
| constants::WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2), | ||
| polkadot_primitives::MAX_POV_SIZE as u64, | ||
| ); | ||
|
|
||
| /// All cumulus bridge hubs assume that about 5 percent of the block weight is consumed by | ||
| /// `on_initialize` handlers. This is used to limit the maximal weight of a single extrinsic. | ||
| /// | ||
|
|
@@ -91,6 +99,25 @@ parameter_types! { | |
| }) | ||
| .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO) | ||
| .build_or_panic(); | ||
|
|
||
| pub BlockWeightsForAsyncBacking: limits::BlockWeights = limits::BlockWeights::builder() | ||
| .base_block(BlockExecutionWeight::get()) | ||
| .for_class(DispatchClass::all(), |weights| { | ||
| weights.base_extrinsic = ExtrinsicBaseWeight::get(); | ||
| }) | ||
| .for_class(DispatchClass::Normal, |weights| { | ||
| weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT_FOR_ASYNC_BACKING); | ||
| }) | ||
| .for_class(DispatchClass::Operational, |weights| { | ||
| weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT_FOR_ASYNC_BACKING); | ||
| // Operational transactions have an extra reserved space, so that they | ||
| // are included even if block reached `MAXIMUM_BLOCK_WEIGHT_FOR_ASYNC_BACKING`. | ||
| weights.reserved = Some( | ||
| MAXIMUM_BLOCK_WEIGHT_FOR_ASYNC_BACKING - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT_FOR_ASYNC_BACKING, | ||
| ); | ||
| }) | ||
| .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO) | ||
| .build_or_panic(); | ||
| } | ||
|
|
||
| /// Public key of the chain account that may be used to verify signatures. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.