Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gavofyork committed Jul 26, 2019
1 parent 32d7d7a commit b0922e7
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion primitives/src/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Id>;
fn active_parachains() -> Vec<(Id, Option<CollatorId>)>;
/// Get the given parachain's status.
fn parachain_status(id: Id) -> Option<Status>;
/// Get the given parachain's head code blob.
Expand Down
18 changes: 15 additions & 3 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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! {
Expand Down Expand Up @@ -207,10 +213,14 @@ impl_opaque_keys! {
impl session::Trait for Runtime {
type OnSessionEnding = Staking;
type SessionHandler = SessionHandlers;
type ShouldEndSession = session::PeriodicSessions<Period, Offset>;
type ShouldEndSession = PeriodicSessions<Period, Offset>;
type Event = Event;
type Keys = SessionKeys;
type ValidatorId = AccountId;
type ValidatorIdOf = staking::StashOf<Self>;
type SelectInitialValidators = Staking;
}

impl session::historical::Trait for Runtime {
type FullIdentification = staking::Exposure<AccountId, Balance>;
type FullIdentificationOf = staking::ExposureOf<Runtime>;
Expand Down Expand Up @@ -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! {
Expand Down Expand Up @@ -493,8 +505,8 @@ impl_runtime_apis! {
fn duty_roster() -> parachain::DutyRoster {
Parachains::calculate_duty_roster()
}
fn active_parachains() -> Vec<parachain::Id> {
Parachains::active_parachains()
fn active_parachains() -> Vec<(parachain::Id, Option<parachain::CollatorId>)> {
Registrar::active_parachains()
}
fn parachain_status(id: parachain::Id) -> Option<parachain::Status> {
Parachains::parachain_status(&id)
Expand Down
3 changes: 1 addition & 2 deletions runtime/src/parachains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -207,7 +207,6 @@ decl_module! {

Self::check_upward_messages(
id,
origins,
&head.candidate.upward_messages,
MAX_QUEUE_COUNT,
WATERMARK_QUEUE_SIZE,
Expand Down
5 changes: 4 additions & 1 deletion runtime/src/registrar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,14 @@ impl<T: Trait + Send + Sync> SignedExtension for LimitParathreadCommits<T> where
type AccountId = T::AccountId;
type Call = <T as system::Trait>::Call;
type AdditionalSigned = ();
fn additional_signed(&self) -> rstd::result::Result<Self::AdditionalSigned, &'static str> {
Ok(())
}

fn validate(
&self,
call: &Self::Call,
who: &Self::AccountId,
call: &Self::Call,
info: DispatchInfo,
len: usize,
) -> rstd::result::Result<ValidTransaction, DispatchError> {
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/slots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down

0 comments on commit b0922e7

Please sign in to comment.