diff --git a/primitives/src/parachain.rs b/primitives/src/parachain.rs index 606d5668e9b8..dabd2fc6b18f 100644 --- a/primitives/src/parachain.rs +++ b/primitives/src/parachain.rs @@ -421,7 +421,7 @@ substrate_client::decl_runtime_apis! { /// Get the current duty roster. fn duty_roster() -> DutyRoster; /// Get the currently active parachains. - fn active_parachains() -> Vec; + fn active_parachains() -> Vec<(Id, Option)>; /// Get the given parachain's status. fn parachain_status(id: Id) -> Option; /// Get the given parachain's head code blob. diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 6671e804964c..c071ce7f9b0d 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -47,6 +47,7 @@ use grandpa::{ AuthorityId as GrandpaId, fg_primitives::{self, ScheduledChange} }; use elections::VoteIndex; +use session::PeriodicSessions; #[cfg(any(feature = "std", test))] use version::NativeVersion; use substrate_primitives::OpaqueMetadata; @@ -106,6 +107,7 @@ parameter_types! { impl system::Trait for Runtime { type Origin = Origin; + type Call = Call; type Index = Nonce; type BlockNumber = BlockNumber; type Hash = Hash; @@ -165,9 +167,13 @@ impl balances::Trait for Runtime { type WeightToFee = WeightToFee; } +parameter_types! { + pub const MinimumPeriod: Moment = SLOT_DURATION / 2; +} impl timestamp::Trait for Runtime { type Moment = Moment; type OnTimestampSet = Aura; + type MinimumPeriod = MinimumPeriod; } parameter_types! { @@ -207,10 +213,14 @@ impl_opaque_keys! { impl session::Trait for Runtime { type OnSessionEnding = Staking; type SessionHandler = SessionHandlers; - type ShouldEndSession = session::PeriodicSessions; + type ShouldEndSession = PeriodicSessions; type Event = Event; type Keys = SessionKeys; + type ValidatorId = AccountId; + type ValidatorIdOf = staking::StashOf; + type SelectInitialValidators = Staking; } + impl session::historical::Trait for Runtime { type FullIdentification = staking::Exposure; type FullIdentificationOf = staking::ExposureOf; @@ -344,6 +354,8 @@ impl parachains::Trait for Runtime { type Origin = Origin; type Call = Call; type ParachainCurrency = Balances; + type ActiveParachains = Registrar; + type Registrar = Registrar; } parameter_types! { @@ -493,8 +505,8 @@ impl_runtime_apis! { fn duty_roster() -> parachain::DutyRoster { Parachains::calculate_duty_roster() } - fn active_parachains() -> Vec { - Parachains::active_parachains() + fn active_parachains() -> Vec<(parachain::Id, Option)> { + Registrar::active_parachains() } fn parachain_status(id: parachain::Id) -> Option { Parachains::parachain_status(&id) diff --git a/runtime/src/parachains.rs b/runtime/src/parachains.rs index 963adcc0f9cd..678d6d48650e 100644 --- a/runtime/src/parachains.rs +++ b/runtime/src/parachains.rs @@ -198,7 +198,7 @@ decl_module! { ); // must be unknown since active parachains are always sorted. - let (_, maybe_required_collator, origins) = iter.find(|para| para.0 == id) + let (_, maybe_required_collator) = iter.find(|para| para.0 == id) .ok_or("candidate for unregistered parachain {}")?; if let Some(required_collator) = maybe_required_collator { @@ -207,7 +207,6 @@ decl_module! { Self::check_upward_messages( id, - origins, &head.candidate.upward_messages, MAX_QUEUE_COUNT, WATERMARK_QUEUE_SIZE, diff --git a/runtime/src/registrar.rs b/runtime/src/registrar.rs index e231a545fd88..f5efae7a7880 100644 --- a/runtime/src/registrar.rs +++ b/runtime/src/registrar.rs @@ -336,11 +336,14 @@ impl SignedExtension for LimitParathreadCommits where type AccountId = T::AccountId; type Call = ::Call; type AdditionalSigned = (); + fn additional_signed(&self) -> rstd::result::Result { + Ok(()) + } fn validate( &self, - call: &Self::Call, who: &Self::AccountId, + call: &Self::Call, info: DispatchInfo, len: usize, ) -> rstd::result::Result { diff --git a/runtime/src/slots.rs b/runtime/src/slots.rs index 7e98a9da8c0c..a56c29a4fc39 100644 --- a/runtime/src/slots.rs +++ b/runtime/src/slots.rs @@ -27,7 +27,7 @@ use srml_support::{ traits::{Currency, ReservableCurrency, WithdrawReason, ExistenceRequirement, Get} }; use primitives::parachain::{ - AccountIdConversion, OnSwap, PARACHAIN_INFO, Id as ParaId, ActiveParas + AccountIdConversion, OnSwap, PARACHAIN_INFO, Id as ParaId }; use crate::registrar::Registrar; use system::{ensure_signed, ensure_root};