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

Companion pr for Substrate #3860 #743

Merged
merged 66 commits into from
Jan 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
fcc7f6e
Make use of `runtime_interface` for parachain externalities
bkchr Dec 5, 2019
e28e3e6
Bump versions (#655)
gavofyork Dec 4, 2019
d0d7a9d
Fix checking that `get_heads` exists (#657)
bkchr Dec 4, 2019
7d40ec7
Tweak some Kusama params (#659)
gavofyork Dec 4, 2019
56e5bca
Update Substrate (#661)
gavofyork Dec 4, 2019
dd332e9
Update branch
bkchr Dec 5, 2019
7d7c984
Add back sudo and fixing compilation
bkchr Dec 5, 2019
4860340
Increase nick deposit (10 KSM) and require 2 councillors to slash (#663)
gavofyork Dec 5, 2019
abc950c
Bump Substrate (#664)
gavofyork Dec 5, 2019
ccfc8a1
Replace Substrate mentions in license headers with Polkadot (#674)
stanislav-tkach Dec 9, 2019
e744087
Fix typo in comment (#671)
Dec 9, 2019
fa2f5b6
Bump Substrate, add Identity module (#676)
gavofyork Dec 9, 2019
510063c
Update futures and tokio for browser light client (#673)
expenses Dec 10, 2019
e737405
Fix typo in comment (#672)
Dec 10, 2019
a13a613
Add the /ws bootnode to the chain specs (#681)
tomaka Dec 10, 2019
5d53fc8
Revert "Revert "Revert removal of tokio_executor that causes tokio ve…
expenses Dec 11, 2019
e1663a1
Fix bootnodes PeerIds (#683)
tomaka Dec 11, 2019
a89528c
Fixes a flaky test (#675)
montekki Dec 11, 2019
aa435c5
Bump Substrate (#686)
gavofyork Dec 12, 2019
f758f89
Merge some things from `ashley-compile-to-wasm` (#687)
expenses Dec 13, 2019
4425ba4
Add matrix release alert script and gitlab job (#688)
s3krit Dec 13, 2019
581d269
Rewrite some Future structs as async functions (#679)
expenses Dec 13, 2019
5406d9e
Supercede 'Propagate Substrate#4284 to Polkadot' (#695)
expenses Dec 17, 2019
9e41806
More update
bkchr Dec 19, 2019
6171016
Fix compilation
bkchr Dec 21, 2019
6060a3d
Some stylistic cleanups
bkchr Jan 6, 2020
9de7269
Increase the minimum treasury bond to reduce silly proposals (#701)
gavofyork Dec 18, 2019
97262aa
Update to latest Substrate master (#703)
bkchr Dec 19, 2019
184e21b
Introduce an event for when transaction fees are paid (#702)
gavofyork Dec 20, 2019
b19a4e1
Bump to latest Substrate (#706)
gavofyork Dec 24, 2019
4cd79c3
ci: increase git cloning depth to 100 (#707)
gabreal Dec 24, 2019
bdbd63c
ci: fetch master branch for runtime diff (#708)
gabreal Dec 27, 2019
878b0e4
Bump Substrate and runtime version (#712)
gavofyork Jan 1, 2020
5358135
ci: fix release tagging after tags are added on the master branch (#714)
gabreal Jan 3, 2020
ce78858
Update kvdb version in availability-store (#709)
NikVolf Jan 3, 2020
c30fb53
Support both polkadot and kusama runtimes (#704)
arkpar Jan 3, 2020
1006511
Bump Substrate & runtime version (#715)
gavofyork Jan 3, 2020
dcfbb9b
Update copyright year (#718)
shawntabrizi Jan 5, 2020
1eb615a
Fixes after master merge
bkchr Jan 7, 2020
66d923d
service: support setting fork blocks in config (#719)
andresilva Jan 6, 2020
72494f2
ci: make sure master branch is available for check_runtime (#720)
gabreal Jan 6, 2020
641be72
service/src/lib.rs: Register network event stream for authority disc …
mxinden Jan 6, 2020
bb82317
Hotfix for Kusama (#724)
gavofyork Jan 6, 2020
ac611b9
allow release alerts to fail (#725)
s3krit Jan 6, 2020
7a78560
Fix the can-author issue by defaulting to Kusama when no chainspec gi…
gavofyork Jan 6, 2020
5857207
service: reset grandpa into a future round (not past) (#726)
andresilva Jan 6, 2020
5308d49
Bump version (#729)
gavofyork Jan 6, 2020
91fa237
polkadot v0.7.13 (#730)
andresilva Jan 7, 2020
b626875
Fix pending-release alert script (#734)
s3krit Jan 7, 2020
c3c5e72
Select native runtime based on chain spec (#733)
arkpar Jan 7, 2020
5621523
Add sudo module to `polkadot-runtime` (#735)
bkchr Jan 7, 2020
bcaa971
Bump versions (#736)
gavofyork Jan 7, 2020
9d4bdec
remove kusama fixes (#738)
andresilva Jan 7, 2020
46df15e
Tweak Polkadot constants & bump Substrate (#739)
gavofyork Jan 7, 2020
fdd6577
Some fixes
bkchr Jan 8, 2020
616b8d1
Fix compilation
bkchr Jan 8, 2020
e9504a0
Merge remote-tracking branch 'origin/master' into bkchr-proposer-stuff
bkchr Jan 8, 2020
76a4af0
Remove TODO
bkchr Jan 8, 2020
7653c3d
Merge remote-tracking branch 'origin/master' into bkchr-proposer-stuff
bkchr Jan 8, 2020
8bc955b
Remove old dir
bkchr Jan 9, 2020
fe8eb3c
Merge remote-tracking branch 'origin/master' into bkchr-proposer-stuff
bkchr Jan 9, 2020
9f0303e
Merge remote-tracking branch 'origin/master' into bkchr-proposer-stuff
bkchr Jan 10, 2020
d685ea5
Companion PR for Substrate#4585 (#748)
shawntabrizi Jan 10, 2020
35d638d
Reset branch and make it compile
bkchr Jan 10, 2020
b08719e
Review feedback
bkchr Jan 10, 2020
78ed588
Make the bounds a bit cleaner.
tomusdrw Jan 10, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
273 changes: 128 additions & 145 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions availability-store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ log = "0.4.8"
futures = "0.3.1"
tokio = { version = "0.2.4", features = ["rt-core"] }
exit-future = "0.2.0"
codec = { package = "parity-scale-codec", version = "1.1.0", default-features = false, features = ["derive"] }
codec = { package = "parity-scale-codec", version = "1.1.0", features = ["derive"] }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
consensus_common = { package = "sp-consensus", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
client = { package = "sc-client-api", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sc-client = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
keystore = { package = "sc-keystore", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
kvdb = "0.2.0"
kvdb-memorydb = "0.2.0"
kvdb = "0.3.1"
kvdb-memorydb = "0.3.1"

[target.'cfg(not(target_os = "unknown"))'.dependencies]
kvdb-rocksdb = "0.3"
kvdb-rocksdb = "0.4.1"
11 changes: 7 additions & 4 deletions availability-store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,20 @@ use polkadot_primitives::{
ParachainHost,
},
};
use sp_runtime::traits::{BlakeTwo256, Hash as HashT, ProvideRuntimeApi};
use sp_runtime::traits::{BlakeTwo256, Hash as HashT, HasherFor};
use sp_blockchain::{Result as ClientResult};
use client::{
BlockchainEvents, BlockBody,
};
use sp_api::ApiExt;
use std::pin::Pin;
use sp_api::{ApiExt, ProvideRuntimeApi};

use log::warn;

use std::sync::Arc;
use std::collections::HashSet;
use std::path::PathBuf;
use std::io;
use std::pin::Pin;

mod worker;
mod store;
Expand Down Expand Up @@ -200,9 +201,11 @@ impl Store {
keystore: KeyStorePtr,
) -> ClientResult<AvailabilityBlockImport<I, P>>
where
P: ProvideRuntimeApi + BlockchainEvents<Block> + BlockBody<Block> + Send + Sync + 'static,
P: ProvideRuntimeApi<Block> + BlockchainEvents<Block> + BlockBody<Block> + Send + Sync + 'static,
P::Api: ParachainHost<Block>,
P::Api: ApiExt<Block, Error=sp_blockchain::Error>,
// Rust bug: https://github.com/rust-lang/rust/issues/24159
sp_api::StateBackendFor<P, Block>: sp_api::StateBackend<HasherFor<Block>>,
{
let to_worker = self.to_worker.clone();

Expand Down
25 changes: 17 additions & 8 deletions availability-store/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use std::thread;

use log::{error, info, trace, warn};
use sp_blockchain::{Result as ClientResult};
use sp_runtime::traits::{Header as HeaderT, ProvideRuntimeApi, Block as BlockT};
use sp_api::ApiExt;
use sp_runtime::traits::{Header as HeaderT, Block as BlockT, HasherFor};
use sp_api::{ApiExt, ProvideRuntimeApi};
use client::{
BlockchainEvents, BlockBody,
blockchain::ProvideCache,
Expand Down Expand Up @@ -207,8 +207,10 @@ where
fn fetch_candidates<P>(client: &P, extrinsics: Vec<<Block as BlockT>::Extrinsic>, parent: &BlockId)
-> ClientResult<Option<Vec<CandidateReceipt>>>
where
P: ProvideRuntimeApi,
P: ProvideRuntimeApi<Block>,
P::Api: ParachainHost<Block, Error = sp_blockchain::Error>,
// Rust bug: https://github.com/rust-lang/rust/issues/24159
sp_api::StateBackendFor<P, Block>: sp_api::StateBackend<HasherFor<Block>>,
{
let api = client.runtime_api();

Expand All @@ -228,9 +230,11 @@ where
/// Creates a task to prune entries in availability store upon block finalization.
async fn prune_unneeded_availability<P, S>(client: Arc<P>, mut sender: S)
where
P: ProvideRuntimeApi + BlockchainEvents<Block> + BlockBody<Block> + Send + Sync + 'static,
P: ProvideRuntimeApi<Block> + BlockchainEvents<Block> + BlockBody<Block> + Send + Sync + 'static,
P::Api: ParachainHost<Block> + ApiExt<Block, Error=sp_blockchain::Error>,
S: Sink<WorkerMsg> + Clone + Send + Sync + Unpin,
// Rust bug: https://github.com/rust-lang/rust/issues/24159
sp_api::StateBackendFor<P, Block>: sp_api::StateBackend<HasherFor<Block>>,
{
let mut finality_notification_stream = client.finality_notification_stream();

Expand Down Expand Up @@ -624,16 +628,19 @@ impl<I, P> Drop for AvailabilityBlockImport<I, P> {
}

impl<I, P> BlockImport<Block> for AvailabilityBlockImport<I, P> where
I: BlockImport<Block> + Send + Sync,
I: BlockImport<Block, Transaction = sp_api::TransactionFor<P, Block>> + Send + Sync,
I::Error: Into<ConsensusError>,
P: ProvideRuntimeApi + ProvideCache<Block>,
P: ProvideRuntimeApi<Block> + ProvideCache<Block>,
P::Api: ParachainHost<Block, Error = sp_blockchain::Error>,
// Rust bug: https://github.com/rust-lang/rust/issues/24159
sp_api::StateBackendFor<P, Block>: sp_api::StateBackend<sp_core::Blake2Hasher>
{
type Error = ConsensusError;
type Transaction = sp_api::TransactionFor<P, Block>;

fn import_block(
&mut self,
block: BlockImportParams<Block>,
block: BlockImportParams<Block, Self::Transaction>,
new_cache: HashMap<CacheKeyId, Vec<u8>>,
) -> Result<ImportResult, Self::Error> {
trace!(
Expand Down Expand Up @@ -745,9 +752,11 @@ impl<I, P> AvailabilityBlockImport<I, P> {
to_worker: mpsc::UnboundedSender<WorkerMsg>,
) -> Self
where
P: ProvideRuntimeApi + BlockBody<Block> + BlockchainEvents<Block> + Send + Sync + 'static,
P: ProvideRuntimeApi<Block> + BlockBody<Block> + BlockchainEvents<Block> + Send + Sync + 'static,
P::Api: ParachainHost<Block>,
P::Api: ApiExt<Block, Error = sp_blockchain::Error>,
// Rust bug: https://github.com/rust-lang/rust/issues/24159
sp_api::StateBackendFor<P, Block>: sp_api::StateBackend<HasherFor<Block>>,
{
let (signal, exit) = exit_future::signal();

Expand Down
7 changes: 7 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ futures = { version = "0.3.1", features = ["compat"] }
futures01 = { package = "futures", version = "0.1.29" }
structopt = "=0.3.7"
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sc-client = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sc-client-db = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
service = { package = "polkadot-service", path = "../service", default-features = false }

tokio = { version = "0.1.22", optional = true }
Expand Down
41 changes: 35 additions & 6 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ use futures::{
use tokio::runtime::Runtime;
use log::info;
use structopt::StructOpt;
use sp_api::ConstructRuntimeApi;

pub use service::{
AbstractService, CustomConfiguration, ProvideRuntimeApi, CoreApi, ParachainHost, IsKusama, self,
WrappedExecutor
AbstractService, CustomConfiguration, ProvideRuntimeApi, CoreApi, ParachainHost, IsKusama,
WrappedExecutor, Block, self, RuntimeApiCollection, TFullClient
};

pub use sc_cli::{VersionInfo, IntoExit, NoCustom, SharedParams};
Expand Down Expand Up @@ -101,6 +102,25 @@ pub fn run<E: IntoExit>(exit: E, version: sc_cli::VersionInfo) -> error::Result<
}
}

#[cfg(feature = "cli")]
use sp_core::Blake2Hasher;

#[cfg(feature = "cli")]
// We can't simply use `service::TLightClient` due to a
// Rust bug: https://github.com/rust-lang/rust/issues/43580
type TLightClient<Runtime, Dispatch> = sc_client::Client<
sc_client::light::backend::Backend<sc_client_db::light::LightStorage<Block>, Blake2Hasher>,
sc_client::light::call_executor::GenesisCallExecutor<
sc_client::light::backend::Backend<sc_client_db::light::LightStorage<Block>, Blake2Hasher>,
sc_client::LocalCallExecutor<
sc_client::light::backend::Backend<sc_client_db::light::LightStorage<Block>, Blake2Hasher>,
sc_executor::NativeExecutor<Dispatch>
>
>,
Block,
Runtime
>;

/// Execute the given `cmd` with the given runtime.
#[cfg(feature = "cli")]
fn execute_cmd_with_runtime<R, D, E, X>(
Expand All @@ -110,14 +130,23 @@ fn execute_cmd_with_runtime<R, D, E, X>(
spec: Option<service::ChainSpec>,
) -> error::Result<()>
where
R: service::ConstructRuntimeApi<service::Block, service::TFullClient<service::Block, R, D>>
+ service::ConstructRuntimeApi<service::Block, service::TLightClient<service::Block, R, D>>
R: ConstructRuntimeApi<Block, service::TFullClient<Block, R, D>>
+ Send + Sync + 'static,
<R as service::ConstructRuntimeApi<service::Block, service::TFullClient<service::Block, R, D>>>::RuntimeApi: service::RuntimeApiCollection<E>,
<R as service::ConstructRuntimeApi<service::Block, service::TLightClient<service::Block, R, D>>>::RuntimeApi: service::RuntimeApiCollection<E>,
<R as ConstructRuntimeApi<Block, service::TFullClient<Block, R, D>>>::RuntimeApi:
RuntimeApiCollection<E, StateBackend = sc_client_api::StateBackendFor<service::TFullBackend<Block>, Block>>,
<R as ConstructRuntimeApi<Block, service::TLightClient<Block, R, D>>>::RuntimeApi:
RuntimeApiCollection<E, StateBackend = sc_client_api::StateBackendFor<service::TLightBackend<Block>, Block>>,
E: service::Codec + Send + Sync + 'static,
D: service::NativeExecutionDispatch + 'static,
X: IntoExit,
// Rust bug: https://github.com/rust-lang/rust/issues/24159
<<R as ConstructRuntimeApi<Block, TFullClient<Block, R, D>>>::RuntimeApi as sp_api::ApiExt<Block>>::StateBackend:
sp_api::StateBackend<Blake2Hasher>,
// Rust bug: https://github.com/rust-lang/rust/issues/43580
R: ConstructRuntimeApi<
Block,
TLightClient<R, D>
>,
{
let is_kusama = spec.as_ref().map_or(false, |s| s.is_kusama());
// Use preloaded spec
Expand Down
9 changes: 6 additions & 3 deletions collator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ edition = "2018"

[dependencies]
futures = "0.3.1"
client = { package = "sc-client", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
client-api = { package = "sc-client-api", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
primitives = { package = "sp-core", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sc-client = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
consensus_common = { package = "sp-consensus", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
polkadot-primitives = { path = "../primitives" }
polkadot-cli = { path = "../cli" }
Expand All @@ -21,6 +23,7 @@ polkadot-service = { path = "../service" }
log = "0.4.8"
tokio = "0.1.22"
futures-timer = "1.0"
codec = { package = "parity-scale-codec", version = "1.1.0" }

[dev-dependencies]
keyring = { package = "sp-keyring", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
39 changes: 26 additions & 13 deletions collator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ use std::pin::Pin;

use futures::{future, Future, Stream, FutureExt, TryFutureExt, StreamExt, task::Spawn};
use log::warn;
use client::BlockchainEvents;
use primitives::{Pair, Blake2Hasher};
use sc_client::BlockchainEvents;
use sp_core::{Pair, Blake2Hasher};
use polkadot_primitives::{
BlockId, Hash, Block,
parachain::{
Expand Down Expand Up @@ -128,23 +128,28 @@ impl<R: fmt::Display> fmt::Display for Error<R> {
}

/// The Polkadot client type.
pub type PolkadotClient<B, E, R> = client::Client<B, E, Block, R>;
pub type PolkadotClient<B, E, R> = sc_client::Client<B, E, Block, R>;

/// Something that can build a `ParachainContext`.
pub trait BuildParachainContext {
/// The parachain context produced by the `build` function.
type ParachainContext: self::ParachainContext;

/// Build the `ParachainContext`.
fn build<B, E, R, SP>(
fn build<B, E, R, SP, Extrinsic>(
self,
client: Arc<PolkadotClient<B, E, R>>,
spawner: SP,
network: Arc<dyn Network>,
) -> Result<Self::ParachainContext, ()>
where
B: client_api::backend::Backend<Block, Blake2Hasher> + 'static,
E: client::CallExecutor<Block, Blake2Hasher> + Clone + Send + Sync + 'static,
PolkadotClient<B, E, R>: ProvideRuntimeApi<Block>,
<PolkadotClient<B, E, R> as ProvideRuntimeApi<Block>>::Api: service::RuntimeApiCollection<Extrinsic>,
// Rust bug: https://github.com/rust-lang/rust/issues/24159
<<PolkadotClient<B, E, R> as ProvideRuntimeApi<Block>>::Api as sp_api::ApiExt<Block>>::StateBackend:
sp_api::StateBackend<Blake2Hasher>,
Extrinsic: codec::Codec + Send + Sync + 'static,
E: sc_client::CallExecutor<Block> + Clone + Send + Sync + 'static,
SP: Spawn + Clone + Send + Sync + 'static;
}

Expand Down Expand Up @@ -236,7 +241,7 @@ struct ApiContext<P, E, SP> {
}

impl<P: 'static, E: 'static, SP: 'static> RelayChainContext for ApiContext<P, E, SP> where
P: ProvideRuntimeApi + Send + Sync,
P: ProvideRuntimeApi<Block> + Send + Sync,
P::Api: ParachainHost<Block>,
E: futures::Future<Output=()> + Clone + Send + Sync + 'static,
SP: Spawn + Clone + Send + Sync
Expand Down Expand Up @@ -266,7 +271,7 @@ impl<P: 'static, E: 'static, SP: 'static> RelayChainContext for ApiContext<P, E,
}

/// Run the collator node using the given `service`.
fn run_collator_node<S, E, P>(
fn run_collator_node<S, E, P, Extrinsic>(
service: S,
exit: E,
para_id: ParaId,
Expand All @@ -275,19 +280,27 @@ fn run_collator_node<S, E, P>(
) -> polkadot_cli::error::Result<()>
where
S: AbstractService<Block = service::Block, NetworkSpecialization = service::PolkadotProtocol>,
client::Client<S::Backend, S::CallExecutor, service::Block, S::RuntimeApi>: ProvideRuntimeApi,
<client::Client<S::Backend, S::CallExecutor, service::Block, S::RuntimeApi> as ProvideRuntimeApi>::Api:
ParachainHost<service::Block, Error = sp_blockchain::Error>,
sc_client::Client<S::Backend, S::CallExecutor, service::Block, S::RuntimeApi>: ProvideRuntimeApi<Block>,
<sc_client::Client<S::Backend, S::CallExecutor, service::Block, S::RuntimeApi> as ProvideRuntimeApi<Block>>::Api:
service::RuntimeApiCollection<
Extrinsic,
Error = sp_blockchain::Error,
StateBackend = sc_client_api::StateBackendFor<S::Backend, Block>
>,
// Rust bug: https://github.com/rust-lang/rust/issues/24159
S::Backend: service::Backend<service::Block, service::Blake2Hasher>,
S::Backend: service::Backend<service::Block>,
// Rust bug: https://github.com/rust-lang/rust/issues/24159
S::CallExecutor: service::CallExecutor<service::Block, service::Blake2Hasher>,
<S::Backend as service::Backend<service::Block>>::State:
sp_api::StateBackend<sp_runtime::traits::HasherFor<Block>>,
// Rust bug: https://github.com/rust-lang/rust/issues/24159
S::CallExecutor: service::CallExecutor<service::Block>,
// Rust bug: https://github.com/rust-lang/rust/issues/24159
S::SelectChain: service::SelectChain<service::Block>,
E: futures::Future<Output=()> + Clone + Unpin + Send + Sync + 'static,
P: BuildParachainContext,
P::ParachainContext: Send + 'static,
<P::ParachainContext as ParachainContext>::ProduceCandidate: Send,
Extrinsic: service::Codec + Send + Sync + 'static,
{
let runtime = tokio::runtime::Runtime::new().map_err(|e| format!("{:?}", e))?;
let spawner = WrappedExecutor(service.spawn_task_handle());
Expand Down
3 changes: 2 additions & 1 deletion network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ log = "0.4.8"
exit-future = "0.2.0"
sc-client = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
wasm-timer = "0.2.4"

[dev-dependencies]
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
7 changes: 4 additions & 3 deletions network/src/gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
//! Peers who send information which was not allowed under a recent neighbor packet
//! will be noted as non-beneficial to Substrate's peer-set management utility.

use sp_runtime::{generic::BlockId, traits::{ProvideRuntimeApi, BlakeTwo256, Hash as HashT}};
use sp_runtime::{generic::BlockId, traits::{BlakeTwo256, Hash as HashT}};
use sp_blockchain::Error as ClientError;
use sc_network::{config::Roles, Context, PeerId, ReputationChange};
use sc_network_gossip::{
Expand All @@ -63,6 +63,7 @@ use polkadot_primitives::parachain::{
};
use polkadot_erasure_coding::{self as erasure};
use codec::{Decode, Encode};
use sp_api::ProvideRuntimeApi;

use std::collections::HashMap;
use std::sync::Arc;
Expand Down Expand Up @@ -273,8 +274,8 @@ pub trait ChainContext: Send + Sync {
impl<F, P> ChainContext for (F, P) where
F: Fn(&Hash) -> Option<Known> + Send + Sync,
P: Send + Sync + std::ops::Deref,
P::Target: ProvideRuntimeApi,
<P::Target as ProvideRuntimeApi>::Api: ParachainHost<Block, Error = ClientError>,
P::Target: ProvideRuntimeApi<Block>,
<P::Target as ProvideRuntimeApi<Block>>::Api: ParachainHost<Block, Error = ClientError>,
{
fn is_known(&self, block_hash: &Hash) -> Option<Known> {
(self.0)(block_hash)
Expand Down
Loading