Commit 21c2e609 authored by Gavin Wood's avatar Gavin Wood Committed by Bastian Köcher
Browse files

Update to latest Substrate (#377)

* Update to latest substrate

* Propagate substrate#3225

* Fixes

* Build

* Fix
parent 9bf33c15
Pipeline #49521 passed with stages
in 13 minutes
This diff is collapsed.
......@@ -128,7 +128,7 @@ impl SignedExtension for OnlyStakingAndClaims {
-> Result<ValidTransaction, DispatchError>
{
match call {
Call::Staking(_) | Call::Claims(_) => Ok(Default::default()),
Call::Staking(_) | Call::Claims(_) | Call::Sudo(_) => Ok(Default::default()),
_ => Err(DispatchError::NoPermission),
}
}
......@@ -491,7 +491,7 @@ construct_runtime!(
Session: session::{Module, Call, Storage, Event, Config<T>},
FinalityTracker: finality_tracker::{Module, Call, Inherent},
Grandpa: grandpa::{Module, Call, Storage, Config, Event},
ImOnline: im_online::{Module, Call, Storage, Event, ValidateUnsigned, Config<T>},
ImOnline: im_online::{Module, Call, Storage, Event, ValidateUnsigned, Config},
// Governance stuff; uncallable initially.
Democracy: democracy::{Module, Call, Storage, Config, Event<T>},
......@@ -658,6 +658,7 @@ impl_runtime_apis! {
epoch_index: Babe::epoch_index(),
randomness: Babe::randomness(),
duration: EpochDuration::get(),
secondary_slots: Babe::secondary_slots().0,
}
}
}
......
......@@ -839,11 +839,17 @@ impl<T: Trait> Module<T> {
impl<T: Trait> session::OneSessionHandler<T::AccountId> for Module<T> {
type Key = ValidatorId;
fn on_genesis_session<'a, I: 'a>(validators: I)
where I: Iterator<Item=(&'a T::AccountId, Self::Key)>
{
<Self as Store>::Authorities::put(&validators.map(|(_, key)| key).collect::<Vec<_>>())
}
fn on_new_session<'a, I: 'a>(changed: bool, validators: I, _queued: I)
where I: Iterator<Item=(&'a T::AccountId, Self::Key)>
{
if changed {
<Self as Store>::Authorities::put(&validators.map(|(_, key)| key).collect::<Vec<_>>())
Self::on_genesis_session(validators)
}
}
......@@ -1080,7 +1086,7 @@ mod tests {
babe::GenesisConfig {
authorities: babe_authorities,
}.assimilate_storage(&mut t).unwrap();
}.assimilate_storage::<Test>(&mut t).unwrap();
balances::GenesisConfig::<Test> {
balances,
......
......@@ -19,10 +19,10 @@
use primitives::{Pair, Public, crypto::UncheckedInto};
use polkadot_primitives::{AccountId, parachain::ValidatorId};
use polkadot_runtime::{
GenesisConfig, CouncilConfig, ElectionsConfig, DemocracyConfig, SystemConfig, BabeConfig,
GenesisConfig, CouncilConfig, ElectionsConfig, DemocracyConfig, SystemConfig,
SessionConfig, StakingConfig, BalancesConfig, Perbill, SessionKeys, TechnicalCommitteeConfig,
GrandpaConfig, SudoConfig, IndicesConfig, StakerStatus, WASM_BINARY,
ClaimsConfig, ImOnlineConfig, ParachainsConfig
SudoConfig, IndicesConfig, StakerStatus, WASM_BINARY,
ClaimsConfig, ParachainsConfig
};
use polkadot_runtime::constants::{currency::DOTS, time::*};
use telemetry::TelemetryEndpoints;
......@@ -144,18 +144,11 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
desired_seats: 0,
}),
membership_Instance1: Some(Default::default()),
babe: Some(BabeConfig {
authorities: initial_authorities.iter().map(|x| (x.2.clone(), 1)).collect(),
}),
grandpa: Some(GrandpaConfig {
authorities: initial_authorities.iter().map(|x| (x.3.clone(), 1)).collect(),
}),
im_online: Some(ImOnlineConfig {
gossip_at: 0,
keys: initial_authorities.iter().map(|x| x.4.clone()).collect(),
}),
babe: Some(Default::default()),
grandpa: Some(Default::default()),
im_online: Some(Default::default()),
parachains: Some(ParachainsConfig {
authorities: initial_authorities.iter().map(|x| x.5.clone()).collect(),
authorities: vec![],
parachains: vec![],
_phdata: Default::default(),
}),
......@@ -288,18 +281,11 @@ pub fn testnet_genesis(
desired_seats,
}),
membership_Instance1: Some(Default::default()),
babe: Some(BabeConfig {
authorities: initial_authorities.iter().map(|x| (x.2.clone(), 1)).collect(),
}),
grandpa: Some(GrandpaConfig {
authorities: initial_authorities.iter().map(|x| (x.3.clone(), 1)).collect(),
}),
im_online: Some(ImOnlineConfig {
gossip_at: 0,
keys: initial_authorities.iter().map(|x| x.4.clone()).collect(),
}),
babe: Some(Default::default()),
grandpa: Some(Default::default()),
im_online: Some(Default::default()),
parachains: Some(ParachainsConfig {
authorities: initial_authorities.iter().map(|x| x.5.clone()).collect(),
authorities: vec![],
parachains: vec![],
_phdata: Default::default(),
}),
......
......@@ -382,7 +382,12 @@ service::construct_service_factory! {
LightService = LightComponents<Self>
{ |config| <LightComponents<Factory>>::new(config) },
FullImportQueue = BabeImportQueue<Self::Block>
{ |config: &mut FactoryFullConfiguration<Self>, client: Arc<FullClient<Self>>, select_chain: Self::SelectChain| {
{ |
config: &mut FactoryFullConfiguration<Self>,
client: Arc<FullClient<Self>>,
select_chain: Self::SelectChain,
transaction_pool: Option<Arc<TransactionPool<Self::FullTransactionPoolApi>>>
| {
let (block_import, link_half) =
grandpa::block_import::<_, _, _, RuntimeApi, FullClient<Self>, _>(
client.clone(), client.clone(), select_chain
......@@ -397,6 +402,7 @@ service::construct_service_factory! {
client.clone(),
client,
config.custom.inherent_data_providers.clone(),
transaction_pool,
)?;
config.custom.import_setup = Some((babe_block_import.clone(), link_half, babe_link));
......@@ -419,7 +425,7 @@ service::construct_service_factory! {
let finality_proof_request_builder = finality_proof_import.create_finality_proof_request_builder();
// FIXME: pruning task isn't started since light client doesn't do `AuthoritySetup`.
let (import_queue, ..) = import_queue(
let (import_queue, ..) = import_queue::<_, _, _, _, _, _, TransactionPool<Self::FullTransactionPoolApi>>(
Config::get_or_compute(&*client)?,
block_import,
None,
......@@ -427,6 +433,7 @@ service::construct_service_factory! {
client.clone(),
client,
config.custom.inherent_data_providers.clone(),
None,
)?;
Ok((import_queue, finality_proof_request_builder))
......
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