Skip to content

Commit 087ea03

Browse files
Do not enforce PoV size hard limit in config (#5887)
Quoting @bkchr (from [here](#5334 (comment))): > That the hardcoded limit is used there again, is IMO not correct. The `max_pov_size` should be controlled by the `HostConfiguration` and not limited by some "random" constant. This PR aims to change the hard limit to a not-so-random constant, allowing more room for maneuvering in the future.
1 parent 383180a commit 087ea03

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

polkadot/runtime/parachains/src/configuration.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use polkadot_parachain_primitives::primitives::{
2929
use polkadot_primitives::{
3030
ApprovalVotingParams, AsyncBackingParams, Balance, ExecutorParamError, ExecutorParams,
3131
NodeFeatures, SessionIndex, LEGACY_MIN_BACKING_VOTES, MAX_CODE_SIZE, MAX_HEAD_DATA_SIZE,
32-
MAX_POV_SIZE, ON_DEMAND_MAX_QUEUE_MAX_SIZE,
32+
ON_DEMAND_MAX_QUEUE_MAX_SIZE,
3333
};
3434
use sp_runtime::{traits::Zero, Perbill, Percent};
3535

@@ -46,6 +46,10 @@ use polkadot_primitives::SchedulerParams;
4646

4747
const LOG_TARGET: &str = "runtime::configuration";
4848

49+
// This value is derived from network layer limits. See `sc_network::MAX_RESPONSE_SIZE` and
50+
// `polkadot_node_network_protocol::POV_RESPONSE_SIZE`.
51+
const POV_SIZE_HARD_LIMIT: u32 = 16 * 1024 * 1024;
52+
4953
/// All configuration of the runtime with respect to paras.
5054
#[derive(
5155
Clone,
@@ -310,7 +314,7 @@ pub enum InconsistentError<BlockNumber> {
310314
MaxCodeSizeExceedHardLimit { max_code_size: u32 },
311315
/// `max_head_data_size` exceeds the hard limit of `MAX_HEAD_DATA_SIZE`.
312316
MaxHeadDataSizeExceedHardLimit { max_head_data_size: u32 },
313-
/// `max_pov_size` exceeds the hard limit of `MAX_POV_SIZE`.
317+
/// `max_pov_size` exceeds the hard limit of `POV_SIZE_HARD_LIMIT`.
314318
MaxPovSizeExceedHardLimit { max_pov_size: u32 },
315319
/// `minimum_validation_upgrade_delay` is less than `paras_availability_period`.
316320
MinimumValidationUpgradeDelayLessThanChainAvailabilityPeriod {
@@ -377,7 +381,7 @@ where
377381
})
378382
}
379383

380-
if self.max_pov_size > MAX_POV_SIZE {
384+
if self.max_pov_size > POV_SIZE_HARD_LIMIT {
381385
return Err(MaxPovSizeExceedHardLimit { max_pov_size: self.max_pov_size })
382386
}
383387

polkadot/runtime/parachains/src/configuration/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ fn invariants() {
210210
);
211211

212212
assert_err!(
213-
Configuration::set_max_pov_size(RuntimeOrigin::root(), MAX_POV_SIZE + 1),
213+
Configuration::set_max_pov_size(RuntimeOrigin::root(), POV_SIZE_HARD_LIMIT + 1),
214214
Error::<Test>::InvalidNewValue
215215
);
216216

prdoc/pr_5887.prdoc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
2+
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json
3+
4+
title: "Set reasonable hard limit for PoV size config value"
5+
6+
doc:
7+
- audience:
8+
- Runtime Dev
9+
- Runtime User
10+
description: |
11+
Sets the hard limit of the `max_pov_size` host configuration parameter to correspond to the
12+
actual network-related limit rather than to a random constant.
13+
14+
crates:
15+
- name: polkadot-runtime-parachains
16+
bump: patch
17+

0 commit comments

Comments
 (0)