Skip to content

Commit

Permalink
[Backport] Add feature to allow Aura collator to use full PoV size (#…
Browse files Browse the repository at this point in the history
…5393) (#5507)

This PR introduces a feature that allows to optionally enable using the
full PoV size.

Technically, we're ready to enable it by default, but as corresponding
runtime changes have not been propagated to the system parachain
runtimes yet, doing so could put them at risk. On the other hand, there
are teams that could benefit from it right now, and it makes no sense
for them to wait for the fellowship release and everything.

---------

Co-authored-by: Andrei Sandu <[email protected]>
  • Loading branch information
s0me0ne-unkn0wn and sandreim authored Aug 28, 2024
1 parent 0919abd commit c9e5cf1
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 15 deletions.
4 changes: 4 additions & 0 deletions cumulus/client/consensus/aura/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,7 @@ polkadot-node-subsystem.workspace = true
polkadot-node-subsystem.default-features = true
polkadot-overseer.workspace = true
polkadot-overseer.default-features = true

[features]
# Allows collator to use full PoV size for block building
full-pov-size = []
16 changes: 11 additions & 5 deletions cumulus/client/consensus/aura/src/collators/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,16 @@ where
.await
);

let allowed_pov_size = if cfg!(feature = "full-pov-size") {
validation_data.max_pov_size
} else {
// Set the block limit to 50% of the maximum PoV size.
//
// TODO: If we got benchmarking that includes the proof size,
// we should be able to use the maximum pov size.
validation_data.max_pov_size / 2
} as usize;

let maybe_collation = try_request!(
collator
.collate(
Expand All @@ -242,11 +252,7 @@ where
None,
(parachain_inherent_data, other_inherent_data),
params.authoring_duration,
// Set the block limit to 50% of the maximum PoV size.
//
// TODO: If we got benchmarking that includes the proof size,
// we should be able to use the maximum pov size.
(validation_data.max_pov_size / 2) as usize,
allowed_pov_size,
)
.await
);
Expand Down
16 changes: 11 additions & 5 deletions cumulus/client/consensus/aura/src/collators/lookahead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,18 +319,24 @@ where
)
.await;

let allowed_pov_size = if cfg!(feature = "full-pov-size") {
validation_data.max_pov_size
} else {
// Set the block limit to 50% of the maximum PoV size.
//
// TODO: If we got benchmarking that includes the proof size,
// we should be able to use the maximum pov size.
validation_data.max_pov_size / 2
} as usize;

match collator
.collate(
&parent_header,
&slot_claim,
None,
(parachain_inherent_data, other_inherent_data),
params.authoring_duration,
// Set the block limit to 50% of the maximum PoV size.
//
// TODO: If we got benchmarking that includes the proof size,
// we should be able to use the maximum pov size.
(validation_data.max_pov_size / 2) as usize,
allowed_pov_size,
)
.await
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,18 +350,24 @@ where
)
.await;

let allowed_pov_size = if cfg!(feature = "full-pov-size") {
validation_data.max_pov_size
} else {
// Set the block limit to 50% of the maximum PoV size.
//
// TODO: If we got benchmarking that includes the proof size,
// we should be able to use the maximum pov size.
validation_data.max_pov_size / 2
} as usize;

let Ok(Some(candidate)) = collator
.build_block_and_import(
&parent_header,
&slot_claim,
None,
(parachain_inherent_data, other_inherent_data),
authoring_duration,
// Set the block limit to 50% of the maximum PoV size.
//
// TODO: If we got benchmarking that includes the proof size,
// we should be able to use the maximum pov size.
(validation_data.max_pov_size / 2) as usize,
allowed_pov_size,
)
.await
else {
Expand Down
15 changes: 15 additions & 0 deletions prdoc/pr_5507.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json

title: Allow to enable full PoV size

doc:
- audience: Node Dev
description: |
A feature is introduced allowing a collator to enable full PoV size at compile time.
WARNING: To use this feature, security considerations must be understood and the latest
SDK version must be used.

crates:
- name: cumulus-client-consensus-aura
bump: minor

0 comments on commit c9e5cf1

Please sign in to comment.