referrerpolicy=no-referrer-when-downgrade

polkadot_runtime_parachains/configuration/migration/
v6.rs

1// Copyright (C) Parity Technologies (UK) Ltd.
2// This file is part of Polkadot.
3
4// Polkadot is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8
9// Polkadot is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12// GNU General Public License for more details.
13
14// You should have received a copy of the GNU General Public License
15// along with Polkadot.  If not, see <http://www.gnu.org/licenses/>.
16
17//! Contains the V6 storage definition of the host configuration.
18
19use crate::configuration::{Config, Pallet};
20use alloc::vec::Vec;
21use frame_support::pallet_prelude::*;
22use frame_system::pallet_prelude::BlockNumberFor;
23
24use polkadot_primitives::{AsyncBackingParams, Balance, ExecutorParams, SessionIndex};
25
26#[derive(codec::Encode, codec::Decode, Debug, Clone)]
27pub struct V6HostConfiguration<BlockNumber> {
28	pub max_code_size: u32,
29	pub max_head_data_size: u32,
30	pub max_upward_queue_count: u32,
31	pub max_upward_queue_size: u32,
32	pub max_upward_message_size: u32,
33	pub max_upward_message_num_per_candidate: u32,
34	pub hrmp_max_message_num_per_candidate: u32,
35	pub validation_upgrade_cooldown: BlockNumber,
36	pub validation_upgrade_delay: BlockNumber,
37	pub async_backing_params: AsyncBackingParams,
38	pub max_pov_size: u32,
39	pub max_downward_message_size: u32,
40	pub hrmp_max_parachain_outbound_channels: u32,
41	pub hrmp_max_parathread_outbound_channels: u32,
42	pub hrmp_sender_deposit: Balance,
43	pub hrmp_recipient_deposit: Balance,
44	pub hrmp_channel_max_capacity: u32,
45	pub hrmp_channel_max_total_size: u32,
46	pub hrmp_max_parachain_inbound_channels: u32,
47	pub hrmp_max_parathread_inbound_channels: u32,
48	pub hrmp_channel_max_message_size: u32,
49	pub executor_params: ExecutorParams,
50	pub code_retention_period: BlockNumber,
51	pub parathread_cores: u32,
52	pub parathread_retries: u32,
53	pub group_rotation_frequency: BlockNumber,
54	pub chain_availability_period: BlockNumber,
55	pub thread_availability_period: BlockNumber,
56	pub scheduling_lookahead: u32,
57	pub max_validators_per_core: Option<u32>,
58	pub max_validators: Option<u32>,
59	pub dispute_period: SessionIndex,
60	pub dispute_post_conclusion_acceptance_period: BlockNumber,
61	pub no_show_slots: u32,
62	pub n_delay_tranches: u32,
63	pub zeroth_delay_tranche_width: u32,
64	pub needed_approvals: u32,
65	pub relay_vrf_modulo_samples: u32,
66	pub pvf_checking_enabled: bool,
67	pub pvf_voting_ttl: SessionIndex,
68	pub minimum_validation_upgrade_delay: BlockNumber,
69}
70
71impl<BlockNumber: Default + From<u32>> Default for V6HostConfiguration<BlockNumber> {
72	fn default() -> Self {
73		Self {
74			async_backing_params: AsyncBackingParams {
75				max_candidate_depth: 0,
76				allowed_ancestry_len: 0,
77			},
78			group_rotation_frequency: 1u32.into(),
79			chain_availability_period: 1u32.into(),
80			thread_availability_period: 1u32.into(),
81			no_show_slots: 1u32.into(),
82			validation_upgrade_cooldown: Default::default(),
83			validation_upgrade_delay: 2u32.into(),
84			code_retention_period: Default::default(),
85			max_code_size: Default::default(),
86			max_pov_size: Default::default(),
87			max_head_data_size: Default::default(),
88			parathread_cores: Default::default(),
89			parathread_retries: Default::default(),
90			scheduling_lookahead: Default::default(),
91			max_validators_per_core: Default::default(),
92			max_validators: None,
93			dispute_period: 6,
94			dispute_post_conclusion_acceptance_period: 100.into(),
95			n_delay_tranches: Default::default(),
96			zeroth_delay_tranche_width: Default::default(),
97			needed_approvals: Default::default(),
98			relay_vrf_modulo_samples: Default::default(),
99			max_upward_queue_count: Default::default(),
100			max_upward_queue_size: Default::default(),
101			max_downward_message_size: Default::default(),
102			max_upward_message_size: Default::default(),
103			max_upward_message_num_per_candidate: Default::default(),
104			hrmp_sender_deposit: Default::default(),
105			hrmp_recipient_deposit: Default::default(),
106			hrmp_channel_max_capacity: Default::default(),
107			hrmp_channel_max_total_size: Default::default(),
108			hrmp_max_parachain_inbound_channels: Default::default(),
109			hrmp_max_parathread_inbound_channels: Default::default(),
110			hrmp_channel_max_message_size: Default::default(),
111			hrmp_max_parachain_outbound_channels: Default::default(),
112			hrmp_max_parathread_outbound_channels: Default::default(),
113			hrmp_max_message_num_per_candidate: Default::default(),
114			pvf_checking_enabled: false,
115			pvf_voting_ttl: 2u32.into(),
116			minimum_validation_upgrade_delay: 2.into(),
117			executor_params: Default::default(),
118		}
119	}
120}
121
122mod v6 {
123	use super::*;
124
125	#[frame_support::storage_alias]
126	pub(crate) type ActiveConfig<T: Config> =
127		StorageValue<Pallet<T>, V6HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
128
129	#[frame_support::storage_alias]
130	pub(crate) type PendingConfigs<T: Config> = StorageValue<
131		Pallet<T>,
132		Vec<(SessionIndex, V6HostConfiguration<BlockNumberFor<T>>)>,
133		OptionQuery,
134	>;
135}