Skip to content

Commit

Permalink
Merge branch 'stable2407' into backport-6459-to-stable2407
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorPopelyaev authored Dec 3, 2024
2 parents c9712fa + c29cf6e commit 545b10e
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 12 deletions.
7 changes: 4 additions & 3 deletions polkadot/runtime/parachains/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +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-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 }
Expand Down
10 changes: 7 additions & 3 deletions polkadot/runtime/parachains/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,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};

Expand All @@ -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,
Expand Down Expand Up @@ -310,7 +314,7 @@ pub enum InconsistentError<BlockNumber> {
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 {
Expand Down Expand Up @@ -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 })
}

Expand Down
2 changes: 1 addition & 1 deletion polkadot/runtime/parachains/src/configuration/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Test>::InvalidNewValue
);

Expand Down
16 changes: 16 additions & 0 deletions prdoc/pr_6603.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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: Always provide main protocol name in litep2p responses

doc:
- audience: [ Node Dev, Node Operator ]
description: |
This PR aligns litep2p behavior with libp2p. Previously, litep2p network backend
would provide the actual negotiated request-response protocol that produced a
response message. After this PR, only the main protocol name is reported to other
subsystems.

crates:
- name: sc-network
bump: patch
17 changes: 17 additions & 0 deletions prdoc/pr_6674.prdoc
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ impl RequestResponseProtocol {
&mut self,
peer: litep2p::PeerId,
request_id: RequestId,
fallback: Option<litep2p::ProtocolName>,
_fallback: Option<litep2p::ProtocolName>,
response: Vec<u8>,
) {
match self.pending_inbound_responses.remove(&request_id) {
Expand All @@ -335,10 +335,7 @@ impl RequestResponseProtocol {
response.len(),
);

let _ = tx.send(Ok((
response,
fallback.map_or_else(|| self.protocol.clone(), Into::into),
)));
let _ = tx.send(Ok((response, self.protocol.clone())));
self.metrics.register_outbound_request_success(started.elapsed());
},
}
Expand Down

0 comments on commit 545b10e

Please sign in to comment.