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

Parachains inclusion.rs to Frame V2 (#3440)



* frame v2

* migrate runtimes

* migrate more

* comments

* docs

* cleanup

* Adjust visibility on storage items
Co-authored-by: Keith Yeung's avatarKeith Yeung <kungfukeith11@gmail.com>
parent cc6ef8cb
Pipeline #148448 canceled with stages
in 12 minutes and 37 seconds
......@@ -1482,7 +1482,7 @@ construct_runtime! {
ParachainsOrigin: parachains_origin::{Pallet, Origin} = 50,
ParachainsConfiguration: parachains_configuration::{Pallet, Call, Storage, Config<T>} = 51,
ParasShared: parachains_shared::{Pallet, Call, Storage} = 52,
ParasInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>} = 53,
ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>} = 53,
ParasInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 54,
ParasScheduler: parachains_scheduler::{Pallet, Call, Storage} = 55,
Paras: parachains_paras::{Pallet, Call, Storage, Event, Config} = 56,
......@@ -1647,7 +1647,7 @@ sp_api::impl_runtime_apis! {
fn candidate_events() -> Vec<CandidateEvent<Hash>> {
parachains_runtime_api_impl::candidate_events::<Runtime, _>(|ev| {
match ev {
Event::ParasInclusion(ev) => {
Event::ParaInclusion(ev) => {
Some(ev)
}
_ => None,
......
This diff is collapsed.
......@@ -136,7 +136,7 @@ pub mod pallet {
shared::Module::<T>::initializer_initialize(now) +
paras::Pallet::<T>::initializer_initialize(now) +
scheduler::Module::<T>::initializer_initialize(now) +
inclusion::Module::<T>::initializer_initialize(now) +
inclusion::Pallet::<T>::initializer_initialize(now) +
session_info::Module::<T>::initializer_initialize(now) +
T::DisputesHandler::initializer_initialize(now) +
dmp::Module::<T>::initializer_initialize(now) +
......@@ -155,7 +155,7 @@ pub mod pallet {
dmp::Module::<T>::initializer_finalize();
T::DisputesHandler::initializer_finalize();
session_info::Module::<T>::initializer_finalize();
inclusion::Module::<T>::initializer_finalize();
inclusion::Pallet::<T>::initializer_finalize();
scheduler::Module::<T>::initializer_finalize();
paras::Pallet::<T>::initializer_finalize();
shared::Module::<T>::initializer_finalize();
......@@ -235,7 +235,7 @@ impl<T: Config> Pallet<T> {
let outgoing_paras = paras::Pallet::<T>::initializer_on_new_session(&notification);
scheduler::Module::<T>::initializer_on_new_session(&notification);
inclusion::Module::<T>::initializer_on_new_session(&notification);
inclusion::Pallet::<T>::initializer_on_new_session(&notification);
session_info::Module::<T>::initializer_on_new_session(&notification);
T::DisputesHandler::initializer_on_new_session(&notification);
dmp::Module::<T>::initializer_on_new_session(&notification, &outgoing_paras);
......
......@@ -48,7 +48,7 @@ frame_support::construct_runtime!(
Paras: paras::{Pallet, Origin, Call, Storage, Event, Config},
Configuration: configuration::{Pallet, Call, Storage, Config<T>},
Shared: shared::{Pallet, Call, Storage},
Inclusion: inclusion::{Pallet, Call, Storage, Event<T>},
ParaInclusion: inclusion::{Pallet, Call, Storage, Event<T>},
Scheduler: scheduler::{Pallet, Call, Storage},
Initializer: initializer::{Pallet, Call, Storage},
Dmp: dmp::{Pallet, Call, Storage},
......
......@@ -137,7 +137,7 @@ decl_module! {
.map(|(_, c)| *c)
.collect();
<inclusion::Module<T>>::collect_disputed(current_session_disputes)
<inclusion::Pallet<T>>::collect_disputed(current_session_disputes)
.into_iter()
.map(|core| (core, FreedReason::Concluded))
.collect()
......@@ -149,7 +149,7 @@ decl_module! {
// Process new availability bitfields, yielding any availability cores whose
// work has now concluded.
let expected_bits = <scheduler::Module<T>>::availability_cores().len();
let freed_concluded = <inclusion::Module<T>>::process_bitfields(
let freed_concluded = <inclusion::Pallet<T>>::process_bitfields(
expected_bits,
signed_bitfields,
<scheduler::Module<T>>::core_para,
......@@ -164,7 +164,7 @@ decl_module! {
// Handle timeouts for any availability core work.
let availability_pred = <scheduler::Module<T>>::availability_timeout_predicate();
let freed_timeout = if let Some(pred) = availability_pred {
<inclusion::Module<T>>::collect_pending(pred)
<inclusion::Pallet<T>>::collect_pending(pred)
} else {
Vec::new()
};
......@@ -199,7 +199,7 @@ decl_module! {
// Process backed candidates according to scheduled cores.
let parent_storage_root = parent_header.state_root().clone();
let occupied = <inclusion::Module<T>>::process_candidates(
let occupied = <inclusion::Pallet<T>>::process_candidates(
parent_storage_root,
backed_candidates,
<scheduler::Module<T>>::scheduled(),
......
......@@ -100,7 +100,7 @@ pub fn availability_cores<T: initializer::Config>() -> Vec<CoreState<T::Hash, T:
CoreState::Occupied(match occupied {
CoreOccupied::Parachain => {
let para_id = parachains[i];
let pending_availability = <inclusion::Module<T>>
let pending_availability = <inclusion::Pallet<T>>
::pending_availability(para_id)
.expect("Occupied core always has pending availability; qed");
......@@ -128,7 +128,7 @@ pub fn availability_cores<T: initializer::Config>() -> Vec<CoreState<T::Hash, T:
}
CoreOccupied::Parathread(p) => {
let para_id = p.claim.0;
let pending_availability = <inclusion::Module<T>>
let pending_availability = <inclusion::Pallet<T>>
::pending_availability(para_id)
.expect("Occupied core always has pending availability; qed");
......@@ -180,14 +180,14 @@ fn with_assumption<Config, T, F>(
{
match assumption {
OccupiedCoreAssumption::Included => {
<inclusion::Module<Config>>::force_enact(para_id);
<inclusion::Pallet<Config>>::force_enact(para_id);
build()
}
OccupiedCoreAssumption::TimedOut => {
build()
}
OccupiedCoreAssumption::Free => {
if <inclusion::Module<Config>>::pending_availability(para_id).is_some() {
if <inclusion::Pallet<Config>>::pending_availability(para_id).is_some() {
None
} else {
build()
......@@ -219,7 +219,7 @@ pub fn check_validation_outputs<T: initializer::Config>(
para_id: ParaId,
outputs: primitives::v1::CandidateCommitments,
) -> bool {
<inclusion::Module<T>>::check_validation_outputs_for_runtime_api(para_id, outputs)
<inclusion::Pallet<T>>::check_validation_outputs_for_runtime_api(para_id, outputs)
}
/// Implementation for the `session_index_for_child` function of the runtime API.
......@@ -278,7 +278,7 @@ pub fn validation_code<T: initializer::Config>(
pub fn candidate_pending_availability<T: initializer::Config>(para_id: ParaId)
-> Option<CommittedCandidateReceipt<T::Hash>>
{
<inclusion::Module<T>>::candidate_pending_availability(para_id)
<inclusion::Pallet<T>>::candidate_pending_availability(para_id)
}
/// Implementation for the `candidate_events` function of the runtime API.
......@@ -300,6 +300,8 @@ where
=> CandidateEvent::CandidateIncluded(c, h, core, group),
RawEvent::<T>::CandidateTimedOut(c, h, core)
=> CandidateEvent::CandidateTimedOut(c, h, core),
RawEvent::<T>::__Ignore(_, _)
=> unreachable!("__Ignore cannot be used"),
})
.collect()
}
......
......@@ -214,7 +214,7 @@ construct_runtime! {
ParachainsOrigin: parachains_origin::{Pallet, Origin},
ParachainsConfiguration: parachains_configuration::{Pallet, Call, Storage, Config<T>},
Shared: parachains_shared::{Pallet, Call, Storage},
Inclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>},
ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>},
ParasInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent},
Scheduler: parachains_scheduler::{Pallet, Call, Storage},
Paras: parachains_paras::{Pallet, Call, Storage, Event, Config},
......@@ -1257,7 +1257,7 @@ sp_api::impl_runtime_apis! {
fn candidate_events() -> Vec<CandidateEvent<Hash>> {
runtime_api_impl::candidate_events::<Runtime, _>(|ev| {
match ev {
Event::Inclusion(ev) => {
Event::ParaInclusion(ev) => {
Some(ev)
}
_ => None,
......
......@@ -536,7 +536,7 @@ construct_runtime! {
// Parachains runtime modules
ParachainsConfiguration: parachains_configuration::{Pallet, Call, Storage, Config<T>},
Inclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>},
ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>},
ParasInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent},
Initializer: parachains_initializer::{Pallet, Call, Storage},
Paras: parachains_paras::{Pallet, Call, Storage, Origin, Event},
......
......@@ -1073,7 +1073,7 @@ construct_runtime! {
ParachainsOrigin: parachains_origin::{Pallet, Origin} = 41,
ParachainsConfiguration: parachains_configuration::{Pallet, Call, Storage, Config<T>} = 42,
ParasShared: parachains_shared::{Pallet, Call, Storage} = 43,
ParasInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>} = 44,
ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>} = 44,
ParasInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 45,
ParasScheduler: parachains_scheduler::{Pallet, Call, Storage} = 46,
Paras: parachains_paras::{Pallet, Call, Storage, Event, Config} = 47,
......@@ -1239,7 +1239,7 @@ sp_api::impl_runtime_apis! {
fn candidate_events() -> Vec<CandidateEvent<Hash>> {
parachains_runtime_api_impl::candidate_events::<Runtime, _>(|ev| {
match ev {
Event::ParasInclusion(ev) => {
Event::ParaInclusion(ev) => {
Some(ev)
}
_ => None,
......
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