From 69de8dd54b5d4b2e840fb273c1f025d1e34972f2 Mon Sep 17 00:00:00 2001 From: s0me0ne-unkn0wn <48632512+s0me0ne-unkn0wn@users.noreply.github.com> Date: Wed, 16 Oct 2024 14:12:03 +0200 Subject: [PATCH 1/3] [stable2409] Backport #5887 (#6082) --- polkadot/runtime/parachains/Cargo.toml | 8 ++++---- .../runtime/parachains/src/configuration.rs | 10 +++++++--- .../parachains/src/configuration/tests.rs | 2 +- prdoc/pr_6082.prdoc | 17 +++++++++++++++++ 4 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 prdoc/pr_6082.prdoc diff --git a/polkadot/runtime/parachains/Cargo.toml b/polkadot/runtime/parachains/Cargo.toml index d5956c2d53f5..ba0a240bfa0c 100644 --- a/polkadot/runtime/parachains/Cargo.toml +++ b/polkadot/runtime/parachains/Cargo.toml @@ -18,10 +18,10 @@ scale-info = { features = ["derive"], workspace = true } serde = { features = ["alloc", "derive"], workspace = true } derive_more = { workspace = true, default-features = true } bitflags = { workspace = true } -sp-api.workspace = true -sp-inherents.workspace = true -sp-std.workspace = true -sp-io.workspace = true + +sp-api = { workspace = true } +sp-inherents = { workspace = true } +sp-io = { workspace = true } sp-runtime = { features = ["serde"], workspace = true } sp-session.workspace = true sp-staking = { features = ["serde"], workspace = true } diff --git a/polkadot/runtime/parachains/src/configuration.rs b/polkadot/runtime/parachains/src/configuration.rs index bffeab4a0d21..6b920780b5d2 100644 --- a/polkadot/runtime/parachains/src/configuration.rs +++ b/polkadot/runtime/parachains/src/configuration.rs @@ -28,7 +28,7 @@ use polkadot_parachain_primitives::primitives::{ use polkadot_primitives::{ ApprovalVotingParams, AsyncBackingParams, Balance, ExecutorParamError, ExecutorParams, NodeFeatures, SessionIndex, LEGACY_MIN_BACKING_VOTES, MAX_CODE_SIZE, MAX_HEAD_DATA_SIZE, - MAX_POV_SIZE, ON_DEMAND_MAX_QUEUE_MAX_SIZE, + ON_DEMAND_MAX_QUEUE_MAX_SIZE, }; use sp_runtime::{traits::Zero, Perbill, Percent}; use sp_std::prelude::*; @@ -46,6 +46,10 @@ use polkadot_primitives::vstaging::SchedulerParams; const LOG_TARGET: &str = "runtime::configuration"; +// This value is derived from network layer limits. See `sc_network::MAX_RESPONSE_SIZE` and +// `polkadot_node_network_protocol::POV_RESPONSE_SIZE`. +const POV_SIZE_HARD_LIMIT: u32 = 16 * 1024 * 1024; + /// All configuration of the runtime with respect to paras. #[derive( Clone, @@ -310,7 +314,7 @@ pub enum InconsistentError { MaxCodeSizeExceedHardLimit { max_code_size: u32 }, /// `max_head_data_size` exceeds the hard limit of `MAX_HEAD_DATA_SIZE`. MaxHeadDataSizeExceedHardLimit { max_head_data_size: u32 }, - /// `max_pov_size` exceeds the hard limit of `MAX_POV_SIZE`. + /// `max_pov_size` exceeds the hard limit of `POV_SIZE_HARD_LIMIT`. MaxPovSizeExceedHardLimit { max_pov_size: u32 }, /// `minimum_validation_upgrade_delay` is less than `paras_availability_period`. MinimumValidationUpgradeDelayLessThanChainAvailabilityPeriod { @@ -377,7 +381,7 @@ where }) } - if self.max_pov_size > MAX_POV_SIZE { + if self.max_pov_size > POV_SIZE_HARD_LIMIT { return Err(MaxPovSizeExceedHardLimit { max_pov_size: self.max_pov_size }) } diff --git a/polkadot/runtime/parachains/src/configuration/tests.rs b/polkadot/runtime/parachains/src/configuration/tests.rs index dad8b6458e10..0d20399e471b 100644 --- a/polkadot/runtime/parachains/src/configuration/tests.rs +++ b/polkadot/runtime/parachains/src/configuration/tests.rs @@ -210,7 +210,7 @@ fn invariants() { ); assert_err!( - Configuration::set_max_pov_size(RuntimeOrigin::root(), MAX_POV_SIZE + 1), + Configuration::set_max_pov_size(RuntimeOrigin::root(), POV_SIZE_HARD_LIMIT + 1), Error::::InvalidNewValue ); diff --git a/prdoc/pr_6082.prdoc b/prdoc/pr_6082.prdoc new file mode 100644 index 000000000000..3ee6ac05a11a --- /dev/null +++ b/prdoc/pr_6082.prdoc @@ -0,0 +1,17 @@ +# 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: "Set reasonable hard limit for PoV size config value" + +doc: + - audience: + - Runtime Dev + - Runtime User + description: | + Sets the hard limit of the `max_pov_size` host configuration parameter to correspond to the + actual network-related limit rather than to a random constant. + +crates: + - name: polkadot-runtime-parachains + bump: patch + From 3c3dcfc8c5a39ae30e6dc74700e8fff4f54ba7bb Mon Sep 17 00:00:00 2001 From: Dmitry Sinyavin Date: Wed, 27 Nov 2024 13:52:45 +0100 Subject: [PATCH 2/3] Rename prdoc --- prdoc/pr_6672.prdoc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 prdoc/pr_6672.prdoc diff --git a/prdoc/pr_6672.prdoc b/prdoc/pr_6672.prdoc new file mode 100644 index 000000000000..3ee6ac05a11a --- /dev/null +++ b/prdoc/pr_6672.prdoc @@ -0,0 +1,17 @@ +# 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: "Set reasonable hard limit for PoV size config value" + +doc: + - audience: + - Runtime Dev + - Runtime User + description: | + Sets the hard limit of the `max_pov_size` host configuration parameter to correspond to the + actual network-related limit rather than to a random constant. + +crates: + - name: polkadot-runtime-parachains + bump: patch + From 66209f1960f3266e7c5655b8946d1a621e31955d Mon Sep 17 00:00:00 2001 From: Dmitry Sinyavin Date: Wed, 27 Nov 2024 13:53:02 +0100 Subject: [PATCH 3/3] Remove old prdoc --- prdoc/pr_6082.prdoc | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 prdoc/pr_6082.prdoc diff --git a/prdoc/pr_6082.prdoc b/prdoc/pr_6082.prdoc deleted file mode 100644 index 3ee6ac05a11a..000000000000 --- a/prdoc/pr_6082.prdoc +++ /dev/null @@ -1,17 +0,0 @@ -# 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: "Set reasonable hard limit for PoV size config value" - -doc: - - audience: - - Runtime Dev - - Runtime User - description: | - Sets the hard limit of the `max_pov_size` host configuration parameter to correspond to the - actual network-related limit rather than to a random constant. - -crates: - - name: polkadot-runtime-parachains - bump: patch -