Unverified Commit b583753a authored by ferrell-code's avatar ferrell-code Committed by GitHub
Browse files

paras.rs to FRAME V2 (#3403)

* to v2 macro

* line width

* fix mock

* actually compile moxk

* compile tests

* add hooks

* origin back in mocks

* assimilate_storage

* add generic

* maybe mock compiles now

* origin between parachain and system causing problem

* change origin

* type alias as origin

* keep origin

* add aliases to tests

* remove unnecessary imports

* Parachain -> Paras

* paras test

* nvm

* use genesis build in mock
parent a78434a6
Pipeline #145608 passed with stages
in 35 minutes and 5 seconds
...@@ -975,7 +975,6 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime:: ...@@ -975,7 +975,6 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime::
}, },
paras: rococo_runtime::ParasConfig { paras: rococo_runtime::ParasConfig {
paras: vec![], paras: vec![],
_phdata: Default::default(),
}, },
hrmp: Default::default(), hrmp: Default::default(),
parachains_configuration: rococo_runtime::ParachainsConfigurationConfig { parachains_configuration: rococo_runtime::ParachainsConfigurationConfig {
...@@ -1516,7 +1515,6 @@ pub fn rococo_testnet_genesis( ...@@ -1516,7 +1515,6 @@ pub fn rococo_testnet_genesis(
hrmp: Default::default(), hrmp: Default::default(),
paras: rococo_runtime::ParasConfig { paras: rococo_runtime::ParasConfig {
paras: vec![], paras: vec![],
_phdata: Default::default(),
}, },
bridge_rococo_grandpa: rococo_runtime::BridgeRococoGrandpaConfig { bridge_rococo_grandpa: rococo_runtime::BridgeRococoGrandpaConfig {
owner: Some(root_key.clone()), owner: Some(root_key.clone()),
......
...@@ -65,7 +65,7 @@ frame_support::construct_runtime!( ...@@ -65,7 +65,7 @@ frame_support::construct_runtime!(
// Parachains Runtime // Parachains Runtime
Configuration: configuration::{Pallet, Call, Storage, Config<T>}, Configuration: configuration::{Pallet, Call, Storage, Config<T>},
Paras: paras::{Pallet, Origin, Call, Storage, Event, Config<T>}, Paras: paras::{Pallet, Origin, Call, Storage, Event, Config},
// Para Onboarding Pallets // Para Onboarding Pallets
Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>}, Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>},
......
...@@ -572,7 +572,7 @@ mod tests { ...@@ -572,7 +572,7 @@ mod tests {
System: frame_system::{Pallet, Call, Config, Storage, Event<T>}, System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>}, Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
ParachainsConfiguration: configuration::{Pallet, Call, Storage, Config<T>}, ParachainsConfiguration: configuration::{Pallet, Call, Storage, Config<T>},
Parachains: paras::{Pallet, Origin, Call, Storage, Config<T>, Event}, Parachains: paras::{Pallet, Origin, Call, Storage, Config, Event},
Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>}, Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>},
} }
); );
......
...@@ -1486,7 +1486,7 @@ construct_runtime! { ...@@ -1486,7 +1486,7 @@ construct_runtime! {
ParasInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>} = 53, ParasInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>} = 53,
ParasInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 54, ParasInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 54,
ParasScheduler: parachains_scheduler::{Pallet, Call, Storage} = 55, ParasScheduler: parachains_scheduler::{Pallet, Call, Storage} = 55,
Paras: parachains_paras::{Pallet, Call, Storage, Event, Config<T>} = 56, Paras: parachains_paras::{Pallet, Call, Storage, Event, Config} = 56,
ParasInitializer: parachains_initializer::{Pallet, Call, Storage} = 57, ParasInitializer: parachains_initializer::{Pallet, Call, Storage} = 57,
ParasDmp: parachains_dmp::{Pallet, Call, Storage} = 58, ParasDmp: parachains_dmp::{Pallet, Call, Storage} = 58,
ParasUmp: parachains_ump::{Pallet, Call, Storage, Event} = 59, ParasUmp: parachains_ump::{Pallet, Call, Storage, Event} = 59,
......
...@@ -573,8 +573,8 @@ impl<T: Config> Module<T> { ...@@ -573,8 +573,8 @@ impl<T: Config> Module<T> {
); );
if request.confirmed { if request.confirmed {
if <paras::Module<T>>::is_valid_para(channel_id.sender) if <paras::Pallet<T>>::is_valid_para(channel_id.sender)
&& <paras::Module<T>>::is_valid_para(channel_id.recipient) && <paras::Pallet<T>>::is_valid_para(channel_id.recipient)
{ {
<Self as Store>::HrmpChannels::insert( <Self as Store>::HrmpChannels::insert(
&channel_id, &channel_id,
...@@ -972,7 +972,7 @@ impl<T: Config> Module<T> { ...@@ -972,7 +972,7 @@ impl<T: Config> Module<T> {
) -> DispatchResult { ) -> DispatchResult {
ensure!(origin != recipient, Error::<T>::OpenHrmpChannelToSelf); ensure!(origin != recipient, Error::<T>::OpenHrmpChannelToSelf);
ensure!( ensure!(
<paras::Module<T>>::is_valid_para(recipient), <paras::Pallet<T>>::is_valid_para(recipient),
Error::<T>::OpenHrmpChannelInvalidRecipient, Error::<T>::OpenHrmpChannelInvalidRecipient,
); );
...@@ -1010,7 +1010,7 @@ impl<T: Config> Module<T> { ...@@ -1010,7 +1010,7 @@ impl<T: Config> Module<T> {
let egress_cnt = let egress_cnt =
<Self as Store>::HrmpEgressChannelsIndex::decode_len(&origin).unwrap_or(0) as u32; <Self as Store>::HrmpEgressChannelsIndex::decode_len(&origin).unwrap_or(0) as u32;
let open_req_cnt = <Self as Store>::HrmpOpenChannelRequestCount::get(&origin); let open_req_cnt = <Self as Store>::HrmpOpenChannelRequestCount::get(&origin);
let channel_num_limit = if <paras::Module<T>>::is_parathread(origin) { let channel_num_limit = if <paras::Pallet<T>>::is_parathread(origin) {
config.hrmp_max_parathread_outbound_channels config.hrmp_max_parathread_outbound_channels
} else { } else {
config.hrmp_max_parachain_outbound_channels config.hrmp_max_parachain_outbound_channels
...@@ -1080,7 +1080,7 @@ impl<T: Config> Module<T> { ...@@ -1080,7 +1080,7 @@ impl<T: Config> Module<T> {
// check if by accepting this open channel request, this parachain would exceed the // check if by accepting this open channel request, this parachain would exceed the
// number of inbound channels. // number of inbound channels.
let config = <configuration::Module<T>>::config(); let config = <configuration::Module<T>>::config();
let channel_num_limit = if <paras::Module<T>>::is_parathread(origin) { let channel_num_limit = if <paras::Pallet<T>>::is_parathread(origin) {
config.hrmp_max_parathread_inbound_channels config.hrmp_max_parathread_inbound_channels
} else { } else {
config.hrmp_max_parachain_inbound_channels config.hrmp_max_parachain_inbound_channels
......
...@@ -453,7 +453,7 @@ impl<T: Config> Module<T> { ...@@ -453,7 +453,7 @@ impl<T: Config> Module<T> {
); );
let validation_code_hash = let validation_code_hash =
<paras::Module<T>>::validation_code_hash_at(para_id, now, None) <paras::Pallet<T>>::validation_code_hash_at(para_id, now, None)
// A candidate for a parachain without current validation code is not scheduled. // A candidate for a parachain without current validation code is not scheduled.
.ok_or_else(|| Error::<T>::UnscheduledCandidate)?; .ok_or_else(|| Error::<T>::UnscheduledCandidate)?;
ensure!( ensure!(
...@@ -679,7 +679,7 @@ impl<T: Config> Module<T> { ...@@ -679,7 +679,7 @@ impl<T: Config> Module<T> {
// initial weight is config read. // initial weight is config read.
let mut weight = T::DbWeight::get().reads_writes(1, 0); let mut weight = T::DbWeight::get().reads_writes(1, 0);
if let Some(new_code) = commitments.new_validation_code { if let Some(new_code) = commitments.new_validation_code {
weight += <paras::Module<T>>::schedule_code_upgrade( weight += <paras::Pallet<T>>::schedule_code_upgrade(
receipt.descriptor.para_id, receipt.descriptor.para_id,
new_code, new_code,
relay_parent_number + config.validation_upgrade_delay, relay_parent_number + config.validation_upgrade_delay,
...@@ -708,7 +708,7 @@ impl<T: Config> Module<T> { ...@@ -708,7 +708,7 @@ impl<T: Config> Module<T> {
Event::<T>::CandidateIncluded(plain, commitments.head_data.clone(), core_index, backing_group) Event::<T>::CandidateIncluded(plain, commitments.head_data.clone(), core_index, backing_group)
); );
weight + <paras::Module<T>>::note_new_head( weight + <paras::Pallet<T>>::note_new_head(
receipt.descriptor.para_id, receipt.descriptor.para_id,
commitments.head_data, commitments.head_data,
relay_parent_number, relay_parent_number,
...@@ -869,7 +869,7 @@ impl<T: Config> CandidateCheckContext<T> { ...@@ -869,7 +869,7 @@ impl<T: Config> CandidateCheckContext<T> {
// if any, the code upgrade attempt is allowed. // if any, the code upgrade attempt is allowed.
if let Some(new_validation_code) = new_validation_code { if let Some(new_validation_code) = new_validation_code {
let valid_upgrade_attempt = <paras::Module<T>>::last_code_upgrade(para_id, true) let valid_upgrade_attempt = <paras::Pallet<T>>::last_code_upgrade(para_id, true)
.map_or(true, |last| { .map_or(true, |last| {
last <= self.relay_parent_number last <= self.relay_parent_number
&& self.relay_parent_number.saturating_sub(last) && self.relay_parent_number.saturating_sub(last)
......
...@@ -131,7 +131,7 @@ decl_module! { ...@@ -131,7 +131,7 @@ decl_module! {
// - HRMP // - HRMP
let total_weight = configuration::Module::<T>::initializer_initialize(now) + let total_weight = configuration::Module::<T>::initializer_initialize(now) +
shared::Module::<T>::initializer_initialize(now) + shared::Module::<T>::initializer_initialize(now) +
paras::Module::<T>::initializer_initialize(now) + paras::Pallet::<T>::initializer_initialize(now) +
scheduler::Module::<T>::initializer_initialize(now) + scheduler::Module::<T>::initializer_initialize(now) +
inclusion::Module::<T>::initializer_initialize(now) + inclusion::Module::<T>::initializer_initialize(now) +
session_info::Module::<T>::initializer_initialize(now) + session_info::Module::<T>::initializer_initialize(now) +
...@@ -152,7 +152,7 @@ decl_module! { ...@@ -152,7 +152,7 @@ decl_module! {
session_info::Module::<T>::initializer_finalize(); session_info::Module::<T>::initializer_finalize();
inclusion::Module::<T>::initializer_finalize(); inclusion::Module::<T>::initializer_finalize();
scheduler::Module::<T>::initializer_finalize(); scheduler::Module::<T>::initializer_finalize();
paras::Module::<T>::initializer_finalize(); paras::Pallet::<T>::initializer_finalize();
shared::Module::<T>::initializer_finalize(); shared::Module::<T>::initializer_finalize();
configuration::Module::<T>::initializer_finalize(); configuration::Module::<T>::initializer_finalize();
...@@ -224,7 +224,7 @@ impl<T: Config> Module<T> { ...@@ -224,7 +224,7 @@ impl<T: Config> Module<T> {
session_index, session_index,
}; };
let outgoing_paras = paras::Module::<T>::initializer_on_new_session(&notification); let outgoing_paras = paras::Pallet::<T>::initializer_on_new_session(&notification);
scheduler::Module::<T>::initializer_on_new_session(&notification); scheduler::Module::<T>::initializer_on_new_session(&notification);
inclusion::Module::<T>::initializer_on_new_session(&notification); inclusion::Module::<T>::initializer_on_new_session(&notification);
session_info::Module::<T>::initializer_on_new_session(&notification); session_info::Module::<T>::initializer_on_new_session(&notification);
......
...@@ -52,20 +52,20 @@ pub fn schedule_para_initialize<T: paras::Config>( ...@@ -52,20 +52,20 @@ pub fn schedule_para_initialize<T: paras::Config>(
id: ParaId, id: ParaId,
genesis: paras::ParaGenesisArgs, genesis: paras::ParaGenesisArgs,
) -> Result<(), ()> { ) -> Result<(), ()> {
<paras::Module<T>>::schedule_para_initialize(id, genesis).map_err(|_| ()) <paras::Pallet<T>>::schedule_para_initialize(id, genesis).map_err(|_| ())
} }
/// Schedule a para to be cleaned up at the start of the next session. /// Schedule a para to be cleaned up at the start of the next session.
pub fn schedule_para_cleanup<T: paras::Config>(id: primitives::v1::Id) -> Result<(), ()> { pub fn schedule_para_cleanup<T: paras::Config>(id: primitives::v1::Id) -> Result<(), ()> {
<paras::Module<T>>::schedule_para_cleanup(id).map_err(|_| ()) <paras::Pallet<T>>::schedule_para_cleanup(id).map_err(|_| ())
} }
/// Schedule a parathread to be upgraded to a parachain. /// Schedule a parathread to be upgraded to a parachain.
pub fn schedule_parathread_upgrade<T: paras::Config>(id: ParaId) -> Result<(), ()> { pub fn schedule_parathread_upgrade<T: paras::Config>(id: ParaId) -> Result<(), ()> {
paras::Module::<T>::schedule_parathread_upgrade(id).map_err(|_| ()) paras::Pallet::<T>::schedule_parathread_upgrade(id).map_err(|_| ())
} }
/// Schedule a parachain to be downgraded to a parathread. /// Schedule a parachain to be downgraded to a parathread.
pub fn schedule_parachain_downgrade<T: paras::Config>(id: ParaId) -> Result<(), ()> { pub fn schedule_parachain_downgrade<T: paras::Config>(id: ParaId) -> Result<(), ()> {
paras::Module::<T>::schedule_parachain_downgrade(id).map_err(|_| ()) paras::Pallet::<T>::schedule_parachain_downgrade(id).map_err(|_| ())
} }
...@@ -23,6 +23,7 @@ use sp_runtime::traits::{ ...@@ -23,6 +23,7 @@ use sp_runtime::traits::{
}; };
use primitives::v1::{AuthorityDiscoveryId, Balance, BlockNumber, Header, ValidatorIndex}; use primitives::v1::{AuthorityDiscoveryId, Balance, BlockNumber, Header, ValidatorIndex};
use frame_support::parameter_types; use frame_support::parameter_types;
use frame_support::traits::GenesisBuild;
use frame_support_test::TestRandomness; use frame_support_test::TestRandomness;
use std::cell::RefCell; use std::cell::RefCell;
use std::collections::HashMap; use std::collections::HashMap;
...@@ -42,7 +43,7 @@ frame_support::construct_runtime!( ...@@ -42,7 +43,7 @@ frame_support::construct_runtime!(
{ {
System: frame_system::{Pallet, Call, Config, Storage, Event<T>}, System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>}, Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
Paras: paras::{Pallet, Origin, Call, Storage, Event, Config<T>}, Paras: paras::{Pallet, Origin, Call, Storage, Event, Config},
Configuration: configuration::{Pallet, Call, Storage, Config<T>}, Configuration: configuration::{Pallet, Call, Storage, Config<T>},
Shared: shared::{Pallet, Call, Storage}, Shared: shared::{Pallet, Call, Storage},
Inclusion: inclusion::{Pallet, Call, Storage, Event<T>}, Inclusion: inclusion::{Pallet, Call, Storage, Event<T>},
...@@ -208,7 +209,7 @@ pub fn new_test_ext(state: MockGenesisConfig) -> TestExternalities { ...@@ -208,7 +209,7 @@ pub fn new_test_ext(state: MockGenesisConfig) -> TestExternalities {
let mut t = state.system.build_storage::<Test>().unwrap(); let mut t = state.system.build_storage::<Test>().unwrap();
state.configuration.assimilate_storage(&mut t).unwrap(); state.configuration.assimilate_storage(&mut t).unwrap();
state.paras.assimilate_storage(&mut t).unwrap(); GenesisBuild::<Test>::assimilate_storage(&state.paras, &mut t).unwrap();
t.into() t.into()
} }
...@@ -217,5 +218,5 @@ pub fn new_test_ext(state: MockGenesisConfig) -> TestExternalities { ...@@ -217,5 +218,5 @@ pub fn new_test_ext(state: MockGenesisConfig) -> TestExternalities {
pub struct MockGenesisConfig { pub struct MockGenesisConfig {
pub system: frame_system::GenesisConfig, pub system: frame_system::GenesisConfig,
pub configuration: crate::configuration::GenesisConfig<Test>, pub configuration: crate::configuration::GenesisConfig<Test>,
pub paras: crate::paras::GenesisConfig<Test>, pub paras: crate::paras::GenesisConfig,
} }
This diff is collapsed.
...@@ -51,7 +51,7 @@ pub fn validator_groups<T: initializer::Config>() -> ( ...@@ -51,7 +51,7 @@ pub fn validator_groups<T: initializer::Config>() -> (
/// Implementation for the `availability_cores` function of the runtime API. /// Implementation for the `availability_cores` function of the runtime API.
pub fn availability_cores<T: initializer::Config>() -> Vec<CoreState<T::Hash, T::BlockNumber>> { pub fn availability_cores<T: initializer::Config>() -> Vec<CoreState<T::Hash, T::BlockNumber>> {
let cores = <scheduler::Module<T>>::availability_cores(); let cores = <scheduler::Module<T>>::availability_cores();
let parachains = <paras::Module<T>>::parachains(); let parachains = <paras::Pallet<T>>::parachains();
let config = <configuration::Module<T>>::config(); let config = <configuration::Module<T>>::config();
let now = <frame_system::Pallet<T>>::block_number() + One::one(); let now = <frame_system::Pallet<T>>::block_number() + One::one();
...@@ -270,7 +270,7 @@ pub fn validation_code<T: initializer::Config>( ...@@ -270,7 +270,7 @@ pub fn validation_code<T: initializer::Config>(
with_assumption::<T, _, _>( with_assumption::<T, _, _>(
para_id, para_id,
assumption, assumption,
|| <paras::Module<T>>::current_code(&para_id), || <paras::Pallet<T>>::current_code(&para_id),
) )
} }
...@@ -327,5 +327,5 @@ pub fn inbound_hrmp_channels_contents<T: hrmp::Config>( ...@@ -327,5 +327,5 @@ pub fn inbound_hrmp_channels_contents<T: hrmp::Config>(
pub fn validation_code_by_hash<T: paras::Config>( pub fn validation_code_by_hash<T: paras::Config>(
hash: ValidationCodeHash, hash: ValidationCodeHash,
) -> Option<ValidationCode> { ) -> Option<ValidationCode> {
<paras::Module<T>>::code_by_hash(hash) <paras::Pallet<T>>::code_by_hash(hash)
} }
...@@ -228,7 +228,7 @@ impl<T: Config> Module<T> { ...@@ -228,7 +228,7 @@ impl<T: Config> Module<T> {
let config = new_config; let config = new_config;
let mut thread_queue = ParathreadQueue::get(); let mut thread_queue = ParathreadQueue::get();
let n_parachains = <paras::Module<T>>::parachains().len() as u32; let n_parachains = <paras::Pallet<T>>::parachains().len() as u32;
let n_cores = core::cmp::max( let n_cores = core::cmp::max(
n_parachains + config.parathread_cores, n_parachains + config.parathread_cores,
match config.max_validators_per_core { match config.max_validators_per_core {
...@@ -297,7 +297,7 @@ impl<T: Config> Module<T> { ...@@ -297,7 +297,7 @@ impl<T: Config> Module<T> {
// prune out all entries beyond retry or that no longer correspond to live parathread. // prune out all entries beyond retry or that no longer correspond to live parathread.
thread_queue.queue.retain(|queued| { thread_queue.queue.retain(|queued| {
let will_keep = queued.claim.retries <= config.parathread_retries let will_keep = queued.claim.retries <= config.parathread_retries
&& <paras::Module<T>>::is_parathread(queued.claim.claim.0); && <paras::Pallet<T>>::is_parathread(queued.claim.claim.0);
if !will_keep { if !will_keep {
let claim_para = queued.claim.claim.0; let claim_para = queued.claim.claim.0;
...@@ -333,7 +333,7 @@ impl<T: Config> Module<T> { ...@@ -333,7 +333,7 @@ impl<T: Config> Module<T> {
/// Fails if the claim does not correspond to any live parathread. /// Fails if the claim does not correspond to any live parathread.
#[allow(unused)] #[allow(unused)]
pub fn add_parathread_claim(claim: ParathreadClaim) { pub fn add_parathread_claim(claim: ParathreadClaim) {
if !<paras::Module<T>>::is_parathread(claim.0) { return } if !<paras::Pallet<T>>::is_parathread(claim.0) { return }
let config = <configuration::Module<T>>::config(); let config = <configuration::Module<T>>::config();
let queue_max_size = config.parathread_cores * config.scheduling_lookahead; let queue_max_size = config.parathread_cores * config.scheduling_lookahead;
...@@ -399,7 +399,7 @@ impl<T: Config> Module<T> { ...@@ -399,7 +399,7 @@ impl<T: Config> Module<T> {
} }
} }
let parachains = <paras::Module<T>>::parachains(); let parachains = <paras::Pallet<T>>::parachains();
let mut scheduled = Scheduled::get(); let mut scheduled = Scheduled::get();
let mut parathread_queue = ParathreadQueue::get(); let mut parathread_queue = ParathreadQueue::get();
...@@ -537,7 +537,7 @@ impl<T: Config> Module<T> { ...@@ -537,7 +537,7 @@ impl<T: Config> Module<T> {
match cores.get(core_index.0 as usize).and_then(|c| c.as_ref()) { match cores.get(core_index.0 as usize).and_then(|c| c.as_ref()) {
None => None, None => None,
Some(CoreOccupied::Parachain) => { Some(CoreOccupied::Parachain) => {
let parachains = <paras::Module<T>>::parachains(); let parachains = <paras::Pallet<T>>::parachains();
Some(parachains[core_index.0 as usize]) Some(parachains[core_index.0 as usize])
} }
Some(CoreOccupied::Parathread(ref entry)) => Some(entry.claim.0), Some(CoreOccupied::Parathread(ref entry)) => Some(entry.claim.0),
...@@ -647,7 +647,7 @@ impl<T: Config> Module<T> { ...@@ -647,7 +647,7 @@ impl<T: Config> Module<T> {
/// For parathreads, this is based on the next item in the ParathreadQueue assigned to that /// For parathreads, this is based on the next item in the ParathreadQueue assigned to that
/// core, and is None if there isn't one. /// core, and is None if there isn't one.
pub(crate) fn next_up_on_available(core: CoreIndex) -> Option<ScheduledCore> { pub(crate) fn next_up_on_available(core: CoreIndex) -> Option<ScheduledCore> {
let parachains = <paras::Module<T>>::parachains(); let parachains = <paras::Pallet<T>>::parachains();
if (core.0 as usize) < parachains.len() { if (core.0 as usize) < parachains.len() {
Some(ScheduledCore { Some(ScheduledCore {
para_id: parachains[core.0 as usize], para_id: parachains[core.0 as usize],
...@@ -671,7 +671,7 @@ impl<T: Config> Module<T> { ...@@ -671,7 +671,7 @@ impl<T: Config> Module<T> {
/// core, or if there isn't one, the claim that is currently occupying the core, as long /// core, or if there isn't one, the claim that is currently occupying the core, as long
/// as the claim's retries would not exceed the limit. Otherwise None. /// as the claim's retries would not exceed the limit. Otherwise None.
pub(crate) fn next_up_on_time_out(core: CoreIndex) -> Option<ScheduledCore> { pub(crate) fn next_up_on_time_out(core: CoreIndex) -> Option<ScheduledCore> {
let parachains = <paras::Module<T>>::parachains(); let parachains = <paras::Pallet<T>>::parachains();
if (core.0 as usize) < parachains.len() { if (core.0 as usize) < parachains.len() {
Some(ScheduledCore { Some(ScheduledCore {
para_id: parachains[core.0 as usize], para_id: parachains[core.0 as usize],
...@@ -712,7 +712,7 @@ impl<T: Config> Module<T> { ...@@ -712,7 +712,7 @@ impl<T: Config> Module<T> {
ParathreadQueue::mutate(|queue| { ParathreadQueue::mutate(|queue| {
for core_assignment in Scheduled::take() { for core_assignment in Scheduled::take() {
if let AssignmentKind::Parathread(collator, retries) = core_assignment.kind { if let AssignmentKind::Parathread(collator, retries) = core_assignment.kind {
if !<paras::Module<T>>::is_parathread(core_assignment.para_id) { continue } if !<paras::Pallet<T>>::is_parathread(core_assignment.para_id) { continue }
let entry = ParathreadEntry { let entry = ParathreadEntry {
claim: ParathreadClaim(core_assignment.para_id, collator), claim: ParathreadClaim(core_assignment.para_id, collator),
......
...@@ -34,7 +34,7 @@ pub fn make_persisted_validation_data<T: paras::Config + hrmp::Config>( ...@@ -34,7 +34,7 @@ pub fn make_persisted_validation_data<T: paras::Config + hrmp::Config>(
let config = <configuration::Module<T>>::config(); let config = <configuration::Module<T>>::config();
Some(PersistedValidationData { Some(PersistedValidationData {
parent_head: <paras::Module<T>>::para_head(&para_id)?, parent_head: <paras::Pallet<T>>::para_head(&para_id)?,
relay_parent_number, relay_parent_number,
relay_parent_storage_root, relay_parent_storage_root,
max_pov_size: config.max_pov_size, max_pov_size: config.max_pov_size,
......
...@@ -214,7 +214,7 @@ construct_runtime! { ...@@ -214,7 +214,7 @@ construct_runtime! {
Inclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>}, Inclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>},
ParasInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent}, ParasInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent},
Scheduler: parachains_scheduler::{Pallet, Call, Storage}, Scheduler: parachains_scheduler::{Pallet, Call, Storage},
Paras: parachains_paras::{Pallet, Call, Storage, Event, Config<T>}, Paras: parachains_paras::{Pallet, Call, Storage, Event, Config},
Initializer: parachains_initializer::{Pallet, Call, Storage}, Initializer: parachains_initializer::{Pallet, Call, Storage},
Dmp: parachains_dmp::{Pallet, Call, Storage}, Dmp: parachains_dmp::{Pallet, Call, Storage},
Ump: parachains_ump::{Pallet, Call, Storage, Event}, Ump: parachains_ump::{Pallet, Call, Storage, Event},
......
...@@ -1077,7 +1077,7 @@ construct_runtime! { ...@@ -1077,7 +1077,7 @@ construct_runtime! {
ParasInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>} = 44, ParasInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>} = 44,
ParasInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 45, ParasInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 45,
ParasScheduler: parachains_scheduler::{Pallet, Call, Storage} = 46, ParasScheduler: parachains_scheduler::{Pallet, Call, Storage} = 46,
Paras: parachains_paras::{Pallet, Call, Storage, Event, Config<T>} = 47, Paras: parachains_paras::{Pallet, Call, Storage, Event, Config} = 47,
ParasInitializer: parachains_initializer::{Pallet, Call, Storage} = 48, ParasInitializer: parachains_initializer::{Pallet, Call, Storage} = 48,
ParasDmp: parachains_dmp::{Pallet, Call, Storage} = 49, ParasDmp: parachains_dmp::{Pallet, Call, Storage} = 49,
ParasUmp: parachains_ump::{Pallet, Call, Storage, Event} = 50, ParasUmp: parachains_ump::{Pallet, Call, Storage, Event} = 50,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment