From 4e9fb2d2b5972b40bcc9e5aa0e5784b95f7103e0 Mon Sep 17 00:00:00 2001 From: Stanislav Tkach Date: Tue, 7 May 2019 18:05:02 +0300 Subject: [PATCH] Use authorities from Authorities runtime API, not Core (#248) --- polkadot/Cargo.lock | 2 ++ polkadot/collator/Cargo.toml | 1 + polkadot/collator/src/lib.rs | 4 +++- polkadot/validation/Cargo.toml | 1 + polkadot/validation/src/attestation_service.rs | 4 ++-- polkadot/validation/src/lib.rs | 5 +++-- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/polkadot/Cargo.lock b/polkadot/Cargo.lock index c0aebba11e..6c3440f3b7 100644 --- a/polkadot/Cargo.lock +++ b/polkadot/Cargo.lock @@ -2273,6 +2273,7 @@ dependencies = [ "polkadot-runtime 0.1.0", "polkadot-validation 0.1.0", "substrate-client 1.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", + "substrate-consensus-authorities 1.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "substrate-keyring 1.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "substrate-primitives 1.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2459,6 +2460,7 @@ dependencies = [ "substrate-client 1.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "substrate-consensus-aura 1.1.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "substrate-consensus-aura-primitives 1.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", + "substrate-consensus-authorities 1.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "substrate-consensus-common 1.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "substrate-finality-grandpa 1.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "substrate-inherents 1.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", diff --git a/polkadot/collator/Cargo.toml b/polkadot/collator/Cargo.toml index b10c748e57..0cfb99a19a 100644 --- a/polkadot/collator/Cargo.toml +++ b/polkadot/collator/Cargo.toml @@ -9,6 +9,7 @@ futures = "0.1.17" substrate-client = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } parity-codec = "3.0" substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } +substrate-consensus-authorities = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } polkadot-runtime = { path = "../runtime", version = "0.1" } polkadot-primitives = { path = "../primitives", version = "0.1" } polkadot-cli = { path = "../cli" } diff --git a/polkadot/collator/src/lib.rs b/polkadot/collator/src/lib.rs index bd858a3586..9462d45198 100644 --- a/polkadot/collator/src/lib.rs +++ b/polkadot/collator/src/lib.rs @@ -48,6 +48,7 @@ extern crate futures; extern crate substrate_client as client; extern crate parity_codec as codec; extern crate substrate_primitives as primitives; +extern crate substrate_consensus_authorities as consensus_authorities; extern crate tokio; extern crate polkadot_cli; @@ -75,11 +76,12 @@ use polkadot_primitives::parachain::{ self, BlockData, DutyRoster, HeadData, ConsolidatedIngress, Message, Id as ParaId, Extrinsic, PoVBlock, }; -use polkadot_cli::{PolkadotService, CustomConfiguration, CoreApi, ParachainHost}; +use polkadot_cli::{PolkadotService, CustomConfiguration, ParachainHost}; use polkadot_cli::{Worker, IntoExit, ProvideRuntimeApi, TaskExecutor}; use polkadot_network::validation::{ValidationNetwork, SessionParams}; use polkadot_network::NetworkService; use tokio::timer::Timeout; +use consensus_authorities::AuthoritiesApi; pub use polkadot_cli::VersionInfo; pub use polkadot_network::validation::Incoming; diff --git a/polkadot/validation/Cargo.toml b/polkadot/validation/Cargo.toml index 60a9d6ea69..1145e2742c 100644 --- a/polkadot/validation/Cargo.toml +++ b/polkadot/validation/Cargo.toml @@ -27,6 +27,7 @@ srml-aura = { git = "https://github.com/paritytech/substrate", branch = "polkado substrate-client = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } substrate-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } sr-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } +substrate-consensus-authorities = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } [dev-dependencies] substrate-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } diff --git a/polkadot/validation/src/attestation_service.rs b/polkadot/validation/src/attestation_service.rs index 6593454cde..0819b5cbc1 100644 --- a/polkadot/validation/src/attestation_service.rs +++ b/polkadot/validation/src/attestation_service.rs @@ -30,13 +30,13 @@ use std::sync::Arc; use client::{error::Result as ClientResult, BlockchainEvents, ChainHead, BlockBody}; use client::block_builder::api::BlockBuilder; use client::blockchain::HeaderBackend; -use client::runtime_api::Core; use primitives::ed25519; use futures::prelude::*; use polkadot_primitives::{Block, BlockId}; use polkadot_primitives::parachain::{CandidateReceipt, ParachainHost}; use extrinsic_store::Store as ExtrinsicStore; use runtime_primitives::traits::{ProvideRuntimeApi, Header as HeaderT}; +use consensus_authorities::AuthoritiesApi; use tokio::runtime::TaskExecutor; use tokio::runtime::current_thread::Runtime as LocalRuntime; @@ -114,7 +114,7 @@ pub(crate) fn start( ::Future: Send + 'static, P: BlockchainEvents + ChainHead + BlockBody, P: ProvideRuntimeApi + HeaderBackend + Send + Sync + 'static, - P::Api: ParachainHost + Core + BlockBuilder, + P::Api: ParachainHost + BlockBuilder + AuthoritiesApi, N: Network + Send + Sync + 'static, N::TableRouter: Send + 'static, ::Future: Send + 'static, diff --git a/polkadot/validation/src/lib.rs b/polkadot/validation/src/lib.rs index 3cddeedcc9..9c0dd9b543 100644 --- a/polkadot/validation/src/lib.rs +++ b/polkadot/validation/src/lib.rs @@ -51,6 +51,7 @@ extern crate substrate_consensus_aura as aura; extern crate substrate_consensus_aura_primitives as aura_primitives; extern crate substrate_finality_grandpa as grandpa; extern crate substrate_transaction_pool as transaction_pool; +extern crate substrate_consensus_authorities as consensus_authorities; #[macro_use] extern crate error_chain; @@ -72,7 +73,6 @@ use aura::SlotDuration; use client::{BlockchainEvents, ChainHead, BlockBody}; use client::blockchain::HeaderBackend; use client::block_builder::api::BlockBuilder as BlockBuilderApi; -use client::runtime_api::Core; use codec::Encode; use extrinsic_store::Store as ExtrinsicStore; use parking_lot::Mutex; @@ -87,6 +87,7 @@ use runtime_primitives::{traits::{ProvideRuntimeApi, Header as HeaderT}, ApplyEr use tokio::runtime::TaskExecutor; use tokio::timer::{Delay, Interval}; use transaction_pool::txpool::{Pool, ChainApi as PoolChainApi}; +use consensus_authorities::AuthoritiesApi; use attestation_service::ServiceHandle; use futures::prelude::*; @@ -468,7 +469,7 @@ impl ProposerFactory where ::Future: Send + 'static, P: BlockchainEvents + ChainHead + BlockBody, P: ProvideRuntimeApi + HeaderBackend + Send + Sync + 'static, - P::Api: ParachainHost + Core + BlockBuilderApi, + P::Api: ParachainHost + BlockBuilderApi + AuthoritiesApi, N: Network + Send + Sync + 'static, N::TableRouter: Send + 'static, ::Future: Send + 'static,