mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 19:37:56 +00:00
Parachains configuration.rs FrameV2 (#3516)
* migration * genesis build correctly * migrate runtimes * add genesis builds * expose GenesisBuild * chainspec migration * fmt * check before insert * Reduce visibility of storage items to crate Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
@@ -524,7 +524,7 @@ fn westend_staging_testnet_config_genesis(wasm_binary: &[u8]) -> westend::Genesi
|
||||
sudo: westend::SudoConfig {
|
||||
key: endowed_accounts[0].clone(),
|
||||
},
|
||||
parachains_configuration: westend::ParachainsConfigurationConfig {
|
||||
configuration: westend::ConfigurationConfig {
|
||||
config: default_parachains_host_configuration(),
|
||||
},
|
||||
paras: Default::default(),
|
||||
@@ -733,7 +733,7 @@ fn kusama_staging_testnet_config_genesis(wasm_binary: &[u8]) -> kusama::GenesisC
|
||||
},
|
||||
vesting: kusama::VestingConfig { vesting: vec![] },
|
||||
treasury: Default::default(),
|
||||
parachains_configuration: kusama::ParachainsConfigurationConfig {
|
||||
configuration: kusama::ConfigurationConfig {
|
||||
config: default_parachains_host_configuration(),
|
||||
},
|
||||
gilt: Default::default(),
|
||||
@@ -977,7 +977,7 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime::
|
||||
paras: vec![],
|
||||
},
|
||||
hrmp: Default::default(),
|
||||
parachains_configuration: rococo_runtime::ParachainsConfigurationConfig {
|
||||
configuration: rococo_runtime::ConfigurationConfig {
|
||||
config: default_parachains_host_configuration(),
|
||||
},
|
||||
bridge_rococo_grandpa: rococo_runtime::BridgeRococoGrandpaConfig {
|
||||
@@ -1360,7 +1360,7 @@ pub fn kusama_testnet_genesis(
|
||||
},
|
||||
vesting: kusama::VestingConfig { vesting: vec![] },
|
||||
treasury: Default::default(),
|
||||
parachains_configuration: kusama::ParachainsConfigurationConfig {
|
||||
configuration: kusama::ConfigurationConfig {
|
||||
config: default_parachains_host_configuration(),
|
||||
},
|
||||
gilt: Default::default(),
|
||||
@@ -1449,7 +1449,7 @@ pub fn westend_testnet_genesis(
|
||||
authority_discovery: westend::AuthorityDiscoveryConfig { keys: vec![] },
|
||||
vesting: westend::VestingConfig { vesting: vec![] },
|
||||
sudo: westend::SudoConfig { key: root_key },
|
||||
parachains_configuration: westend::ParachainsConfigurationConfig {
|
||||
configuration: westend::ConfigurationConfig {
|
||||
config: default_parachains_host_configuration(),
|
||||
},
|
||||
paras: Default::default(),
|
||||
@@ -1517,7 +1517,7 @@ pub fn rococo_testnet_genesis(
|
||||
keys: vec![],
|
||||
},
|
||||
sudo: rococo_runtime::SudoConfig { key: root_key.clone() },
|
||||
parachains_configuration: rococo_runtime::ParachainsConfigurationConfig {
|
||||
configuration: rococo_runtime::ConfigurationConfig {
|
||||
config: default_parachains_host_configuration(),
|
||||
},
|
||||
hrmp: Default::default(),
|
||||
|
||||
@@ -28,7 +28,7 @@ use sp_keystore::{KeystoreExt, testing::KeyStore};
|
||||
use primitives::v1::{BlockNumber, Header, Id as ParaId, ValidationCode, HeadData, LOWEST_PUBLIC_ID};
|
||||
use frame_support::{
|
||||
parameter_types, assert_ok, assert_noop, PalletId,
|
||||
traits::{Currency, OnInitialize, OnFinalize, KeyOwnerProofSystem},
|
||||
traits::{Currency, OnInitialize, OnFinalize, KeyOwnerProofSystem, GenesisBuild},
|
||||
};
|
||||
use frame_system::EnsureRoot;
|
||||
use runtime_parachains::{
|
||||
@@ -234,13 +234,16 @@ impl crowdloan::Config for Test {
|
||||
/// Create a new set of test externalities.
|
||||
pub fn new_test_ext() -> TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
configuration::GenesisConfig::<Test> {
|
||||
config: configuration::HostConfiguration {
|
||||
max_code_size: 2 * 1024 * 1024, // 2 MB
|
||||
max_head_data_size: 1 * 1024 * 1024, // 1 MB
|
||||
..Default::default()
|
||||
},
|
||||
}.assimilate_storage(&mut t).unwrap();
|
||||
GenesisBuild::<Test>::assimilate_storage(
|
||||
&configuration::GenesisConfig {
|
||||
config: configuration::HostConfiguration {
|
||||
max_code_size: 2 * 1024 * 1024, // 2 MB
|
||||
max_head_data_size: 1 * 1024 * 1024, // 1 MB
|
||||
..Default::default()
|
||||
}
|
||||
},
|
||||
&mut t
|
||||
).unwrap();
|
||||
let keystore = KeyStore::new();
|
||||
let mut ext: sp_io::TestExternalities = t.into();
|
||||
ext.register_extension(KeystoreExt(Arc::new(keystore)));
|
||||
|
||||
@@ -551,7 +551,7 @@ mod tests {
|
||||
use primitives::v1::{Balance, BlockNumber, Header};
|
||||
use frame_system::limits;
|
||||
use frame_support::{
|
||||
traits::{OnInitialize, OnFinalize},
|
||||
traits::{OnInitialize, OnFinalize, GenesisBuild},
|
||||
assert_ok, assert_noop, parameter_types,
|
||||
error::BadOrigin,
|
||||
};
|
||||
@@ -571,7 +571,7 @@ mod tests {
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
ParachainsConfiguration: configuration::{Pallet, Call, Storage, Config<T>},
|
||||
Configuration: configuration::{Pallet, Call, Storage, Config<T>},
|
||||
Parachains: paras::{Pallet, Origin, Call, Storage, Config, Event},
|
||||
ParasShared: shared::{Pallet, Call, Storage},
|
||||
Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>},
|
||||
@@ -658,13 +658,16 @@ mod tests {
|
||||
pub fn new_test_ext() -> TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
|
||||
configuration::GenesisConfig::<Test> {
|
||||
config: configuration::HostConfiguration {
|
||||
max_code_size: 2 * 1024 * 1024, // 2 MB
|
||||
max_head_data_size: 1 * 1024 * 1024, // 1 MB
|
||||
..Default::default()
|
||||
GenesisBuild::<Test>::assimilate_storage(
|
||||
&configuration::GenesisConfig {
|
||||
config: configuration::HostConfiguration {
|
||||
max_code_size: 2 * 1024 * 1024, // 2 MB
|
||||
max_head_data_size: 1 * 1024 * 1024, // 1 MB
|
||||
..Default::default()
|
||||
}
|
||||
},
|
||||
}.assimilate_storage(&mut t).unwrap();
|
||||
&mut t
|
||||
).unwrap();
|
||||
|
||||
pallet_balances::GenesisConfig::<Test> {
|
||||
balances: vec![(1, 10_000_000), (2, 10_000_000)],
|
||||
@@ -716,11 +719,11 @@ mod tests {
|
||||
}
|
||||
|
||||
fn max_code_size() -> u32 {
|
||||
ParachainsConfiguration::config().max_code_size
|
||||
Configuration::config().max_code_size
|
||||
}
|
||||
|
||||
fn max_head_size() -> u32 {
|
||||
ParachainsConfiguration::config().max_head_data_size
|
||||
Configuration::config().max_head_data_size
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -29,7 +29,7 @@ impl<T: configuration::Config + dmp::Config> SendXcm for ChildParachainRouter<T>
|
||||
match dest {
|
||||
MultiLocation::X1(Junction::Parachain(id)) => {
|
||||
// Downward message passing.
|
||||
let config = <configuration::Module<T>>::config();
|
||||
let config = <configuration::Pallet<T>>::config();
|
||||
<dmp::Pallet<T>>::queue_downward_message(
|
||||
&config,
|
||||
id.into(),
|
||||
|
||||
@@ -1473,7 +1473,7 @@ construct_runtime! {
|
||||
|
||||
// Parachains pallets. Start indices at 50 to leave room.
|
||||
ParachainsOrigin: parachains_origin::{Pallet, Origin} = 50,
|
||||
ParachainsConfiguration: parachains_configuration::{Pallet, Call, Storage, Config<T>} = 51,
|
||||
Configuration: parachains_configuration::{Pallet, Call, Storage, Config<T>} = 51,
|
||||
ParasShared: parachains_shared::{Pallet, Call, Storage} = 52,
|
||||
ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>} = 53,
|
||||
ParasInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 54,
|
||||
|
||||
@@ -20,17 +20,14 @@
|
||||
|
||||
use sp_std::prelude::*;
|
||||
use primitives::v1::{Balance, SessionIndex, MAX_CODE_SIZE, MAX_POV_SIZE};
|
||||
use frame_support::{
|
||||
decl_storage, decl_module, decl_error,
|
||||
ensure,
|
||||
dispatch::DispatchResult,
|
||||
weights::{DispatchClass, Weight},
|
||||
};
|
||||
use parity_scale_codec::{Encode, Decode};
|
||||
use frame_system::ensure_root;
|
||||
use frame_system::pallet_prelude::*;
|
||||
use frame_support::pallet_prelude::*;
|
||||
use sp_runtime::traits::Zero;
|
||||
use crate::shared;
|
||||
|
||||
pub use pallet::*;
|
||||
|
||||
/// All configuration of the runtime with respect to parachains and parathreads.
|
||||
#[derive(Clone, Encode, Decode, PartialEq, sp_core::RuntimeDebug)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
@@ -258,37 +255,68 @@ impl<BlockNumber: Zero> HostConfiguration<BlockNumber> {
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Config: frame_system::Config + shared::Config { }
|
||||
#[frame_support::pallet]
|
||||
pub mod pallet {
|
||||
use super::*;
|
||||
|
||||
decl_storage! {
|
||||
trait Store for Module<T: Config> as Configuration {
|
||||
/// The active configuration for the current session.
|
||||
ActiveConfig get(fn config) config(): HostConfiguration<T::BlockNumber>;
|
||||
/// Pending configuration (if any) for the next session.
|
||||
PendingConfig: map hasher(twox_64_concat) SessionIndex => Option<HostConfiguration<T::BlockNumber>>;
|
||||
}
|
||||
add_extra_genesis {
|
||||
build(|config: &Self| {
|
||||
config.config.check_consistency();
|
||||
})
|
||||
}
|
||||
}
|
||||
#[pallet::pallet]
|
||||
#[pallet::generate_store(pub(super) trait Store)]
|
||||
pub struct Pallet<T>(_);
|
||||
|
||||
decl_error! {
|
||||
pub enum Error for Module<T: Config> {
|
||||
#[pallet::config]
|
||||
pub trait Config: frame_system::Config + shared::Config {}
|
||||
|
||||
#[pallet::error]
|
||||
pub enum Error<T> {
|
||||
/// The new value for a configuration parameter is invalid.
|
||||
InvalidNewValue,
|
||||
}
|
||||
}
|
||||
|
||||
decl_module! {
|
||||
/// The parachains configuration module.
|
||||
pub struct Module<T: Config> for enum Call where origin: <T as frame_system::Config>::Origin {
|
||||
type Error = Error<T>;
|
||||
/// The active configuration for the current session.
|
||||
#[pallet::storage]
|
||||
#[pallet::getter(fn config)]
|
||||
pub(crate) type ActiveConfig<T: Config> = StorageValue<
|
||||
_,
|
||||
HostConfiguration<T::BlockNumber>,
|
||||
ValueQuery
|
||||
>;
|
||||
|
||||
/// Pending configuration (if any) for the next session.
|
||||
#[pallet::storage]
|
||||
pub(crate) type PendingConfig<T: Config> = StorageMap<
|
||||
_,
|
||||
Twox64Concat,
|
||||
SessionIndex,
|
||||
HostConfiguration<T::BlockNumber>
|
||||
>;
|
||||
|
||||
#[pallet::genesis_config]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
pub config: HostConfiguration<T::BlockNumber>
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<T: Config> Default for GenesisConfig<T> {
|
||||
fn default() -> Self {
|
||||
GenesisConfig {
|
||||
config: Default::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
self.config.check_consistency();
|
||||
ActiveConfig::<T>::put(&self.config);
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
/// Set the validation upgrade frequency.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_validation_upgrade_frequency(origin, new: T::BlockNumber) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_validation_upgrade_frequency(origin: OriginFor<T>, new: T::BlockNumber) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.validation_upgrade_frequency, new) != new
|
||||
@@ -297,8 +325,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Set the validation upgrade delay.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_validation_upgrade_delay(origin, new: T::BlockNumber) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_validation_upgrade_delay(origin: OriginFor<T>, new: T::BlockNumber) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.validation_upgrade_delay, new) != new
|
||||
@@ -307,8 +335,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Set the acceptance period for an included candidate.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_code_retention_period(origin, new: T::BlockNumber) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_code_retention_period(origin: OriginFor<T>, new: T::BlockNumber) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.code_retention_period, new) != new
|
||||
@@ -317,8 +345,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Set the max validation code size for incoming upgrades.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_max_code_size(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_max_code_size(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
ensure!(new <= MAX_CODE_SIZE, Error::<T>::InvalidNewValue);
|
||||
Self::update_config_member(|config| {
|
||||
@@ -328,8 +356,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Set the max POV block size for incoming upgrades.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_max_pov_size(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_max_pov_size(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
ensure!(new <= MAX_POV_SIZE, Error::<T>::InvalidNewValue);
|
||||
Self::update_config_member(|config| {
|
||||
@@ -339,8 +367,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Set the max head data size for paras.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_max_head_data_size(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_max_head_data_size(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.max_head_data_size, new) != new
|
||||
@@ -349,8 +377,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Set the number of parathread execution cores.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_parathread_cores(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_parathread_cores(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.parathread_cores, new) != new
|
||||
@@ -359,8 +387,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Set the number of retries for a particular parathread.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_parathread_retries(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_parathread_retries(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.parathread_retries, new) != new
|
||||
@@ -370,8 +398,8 @@ decl_module! {
|
||||
|
||||
|
||||
/// Set the parachain validator-group rotation frequency
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_group_rotation_frequency(origin, new: T::BlockNumber) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_group_rotation_frequency(origin: OriginFor<T>, new: T::BlockNumber) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
|
||||
ensure!(!new.is_zero(), Error::<T>::InvalidNewValue);
|
||||
@@ -383,8 +411,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Set the availability period for parachains.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_chain_availability_period(origin, new: T::BlockNumber) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_chain_availability_period(origin: OriginFor<T>, new: T::BlockNumber) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
|
||||
ensure!(!new.is_zero(), Error::<T>::InvalidNewValue);
|
||||
@@ -396,8 +424,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Set the availability period for parathreads.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_thread_availability_period(origin, new: T::BlockNumber) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_thread_availability_period(origin: OriginFor<T>, new: T::BlockNumber) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
|
||||
ensure!(!new.is_zero(), Error::<T>::InvalidNewValue);
|
||||
@@ -409,8 +437,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Set the scheduling lookahead, in expected number of blocks at peak throughput.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_scheduling_lookahead(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_scheduling_lookahead(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.scheduling_lookahead, new) != new
|
||||
@@ -419,8 +447,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Set the maximum number of validators to assign to any core.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_max_validators_per_core(origin, new: Option<u32>) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_max_validators_per_core(origin: OriginFor<T>, new: Option<u32>) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.max_validators_per_core, new) != new
|
||||
@@ -429,8 +457,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Set the maximum number of validators to use in parachain consensus.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_max_validators(origin, new: Option<u32>) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_max_validators(origin: OriginFor<T>, new: Option<u32>) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.max_validators, new) != new
|
||||
@@ -439,8 +467,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Set the dispute period, in number of sessions to keep for disputes.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_dispute_period(origin, new: SessionIndex) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_dispute_period(origin: OriginFor<T>, new: SessionIndex) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.dispute_period, new) != new
|
||||
@@ -449,9 +477,9 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Set the dispute post conclusion acceptance period.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_dispute_post_conclusion_acceptance_period(
|
||||
origin,
|
||||
origin: OriginFor<T>,
|
||||
new: T::BlockNumber,
|
||||
) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
@@ -462,8 +490,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Set the maximum number of dispute spam slots.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_dispute_max_spam_slots(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_dispute_max_spam_slots(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.dispute_max_spam_slots, new) != new
|
||||
@@ -472,8 +500,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Set the dispute conclusion by time out period.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_dispute_conclusion_by_time_out_period(origin, new: T::BlockNumber)
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_dispute_conclusion_by_time_out_period(origin: OriginFor<T>, new: T::BlockNumber)
|
||||
-> DispatchResult
|
||||
{
|
||||
ensure_root(origin)?;
|
||||
@@ -485,8 +513,8 @@ decl_module! {
|
||||
|
||||
/// Set the no show slots, in number of number of consensus slots.
|
||||
/// Must be at least 1.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_no_show_slots(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_no_show_slots(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
|
||||
ensure!(!new.is_zero(), Error::<T>::InvalidNewValue);
|
||||
@@ -498,8 +526,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Set the total number of delay tranches.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_n_delay_tranches(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_n_delay_tranches(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.n_delay_tranches, new) != new
|
||||
@@ -508,8 +536,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Set the zeroth delay tranche width.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_zeroth_delay_tranche_width(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_zeroth_delay_tranche_width(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.zeroth_delay_tranche_width, new) != new
|
||||
@@ -518,8 +546,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Set the number of validators needed to approve a block.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_needed_approvals(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_needed_approvals(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.needed_approvals, new) != new
|
||||
@@ -528,8 +556,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Set the number of samples to do of the `RelayVRFModulo` approval assignment criterion.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_relay_vrf_modulo_samples(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_relay_vrf_modulo_samples(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.relay_vrf_modulo_samples, new) != new
|
||||
@@ -538,8 +566,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Sets the maximum items that can present in a upward dispatch queue at once.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_max_upward_queue_count(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_max_upward_queue_count(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.max_upward_queue_count, new) != new
|
||||
@@ -548,8 +576,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Sets the maximum total size of items that can present in a upward dispatch queue at once.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_max_upward_queue_size(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_max_upward_queue_size(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.max_upward_queue_size, new) != new
|
||||
@@ -558,8 +586,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Set the critical downward message size.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_max_downward_message_size(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_max_downward_message_size(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.max_downward_message_size, new) != new
|
||||
@@ -568,8 +596,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Sets the soft limit for the phase of dispatching dispatchable upward messages.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_ump_service_total_weight(origin, new: Weight) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_ump_service_total_weight(origin: OriginFor<T>, new: Weight) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.ump_service_total_weight, new) != new
|
||||
@@ -578,8 +606,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Sets the maximum size of an upward message that can be sent by a candidate.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_max_upward_message_size(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_max_upward_message_size(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.max_upward_message_size, new) != new
|
||||
@@ -588,8 +616,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Sets the maximum number of messages that a candidate can contain.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_max_upward_message_num_per_candidate(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_max_upward_message_num_per_candidate(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.max_upward_message_num_per_candidate, new) != new
|
||||
@@ -598,8 +626,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Sets the number of sessions after which an HRMP open channel request expires.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_hrmp_open_request_ttl(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_hrmp_open_request_ttl(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.hrmp_open_request_ttl, new) != new
|
||||
@@ -608,8 +636,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Sets the amount of funds that the sender should provide for opening an HRMP channel.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_hrmp_sender_deposit(origin, new: Balance) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_hrmp_sender_deposit(origin: OriginFor<T>, new: Balance) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.hrmp_sender_deposit, new) != new
|
||||
@@ -619,8 +647,8 @@ decl_module! {
|
||||
|
||||
/// Sets the amount of funds that the recipient should provide for accepting opening an HRMP
|
||||
/// channel.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_hrmp_recipient_deposit(origin, new: Balance) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_hrmp_recipient_deposit(origin: OriginFor<T>, new: Balance) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.hrmp_recipient_deposit, new) != new
|
||||
@@ -629,8 +657,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Sets the maximum number of messages allowed in an HRMP channel at once.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_hrmp_channel_max_capacity(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_hrmp_channel_max_capacity(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.hrmp_channel_max_capacity, new) != new
|
||||
@@ -639,8 +667,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Sets the maximum total size of messages in bytes allowed in an HRMP channel at once.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_hrmp_channel_max_total_size(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_hrmp_channel_max_total_size(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.hrmp_channel_max_total_size, new) != new
|
||||
@@ -649,8 +677,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Sets the maximum number of inbound HRMP channels a parachain is allowed to accept.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_hrmp_max_parachain_inbound_channels(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_hrmp_max_parachain_inbound_channels(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.hrmp_max_parachain_inbound_channels, new) != new
|
||||
@@ -659,8 +687,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Sets the maximum number of inbound HRMP channels a parathread is allowed to accept.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_hrmp_max_parathread_inbound_channels(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_hrmp_max_parathread_inbound_channels(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.hrmp_max_parathread_inbound_channels, new) != new
|
||||
@@ -669,8 +697,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Sets the maximum size of a message that could ever be put into an HRMP channel.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_hrmp_channel_max_message_size(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_hrmp_channel_max_message_size(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.hrmp_channel_max_message_size, new) != new
|
||||
@@ -679,8 +707,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Sets the maximum number of outbound HRMP channels a parachain is allowed to open.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_hrmp_max_parachain_outbound_channels(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_hrmp_max_parachain_outbound_channels(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.hrmp_max_parachain_outbound_channels, new) != new
|
||||
@@ -689,8 +717,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Sets the maximum number of outbound HRMP channels a parathread is allowed to open.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_hrmp_max_parathread_outbound_channels(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_hrmp_max_parathread_outbound_channels(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.hrmp_max_parathread_outbound_channels, new) != new
|
||||
@@ -699,8 +727,8 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Sets the maximum number of outbound HRMP messages can be sent by a candidate.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_hrmp_max_message_num_per_candidate(origin, new: u32) -> DispatchResult {
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn set_hrmp_max_message_num_per_candidate(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.hrmp_max_message_num_per_candidate, new) != new
|
||||
@@ -710,7 +738,7 @@ decl_module! {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Module<T> {
|
||||
impl<T: Config> Pallet<T> {
|
||||
/// Called by the initializer to initialize the configuration module.
|
||||
pub(crate) fn initializer_initialize(_now: T::BlockNumber) -> Weight {
|
||||
0
|
||||
|
||||
@@ -558,7 +558,7 @@ impl StatementSetFilter {
|
||||
impl<T: Config> Pallet<T> {
|
||||
/// Called by the initializer to initialize the disputes module.
|
||||
pub(crate) fn initializer_initialize(now: T::BlockNumber) -> Weight {
|
||||
let config = <configuration::Module<T>>::config();
|
||||
let config = <configuration::Pallet<T>>::config();
|
||||
|
||||
let mut weight = 0;
|
||||
for (session_index, candidate_hash, mut dispute) in <Disputes<T>>::iter() {
|
||||
|
||||
@@ -522,7 +522,7 @@ pub mod pallet {
|
||||
#[pallet::weight(0)]
|
||||
pub fn force_process_hrmp_open(origin: OriginFor<T>) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
let host_config = configuration::Module::<T>::config();
|
||||
let host_config = configuration::Pallet::<T>::config();
|
||||
Self::process_hrmp_open_channel_requests(&host_config);
|
||||
Ok(())
|
||||
}
|
||||
@@ -542,7 +542,7 @@ pub mod pallet {
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
fn initialize_storage<T: Config>(preopen_hrmp_channels: &[(ParaId, ParaId, u32, u32)]) {
|
||||
let host_config = configuration::Module::<T>::config();
|
||||
let host_config = configuration::Pallet::<T>::config();
|
||||
for &(sender, recipient, max_capacity, max_message_size) in preopen_hrmp_channels {
|
||||
if let Err(err) = preopen_hrmp_channel::<T>(sender, recipient, max_capacity, max_message_size) {
|
||||
panic!("failed to initialize the genesis storage: {:?}", err);
|
||||
@@ -1051,7 +1051,7 @@ impl<T: Config> Pallet<T> {
|
||||
Error::<T>::OpenHrmpChannelInvalidRecipient,
|
||||
);
|
||||
|
||||
let config = <configuration::Module<T>>::config();
|
||||
let config = <configuration::Pallet<T>>::config();
|
||||
ensure!(
|
||||
proposed_max_capacity > 0,
|
||||
Error::<T>::OpenHrmpChannelZeroCapacity,
|
||||
@@ -1154,7 +1154,7 @@ impl<T: Config> Pallet<T> {
|
||||
|
||||
// check if by accepting this open channel request, this parachain would exceed the
|
||||
// number of inbound channels.
|
||||
let config = <configuration::Module<T>>::config();
|
||||
let config = <configuration::Pallet<T>>::config();
|
||||
let channel_num_limit = if <paras::Pallet<T>>::is_parathread(origin) {
|
||||
config.hrmp_max_parathread_inbound_channels
|
||||
} else {
|
||||
@@ -1221,7 +1221,7 @@ impl<T: Config> Pallet<T> {
|
||||
<Self as Store>::HrmpCloseChannelRequests::insert(&channel_id, ());
|
||||
<Self as Store>::HrmpCloseChannelRequestsList::append(channel_id.clone());
|
||||
|
||||
let config = <configuration::Module<T>>::config();
|
||||
let config = <configuration::Pallet<T>>::config();
|
||||
let notification_bytes = {
|
||||
use parity_scale_codec::Encode as _;
|
||||
use xcm::opaque::{v0::Xcm, VersionedXcm};
|
||||
|
||||
@@ -674,7 +674,7 @@ impl<T: Config> Pallet<T> {
|
||||
) -> Weight {
|
||||
let plain = receipt.to_plain();
|
||||
let commitments = receipt.commitments;
|
||||
let config = <configuration::Module<T>>::config();
|
||||
let config = <configuration::Pallet<T>>::config();
|
||||
|
||||
T::RewardValidators::reward_backing(backers.iter().enumerate()
|
||||
.filter(|(_, backed)| **backed)
|
||||
@@ -876,7 +876,7 @@ struct CandidateCheckContext<T: Config> {
|
||||
impl<T: Config> CandidateCheckContext<T> {
|
||||
fn new(now: T::BlockNumber, relay_parent_number: T::BlockNumber) -> Self {
|
||||
Self {
|
||||
config: <configuration::Module<T>>::config(),
|
||||
config: <configuration::Pallet<T>>::config(),
|
||||
now,
|
||||
relay_parent_number,
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ pub mod pallet {
|
||||
// - DMP
|
||||
// - UMP
|
||||
// - HRMP
|
||||
let total_weight = configuration::Module::<T>::initializer_initialize(now) +
|
||||
let total_weight = configuration::Pallet::<T>::initializer_initialize(now) +
|
||||
shared::Pallet::<T>::initializer_initialize(now) +
|
||||
paras::Pallet::<T>::initializer_initialize(now) +
|
||||
scheduler::Module::<T>::initializer_initialize(now) +
|
||||
@@ -159,7 +159,7 @@ pub mod pallet {
|
||||
scheduler::Module::<T>::initializer_finalize();
|
||||
paras::Pallet::<T>::initializer_finalize();
|
||||
shared::Pallet::<T>::initializer_finalize();
|
||||
configuration::Module::<T>::initializer_finalize();
|
||||
configuration::Pallet::<T>::initializer_finalize();
|
||||
|
||||
// Apply buffered session changes as the last thing. This way the runtime APIs and the
|
||||
// next block will observe the next session.
|
||||
@@ -199,7 +199,7 @@ impl<T: Config> Pallet<T> {
|
||||
all_validators: Vec<ValidatorId>,
|
||||
queued: Vec<ValidatorId>,
|
||||
) {
|
||||
let prev_config = <configuration::Module<T>>::config();
|
||||
let prev_config = <configuration::Pallet<T>>::config();
|
||||
|
||||
let random_seed = {
|
||||
let mut buf = [0u8; 32];
|
||||
@@ -213,9 +213,9 @@ impl<T: Config> Pallet<T> {
|
||||
|
||||
// We can't pass the new config into the thing that determines the new config,
|
||||
// so we don't pass the `SessionChangeNotification` into this module.
|
||||
configuration::Module::<T>::initializer_on_new_session(&session_index);
|
||||
configuration::Pallet::<T>::initializer_on_new_session(&session_index);
|
||||
|
||||
let new_config = <configuration::Module<T>>::config();
|
||||
let new_config = <configuration::Pallet<T>>::config();
|
||||
|
||||
let validators = shared::Pallet::<T>::initializer_on_new_session(
|
||||
session_index,
|
||||
|
||||
@@ -52,7 +52,7 @@ pub fn validator_groups<T: initializer::Config>() -> (
|
||||
pub fn availability_cores<T: initializer::Config>() -> Vec<CoreState<T::Hash, T::BlockNumber>> {
|
||||
let cores = <scheduler::Module<T>>::availability_cores();
|
||||
let parachains = <paras::Pallet<T>>::parachains();
|
||||
let config = <configuration::Module<T>>::config();
|
||||
let config = <configuration::Pallet<T>>::config();
|
||||
|
||||
let now = <frame_system::Pallet<T>>::block_number() + One::one();
|
||||
<scheduler::Module<T>>::clear();
|
||||
|
||||
@@ -335,7 +335,7 @@ impl<T: Config> Module<T> {
|
||||
pub fn add_parathread_claim(claim: ParathreadClaim) {
|
||||
if !<paras::Pallet<T>>::is_parathread(claim.0) { return }
|
||||
|
||||
let config = <configuration::Module<T>>::config();
|
||||
let config = <configuration::Pallet<T>>::config();
|
||||
let queue_max_size = config.parathread_cores * config.scheduling_lookahead;
|
||||
|
||||
ParathreadQueue::mutate(|queue| {
|
||||
@@ -368,7 +368,7 @@ impl<T: Config> Module<T> {
|
||||
now: T::BlockNumber,
|
||||
) {
|
||||
let mut cores = AvailabilityCores::get();
|
||||
let config = <configuration::Module<T>>::config();
|
||||
let config = <configuration::Pallet<T>>::config();
|
||||
|
||||
for (freed_index, freed_reason) in just_freed_cores {
|
||||
if (freed_index.0 as usize) < cores.len() {
|
||||
@@ -552,7 +552,7 @@ impl<T: Config> Module<T> {
|
||||
/// Get the group assigned to a specific core by index at the current block number. Result undefined if the core index is unknown
|
||||
/// or the block number is less than the session start index.
|
||||
pub(crate) fn group_assigned_to_core(core: CoreIndex, at: T::BlockNumber) -> Option<GroupIndex> {
|
||||
let config = <configuration::Module<T>>::config();
|
||||
let config = <configuration::Pallet<T>>::config();
|
||||
let session_start_block = <SessionStartBlock<T>>::get();
|
||||
|
||||
if at < session_start_block { return None }
|
||||
@@ -588,7 +588,7 @@ impl<T: Config> Module<T> {
|
||||
/// which prevents us from testing the code if using `impl Trait`.
|
||||
pub(crate) fn availability_timeout_predicate() -> Option<Box<dyn Fn(CoreIndex, T::BlockNumber) -> bool>> {
|
||||
let now = <frame_system::Pallet<T>>::block_number();
|
||||
let config = <configuration::Module<T>>::config();
|
||||
let config = <configuration::Pallet<T>>::config();
|
||||
|
||||
let session_start = <SessionStartBlock<T>>::get();
|
||||
let blocks_since_session_start = now.saturating_sub(session_start);
|
||||
@@ -630,7 +630,7 @@ impl<T: Config> Module<T> {
|
||||
/// Returns a helper for determining group rotation.
|
||||
pub(crate) fn group_rotation_info(now: T::BlockNumber) -> GroupRotationInfo<T::BlockNumber> {
|
||||
let session_start_block = Self::session_start_block();
|
||||
let group_rotation_frequency = <configuration::Module<T>>::config()
|
||||
let group_rotation_frequency = <configuration::Pallet<T>>::config()
|
||||
.group_rotation_frequency;
|
||||
|
||||
GroupRotationInfo {
|
||||
@@ -708,7 +708,7 @@ impl<T: Config> Module<T> {
|
||||
|
||||
// Free all scheduled cores and return parathread claims to queue, with retries incremented.
|
||||
pub(crate) fn clear() {
|
||||
let config = <configuration::Module<T>>::config();
|
||||
let config = <configuration::Pallet<T>>::config();
|
||||
ParathreadQueue::mutate(|queue| {
|
||||
for core_assignment in Scheduled::take() {
|
||||
if let AssignmentKind::Parathread(collator, retries) = core_assignment.kind {
|
||||
|
||||
@@ -82,7 +82,7 @@ impl<T: Config> Module<T> {
|
||||
pub(crate) fn initializer_on_new_session(
|
||||
notification: &crate::initializer::SessionChangeNotification<T::BlockNumber>
|
||||
) {
|
||||
let config = <configuration::Module<T>>::config();
|
||||
let config = <configuration::Pallet<T>>::config();
|
||||
|
||||
let dispute_period = config.dispute_period;
|
||||
|
||||
|
||||
@@ -388,7 +388,7 @@ impl<T: Config> Pallet<T> {
|
||||
pub(crate) fn process_pending_upward_messages() -> Weight {
|
||||
let mut weight_used = 0;
|
||||
|
||||
let config = <configuration::Module<T>>::config();
|
||||
let config = <configuration::Pallet<T>>::config();
|
||||
let mut cursor = NeedsDispatchCursor::new::<T>();
|
||||
let mut queue_cache = QueueCache::new();
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ pub fn make_persisted_validation_data<T: paras::Config + hrmp::Config>(
|
||||
relay_parent_number: T::BlockNumber,
|
||||
relay_parent_storage_root: T::Hash,
|
||||
) -> Option<PersistedValidationData<T::Hash, T::BlockNumber>> {
|
||||
let config = <configuration::Module<T>>::config();
|
||||
let config = <configuration::Pallet<T>>::config();
|
||||
|
||||
Some(PersistedValidationData {
|
||||
parent_head: <paras::Pallet<T>>::para_head(¶_id)?,
|
||||
|
||||
@@ -222,7 +222,7 @@ construct_runtime! {
|
||||
|
||||
// Parachains modules.
|
||||
ParachainsOrigin: parachains_origin::{Pallet, Origin},
|
||||
ParachainsConfiguration: parachains_configuration::{Pallet, Call, Storage, Config<T>},
|
||||
Configuration: parachains_configuration::{Pallet, Call, Storage, Config<T>},
|
||||
ParasShared: parachains_shared::{Pallet, Call, Storage},
|
||||
ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>},
|
||||
ParasInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent},
|
||||
|
||||
@@ -1063,7 +1063,7 @@ construct_runtime! {
|
||||
|
||||
// Parachains pallets. Start indices at 40 to leave room.
|
||||
ParachainsOrigin: parachains_origin::{Pallet, Origin} = 41,
|
||||
ParachainsConfiguration: parachains_configuration::{Pallet, Call, Storage, Config<T>} = 42,
|
||||
Configuration: parachains_configuration::{Pallet, Call, Storage, Config<T>} = 42,
|
||||
ParasShared: parachains_shared::{Pallet, Call, Storage} = 43,
|
||||
ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>} = 44,
|
||||
ParasInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 45,
|
||||
|
||||
Reference in New Issue
Block a user