diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index fe41607dda43..91157b30bca7 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -1482,7 +1482,7 @@ construct_runtime! { ParachainsOrigin: parachains_origin::{Pallet, Origin} = 50, ParachainsConfiguration: parachains_configuration::{Pallet, Call, Storage, Config} = 51, ParasShared: parachains_shared::{Pallet, Call, Storage} = 52, - ParasInclusion: parachains_inclusion::{Pallet, Call, Storage, Event} = 53, + ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event} = 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> { parachains_runtime_api_impl::candidate_events::(|ev| { match ev { - Event::ParasInclusion(ev) => { + Event::ParaInclusion(ev) => { Some(ev) } _ => None, diff --git a/runtime/parachains/src/inclusion.rs b/runtime/parachains/src/inclusion.rs index e5beab3734d3..1a626123cccb 100644 --- a/runtime/parachains/src/inclusion.rs +++ b/runtime/parachains/src/inclusion.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . -//! The inclusion module is responsible for inclusion and availability of scheduled parachains +//! The inclusion pallet is responsible for inclusion and availability of scheduled parachains //! and parathreads. //! //! It is responsible for carrying candidates from being backable to being backed, and then from backed @@ -27,16 +27,15 @@ use primitives::v1::{ BackedCandidate, CoreIndex, GroupIndex, CommittedCandidateReceipt, CandidateReceipt, HeadData, CandidateHash, }; -use frame_support::{ - decl_storage, decl_module, decl_error, decl_event, ensure, dispatch::DispatchResult, IterableStorageMap, - weights::Weight, traits::Get, -}; +use frame_support::pallet_prelude::*; use parity_scale_codec::{Encode, Decode}; use bitvec::{order::Lsb0 as BitOrderLsb0, vec::BitVec}; use sp_runtime::{DispatchError, traits::{One, Saturating}}; use crate::{configuration, disputes, paras, dmp, ump, hrmp, shared, scheduler::CoreAssignment}; +pub use pallet::*; + /// A bitfield signed by a validator indicating that it is keeping its piece of the erasure-coding /// for any backed candidates referred to by a `1` bit available. /// @@ -108,38 +107,43 @@ pub trait RewardValidators { fn reward_bitfields(validators: impl IntoIterator); } -pub trait Config: - frame_system::Config - + shared::Config - + paras::Config - + dmp::Config - + ump::Config - + hrmp::Config - + configuration::Config -{ - type Event: From> + Into<::Event>; - type DisputesHandler: disputes::DisputesHandler; - type RewardValidators: RewardValidators; -} - -decl_storage! { - trait Store for Module as ParaInclusion { - /// The latest bitfield for each validator, referred to by their index in the validator set. - AvailabilityBitfields: map hasher(twox_64_concat) ValidatorIndex - => Option>; +#[frame_support::pallet] +pub mod pallet { + use super::*; - /// Candidates pending availability by `ParaId`. - PendingAvailability: map hasher(twox_64_concat) ParaId - => Option>; + #[pallet::pallet] + #[pallet::generate_store(pub(super) trait Store)] + pub struct Pallet(_); + + #[pallet::config] + pub trait Config: + frame_system::Config + + shared::Config + + paras::Config + + dmp::Config + + ump::Config + + hrmp::Config + + configuration::Config + { + type Event: From> + IsType<::Event>; + type DisputesHandler: disputes::DisputesHandler; + type RewardValidators: RewardValidators; + } - /// The commitments of candidates pending availability, by `ParaId`. - PendingAvailabilityCommitments: map hasher(twox_64_concat) ParaId - => Option; + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + #[pallet::metadata(T::Hash = "Hash")] + pub enum Event { + /// A candidate was backed. `[candidate, head_data]` + CandidateBacked(CandidateReceipt, HeadData, CoreIndex, GroupIndex), + /// A candidate was included. `[candidate, head_data]` + CandidateIncluded(CandidateReceipt, HeadData, CoreIndex, GroupIndex), + /// A candidate timed out. `[candidate, head_data]` + CandidateTimedOut(CandidateReceipt, HeadData, CoreIndex), } -} -decl_error! { - pub enum Error for Module { + #[pallet::error] + pub enum Error { /// Availability bitfield has unexpected size. WrongBitfieldSize, /// Multiple bitfields submitted by same validator or validators out of order by index. @@ -189,33 +193,42 @@ decl_error! { /// The validation code hash of the candidate is not valid. InvalidValidationCodeHash, } -} - -decl_event! { - pub enum Event where ::Hash { - /// A candidate was backed. `[candidate, head_data]` - CandidateBacked(CandidateReceipt, HeadData, CoreIndex, GroupIndex), - /// A candidate was included. `[candidate, head_data]` - CandidateIncluded(CandidateReceipt, HeadData, CoreIndex, GroupIndex), - /// A candidate timed out. `[candidate, head_data]` - CandidateTimedOut(CandidateReceipt, HeadData, CoreIndex), - } -} -decl_module! { - /// The parachain-candidate inclusion module. - pub struct Module - for enum Call where origin: ::Origin - { - type Error = Error; + /// The latest bitfield for each validator, referred to by their index in the validator set. + #[pallet::storage] + pub(crate) type AvailabilityBitfields = StorageMap< + _, + Twox64Concat, + ValidatorIndex, + AvailabilityBitfieldRecord + >; + + /// Candidates pending availability by `ParaId`. + #[pallet::storage] + pub(crate) type PendingAvailability = StorageMap< + _, + Twox64Concat, + ParaId, + CandidatePendingAvailability + >; + + /// The commitments of candidates pending availability, by `ParaId`. + #[pallet::storage] + pub(crate) type PendingAvailabilityCommitments = StorageMap< + _, + Twox64Concat, + ParaId, + CandidateCommitments + >; + + #[pallet::call] + impl Pallet {} - fn deposit_event() = default; - } } const LOG_TARGET: &str = "runtime::inclusion"; -impl Module { +impl Pallet { /// Block initialization logic, called by initializer. pub(crate) fn initializer_initialize(_now: T::BlockNumber) -> Weight { 0 } @@ -228,7 +241,7 @@ impl Module { ) { // unlike most drain methods, drained elements are not cleared on `Drop` of the iterator // and require consumption. - for _ in ::drain() { } + for _ in >::drain() { } for _ in >::drain() { } for _ in >::drain() { } } @@ -343,7 +356,7 @@ impl Module { { if pending_availability.availability_votes.count_ones() >= threshold { >::remove(¶_id); - let commitments = match PendingAvailabilityCommitments::take(¶_id) { + let commitments = match PendingAvailabilityCommitments::::take(¶_id) { Some(commitments) => commitments, None => { log::warn!( @@ -517,7 +530,7 @@ impl Module { ensure!( >::get(¶_id).is_none() && - ::get(¶_id).is_none(), + >::get(¶_id).is_none(), Error::::CandidateScheduledBeforeParaFree, ); @@ -613,7 +626,7 @@ impl Module { backed_in_number: check_cx.now, backing_group: group, }); - ::insert(¶_id, commitments); + >::insert(¶_id, commitments); } Ok(core_indices) @@ -731,7 +744,7 @@ impl Module { for para_id in cleaned_up_ids { let pending = >::take(¶_id); - let commitments = ::take(¶_id); + let commitments = >::take(¶_id); if let (Some(pending), Some(commitments)) = (pending, commitments) { // defensive: this should always be true. @@ -767,7 +780,7 @@ impl Module { for para_id in cleaned_up_ids { let _ = >::take(¶_id); - let _ = ::take(¶_id); + let _ = >::take(¶_id); } cleaned_up_cores @@ -781,7 +794,7 @@ impl Module { /// where the changes to the state are expected to be discarded directly after. pub(crate) fn force_enact(para: ParaId) { let pending = >::take(¶); - let commitments = ::take(¶); + let commitments = >::take(¶); if let (Some(pending), Some(commitments)) = (pending, commitments) { let candidate = CommittedCandidateReceipt { @@ -806,7 +819,7 @@ impl Module { { >::get(¶) .map(|p| p.descriptor) - .and_then(|d| ::get(¶).map(move |c| (d, c))) + .and_then(|d| >::get(¶).map(move |c| (d, c))) .map(|(d, c)| CommittedCandidateReceipt { descriptor: d, commitments: c }) } @@ -934,11 +947,10 @@ mod tests { CandidateCommitments, SignedStatement, CandidateDescriptor, ValidationCode, ValidatorId, }; use sp_keystore::{SyncCryptoStorePtr, SyncCryptoStore}; - use frame_support::traits::{OnFinalize, OnInitialize}; use keyring::Sr25519Keyring; use sc_keystore::LocalKeystore; use crate::mock::{ - new_test_ext, Configuration, Paras, System, Inclusion, + new_test_ext, Configuration, Paras, System, ParaInclusion, MockGenesisConfig, Test, Shared, }; use crate::initializer::SessionChangeNotification; @@ -1066,7 +1078,7 @@ mod tests { while System::block_number() < to { let b = System::block_number(); - Inclusion::initializer_finalize(); + ParaInclusion::initializer_finalize(); Paras::initializer_finalize(); Shared::initializer_finalize(); @@ -1078,7 +1090,7 @@ mod tests { notification.validators.clone(), ); Paras::initializer_on_new_session(¬ification); - Inclusion::initializer_on_new_session(¬ification); + ParaInclusion::initializer_on_new_session(¬ification); } System::on_finalize(b); @@ -1088,7 +1100,7 @@ mod tests { Shared::initializer_initialize(b + 1); Paras::initializer_initialize(b + 1); - Inclusion::initializer_initialize(b + 1); + ParaInclusion::initializer_initialize(b + 1); } } @@ -1201,7 +1213,7 @@ mod tests { backers: default_backing_bitfield(), backing_group: GroupIndex::from(0), }); - PendingAvailabilityCommitments::insert(chain_a, default_candidate.commitments.clone()); + PendingAvailabilityCommitments::::insert(chain_a, default_candidate.commitments.clone()); >::insert(&chain_b, CandidatePendingAvailability { core: CoreIndex::from(1), @@ -1213,21 +1225,21 @@ mod tests { backers: default_backing_bitfield(), backing_group: GroupIndex::from(1), }); - PendingAvailabilityCommitments::insert(chain_b, default_candidate.commitments); + PendingAvailabilityCommitments::::insert(chain_b, default_candidate.commitments); run_to_block(5, |_| None); assert!(>::get(&chain_a).is_some()); assert!(>::get(&chain_b).is_some()); - assert!(::get(&chain_a).is_some()); - assert!(::get(&chain_b).is_some()); + assert!(>::get(&chain_a).is_some()); + assert!(>::get(&chain_b).is_some()); - Inclusion::collect_pending(|core, _since| core == CoreIndex::from(0)); + ParaInclusion::collect_pending(|core, _since| core == CoreIndex::from(0)); assert!(>::get(&chain_a).is_none()); assert!(>::get(&chain_b).is_some()); - assert!(::get(&chain_a).is_none()); - assert!(::get(&chain_b).is_some()); + assert!(>::get(&chain_a).is_none()); + assert!(>::get(&chain_b).is_some()); }); } @@ -1280,7 +1292,7 @@ mod tests { &signing_context, )); - assert!(Inclusion::process_bitfields( + assert!(ParaInclusion::process_bitfields( expected_bits(), vec![signed.into()], &core_lookup, @@ -1298,7 +1310,7 @@ mod tests { &signing_context, )); - assert!(Inclusion::process_bitfields( + assert!(ParaInclusion::process_bitfields( expected_bits() + 1, vec![signed.into()], &core_lookup, @@ -1317,7 +1329,7 @@ mod tests { &signing_context, )).into(); - assert!(Inclusion::process_bitfields( + assert!(ParaInclusion::process_bitfields( expected_bits(), vec![signed.clone(), signed], &core_lookup, @@ -1343,7 +1355,7 @@ mod tests { &signing_context, )).into(); - assert!(Inclusion::process_bitfields( + assert!(ParaInclusion::process_bitfields( expected_bits(), vec![signed_1, signed_0], &core_lookup, @@ -1362,7 +1374,7 @@ mod tests { &signing_context, )); - assert!(Inclusion::process_bitfields( + assert!(ParaInclusion::process_bitfields( expected_bits(), vec![signed.into()], &core_lookup, @@ -1380,7 +1392,7 @@ mod tests { &signing_context, )); - assert!(Inclusion::process_bitfields( + assert!(ParaInclusion::process_bitfields( expected_bits(), vec![signed.into()], &core_lookup, @@ -1404,7 +1416,7 @@ mod tests { backers: default_backing_bitfield(), backing_group: GroupIndex::from(0), }); - PendingAvailabilityCommitments::insert(chain_a, default_candidate.commitments); + PendingAvailabilityCommitments::::insert(chain_a, default_candidate.commitments); *bare_bitfield.0.get_mut(0).unwrap() = true; let signed = block_on(sign_bitfield( @@ -1415,14 +1427,14 @@ mod tests { &signing_context, )); - assert!(Inclusion::process_bitfields( + assert!(ParaInclusion::process_bitfields( expected_bits(), vec![signed.into()], &core_lookup, ).is_ok()); >::remove(chain_a); - PendingAvailabilityCommitments::remove(chain_a); + PendingAvailabilityCommitments::::remove(chain_a); } // bitfield signed with pending bit signed, but no commitments. @@ -1454,7 +1466,7 @@ mod tests { // no core is freed assert_eq!( - Inclusion::process_bitfields( + ParaInclusion::process_bitfields( expected_bits(), vec![signed.into()], &core_lookup, @@ -1517,7 +1529,7 @@ mod tests { backers: backing_bitfield(&[3, 4]), backing_group: GroupIndex::from(0), }); - PendingAvailabilityCommitments::insert(chain_a, candidate_a.commitments); + PendingAvailabilityCommitments::::insert(chain_a, candidate_a.commitments); let candidate_b = TestCandidateBuilder { para_id: chain_b, @@ -1535,7 +1547,7 @@ mod tests { backers: backing_bitfield(&[0, 2]), backing_group: GroupIndex::from(1), }); - PendingAvailabilityCommitments::insert(chain_b, candidate_b.commitments); + PendingAvailabilityCommitments::::insert(chain_b, candidate_b.commitments); // this bitfield signals that a and b are available. let a_and_b_available = { @@ -1578,7 +1590,7 @@ mod tests { )).into()) }).collect(); - assert!(Inclusion::process_bitfields( + assert!(ParaInclusion::process_bitfields( expected_bits(), signed_bitfields, &core_lookup, @@ -1587,8 +1599,8 @@ mod tests { // chain A had 4 signing off, which is >= threshold. // chain B has 3 signing off, which is < threshold. assert!(>::get(&chain_a).is_none()); - assert!(::get(&chain_a).is_none()); - assert!(::get(&chain_b).is_some()); + assert!(>::get(&chain_a).is_none()); + assert!(>::get(&chain_b).is_some()); assert_eq!( >::get(&chain_b).unwrap().availability_votes, { @@ -1716,7 +1728,7 @@ mod tests { )); assert_eq!( - Inclusion::process_candidates( + ParaInclusion::process_candidates( Default::default(), vec![backed], vec![chain_b_assignment.clone()], @@ -1775,7 +1787,7 @@ mod tests { // out-of-order manifests as unscheduled. assert_eq!( - Inclusion::process_candidates( + ParaInclusion::process_candidates( Default::default(), vec![backed_b, backed_a], vec![chain_a_assignment.clone(), chain_b_assignment.clone()], @@ -1810,7 +1822,7 @@ mod tests { )); assert_eq!( - Inclusion::process_candidates( + ParaInclusion::process_candidates( Default::default(), vec![backed], vec![chain_a_assignment.clone()], @@ -1847,7 +1859,7 @@ mod tests { )); assert_eq!( - Inclusion::process_candidates( + ParaInclusion::process_candidates( Default::default(), vec![backed], vec![chain_a_assignment.clone()], @@ -1884,7 +1896,7 @@ mod tests { )); assert_eq!( - Inclusion::process_candidates( + ParaInclusion::process_candidates( Default::default(), vec![backed], vec![ @@ -1928,7 +1940,7 @@ mod tests { )); assert_eq!( - Inclusion::process_candidates( + ParaInclusion::process_candidates( Default::default(), vec![backed], vec![thread_a_assignment.clone()], @@ -1974,10 +1986,10 @@ mod tests { backers: default_backing_bitfield(), backing_group: GroupIndex::from(0), }); - ::insert(&chain_a, candidate.commitments); + >::insert(&chain_a, candidate.commitments); assert_eq!( - Inclusion::process_candidates( + ParaInclusion::process_candidates( Default::default(), vec![backed], vec![chain_a_assignment.clone()], @@ -1987,7 +1999,7 @@ mod tests { ); >::remove(&chain_a); - ::remove(&chain_a); + >::remove(&chain_a); } // messed up commitments storage - do not panic - reject. @@ -2007,7 +2019,7 @@ mod tests { ); // this is not supposed to happen - ::insert(&chain_a, candidate.commitments.clone()); + >::insert(&chain_a, candidate.commitments.clone()); let backed = block_on(back_candidate( candidate, @@ -2019,7 +2031,7 @@ mod tests { )); assert_eq!( - Inclusion::process_candidates( + ParaInclusion::process_candidates( Default::default(), vec![backed], vec![chain_a_assignment.clone()], @@ -2028,7 +2040,7 @@ mod tests { Err(Error::::CandidateScheduledBeforeParaFree.into()), ); - ::remove(&chain_a); + >::remove(&chain_a); } // interfering code upgrade - reject @@ -2066,7 +2078,7 @@ mod tests { assert_eq!(Paras::last_code_upgrade(chain_a, true), Some(10)); assert_eq!( - Inclusion::process_candidates( + ParaInclusion::process_candidates( Default::default(), vec![backed], vec![chain_a_assignment.clone()], @@ -2102,7 +2114,7 @@ mod tests { )); assert_eq!( - Inclusion::process_candidates( + ParaInclusion::process_candidates( Default::default(), vec![backed], vec![chain_a_assignment.clone()], @@ -2139,7 +2151,7 @@ mod tests { )); assert_eq!( - Inclusion::process_candidates( + ParaInclusion::process_candidates( Default::default(), vec![backed], vec![chain_a_assignment.clone()], @@ -2281,7 +2293,7 @@ mod tests { BackingKind::Threshold, )); - let occupied_cores = Inclusion::process_candidates( + let occupied_cores = ParaInclusion::process_candidates( Default::default(), vec![backed_a, backed_b, backed_c], vec![ @@ -2308,7 +2320,7 @@ mod tests { }) ); assert_eq!( - ::get(&chain_a), + >::get(&chain_a), Some(candidate_a.commitments), ); @@ -2326,7 +2338,7 @@ mod tests { }) ); assert_eq!( - ::get(&chain_b), + >::get(&chain_b), Some(candidate_b.commitments), ); @@ -2344,7 +2356,7 @@ mod tests { }) ); assert_eq!( - ::get(&thread_a), + >::get(&thread_a), Some(candidate_c.commitments), ); }); @@ -2417,7 +2429,7 @@ mod tests { BackingKind::Threshold, )); - let occupied_cores = Inclusion::process_candidates( + let occupied_cores = ParaInclusion::process_candidates( Default::default(), vec![backed_a], vec![ @@ -2442,7 +2454,7 @@ mod tests { }) ); assert_eq!( - ::get(&chain_a), + >::get(&chain_a), Some(candidate_a.commitments), ); }); @@ -2517,7 +2529,7 @@ mod tests { backers: default_backing_bitfield(), backing_group: GroupIndex::from(0), }); - ::insert(&chain_a, candidate.commitments.clone()); + >::insert(&chain_a, candidate.commitments.clone()); >::insert(&chain_b, CandidatePendingAvailability { core: CoreIndex::from(1), @@ -2529,7 +2541,7 @@ mod tests { backers: default_backing_bitfield(), backing_group: GroupIndex::from(1), }); - ::insert(&chain_b, candidate.commitments); + >::insert(&chain_b, candidate.commitments); run_to_block(11, |_| None); @@ -2541,8 +2553,8 @@ mod tests { assert!(>::get(&chain_a).is_some()); assert!(>::get(&chain_b).is_some()); - assert!(::get(&chain_a).is_some()); - assert!(::get(&chain_b).is_some()); + assert!(>::get(&chain_a).is_some()); + assert!(>::get(&chain_b).is_some()); run_to_block(12, |n| match n { 12 => Some(SessionChangeNotification { @@ -2564,12 +2576,12 @@ mod tests { assert!(>::get(&chain_a).is_none()); assert!(>::get(&chain_b).is_none()); - assert!(::get(&chain_a).is_none()); - assert!(::get(&chain_b).is_none()); + assert!(>::get(&chain_a).is_none()); + assert!(>::get(&chain_b).is_none()); assert!(>::iter().collect::>().is_empty()); assert!(>::iter().collect::>().is_empty()); - assert!(::iter().collect::>().is_empty()); + assert!(>::iter().collect::>().is_empty()); }); } diff --git a/runtime/parachains/src/initializer.rs b/runtime/parachains/src/initializer.rs index 870962e62ebe..dc3473b2c5f2 100644 --- a/runtime/parachains/src/initializer.rs +++ b/runtime/parachains/src/initializer.rs @@ -136,7 +136,7 @@ pub mod pallet { shared::Module::::initializer_initialize(now) + paras::Pallet::::initializer_initialize(now) + scheduler::Module::::initializer_initialize(now) + - inclusion::Module::::initializer_initialize(now) + + inclusion::Pallet::::initializer_initialize(now) + session_info::Module::::initializer_initialize(now) + T::DisputesHandler::initializer_initialize(now) + dmp::Module::::initializer_initialize(now) + @@ -155,7 +155,7 @@ pub mod pallet { dmp::Module::::initializer_finalize(); T::DisputesHandler::initializer_finalize(); session_info::Module::::initializer_finalize(); - inclusion::Module::::initializer_finalize(); + inclusion::Pallet::::initializer_finalize(); scheduler::Module::::initializer_finalize(); paras::Pallet::::initializer_finalize(); shared::Module::::initializer_finalize(); @@ -235,7 +235,7 @@ impl Pallet { let outgoing_paras = paras::Pallet::::initializer_on_new_session(¬ification); scheduler::Module::::initializer_on_new_session(¬ification); - inclusion::Module::::initializer_on_new_session(¬ification); + inclusion::Pallet::::initializer_on_new_session(¬ification); session_info::Module::::initializer_on_new_session(¬ification); T::DisputesHandler::initializer_on_new_session(¬ification); dmp::Module::::initializer_on_new_session(¬ification, &outgoing_paras); diff --git a/runtime/parachains/src/mock.rs b/runtime/parachains/src/mock.rs index 1c54ff6c5ae1..c909890020dd 100644 --- a/runtime/parachains/src/mock.rs +++ b/runtime/parachains/src/mock.rs @@ -48,7 +48,7 @@ frame_support::construct_runtime!( Paras: paras::{Pallet, Origin, Call, Storage, Event, Config}, Configuration: configuration::{Pallet, Call, Storage, Config}, Shared: shared::{Pallet, Call, Storage}, - Inclusion: inclusion::{Pallet, Call, Storage, Event}, + ParaInclusion: inclusion::{Pallet, Call, Storage, Event}, Scheduler: scheduler::{Pallet, Call, Storage}, Initializer: initializer::{Pallet, Call, Storage}, Dmp: dmp::{Pallet, Call, Storage}, diff --git a/runtime/parachains/src/paras_inherent.rs b/runtime/parachains/src/paras_inherent.rs index 4e26c1916c5b..e7d53f00cb0a 100644 --- a/runtime/parachains/src/paras_inherent.rs +++ b/runtime/parachains/src/paras_inherent.rs @@ -137,7 +137,7 @@ decl_module! { .map(|(_, c)| *c) .collect(); - >::collect_disputed(current_session_disputes) + >::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 = >::availability_cores().len(); - let freed_concluded = >::process_bitfields( + let freed_concluded = >::process_bitfields( expected_bits, signed_bitfields, >::core_para, @@ -164,7 +164,7 @@ decl_module! { // Handle timeouts for any availability core work. let availability_pred = >::availability_timeout_predicate(); let freed_timeout = if let Some(pred) = availability_pred { - >::collect_pending(pred) + >::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 = >::process_candidates( + let occupied = >::process_candidates( parent_storage_root, backed_candidates, >::scheduled(), diff --git a/runtime/parachains/src/runtime_api_impl/v1.rs b/runtime/parachains/src/runtime_api_impl/v1.rs index 883a0a7f309e..991d30295071 100644 --- a/runtime/parachains/src/runtime_api_impl/v1.rs +++ b/runtime/parachains/src/runtime_api_impl/v1.rs @@ -100,7 +100,7 @@ pub fn availability_cores() -> Vec { let para_id = parachains[i]; - let pending_availability = > + let pending_availability = > ::pending_availability(para_id) .expect("Occupied core always has pending availability; qed"); @@ -128,7 +128,7 @@ pub fn availability_cores() -> Vec { let para_id = p.claim.0; - let pending_availability = > + let pending_availability = > ::pending_availability(para_id) .expect("Occupied core always has pending availability; qed"); @@ -180,14 +180,14 @@ fn with_assumption( { match assumption { OccupiedCoreAssumption::Included => { - >::force_enact(para_id); + >::force_enact(para_id); build() } OccupiedCoreAssumption::TimedOut => { build() } OccupiedCoreAssumption::Free => { - if >::pending_availability(para_id).is_some() { + if >::pending_availability(para_id).is_some() { None } else { build() @@ -219,7 +219,7 @@ pub fn check_validation_outputs( para_id: ParaId, outputs: primitives::v1::CandidateCommitments, ) -> bool { - >::check_validation_outputs_for_runtime_api(para_id, outputs) + >::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( pub fn candidate_pending_availability(para_id: ParaId) -> Option> { - >::candidate_pending_availability(para_id) + >::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::::CandidateTimedOut(c, h, core) => CandidateEvent::CandidateTimedOut(c, h, core), + RawEvent::::__Ignore(_, _) + => unreachable!("__Ignore cannot be used"), }) .collect() } diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 04c7adc96f55..caebeba49aaa 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -214,7 +214,7 @@ construct_runtime! { ParachainsOrigin: parachains_origin::{Pallet, Origin}, ParachainsConfiguration: parachains_configuration::{Pallet, Call, Storage, Config}, Shared: parachains_shared::{Pallet, Call, Storage}, - Inclusion: parachains_inclusion::{Pallet, Call, Storage, Event}, + ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event}, 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> { runtime_api_impl::candidate_events::(|ev| { match ev { - Event::Inclusion(ev) => { + Event::ParaInclusion(ev) => { Some(ev) } _ => None, diff --git a/runtime/test-runtime/src/lib.rs b/runtime/test-runtime/src/lib.rs index 5570dbbac74a..fead08ac8fb5 100644 --- a/runtime/test-runtime/src/lib.rs +++ b/runtime/test-runtime/src/lib.rs @@ -536,7 +536,7 @@ construct_runtime! { // Parachains runtime modules ParachainsConfiguration: parachains_configuration::{Pallet, Call, Storage, Config}, - Inclusion: parachains_inclusion::{Pallet, Call, Storage, Event}, + ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event}, ParasInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent}, Initializer: parachains_initializer::{Pallet, Call, Storage}, Paras: parachains_paras::{Pallet, Call, Storage, Origin, Event}, diff --git a/runtime/westend/src/lib.rs b/runtime/westend/src/lib.rs index 0ee78b5d19c4..0a127ee8b1f1 100644 --- a/runtime/westend/src/lib.rs +++ b/runtime/westend/src/lib.rs @@ -1073,7 +1073,7 @@ construct_runtime! { ParachainsOrigin: parachains_origin::{Pallet, Origin} = 41, ParachainsConfiguration: parachains_configuration::{Pallet, Call, Storage, Config} = 42, ParasShared: parachains_shared::{Pallet, Call, Storage} = 43, - ParasInclusion: parachains_inclusion::{Pallet, Call, Storage, Event} = 44, + ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event} = 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> { parachains_runtime_api_impl::candidate_events::(|ev| { match ev { - Event::ParasInclusion(ev) => { + Event::ParaInclusion(ev) => { Some(ev) } _ => None,