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

Commit

Permalink
updating v0.3 to use substrate v0.10 (#146)
Browse files Browse the repository at this point in the history
* updating to latest substrate v0.10

* better handling of outer poll

* nit

* fix tests

* remove comment

* reduce indentation

* use self.poll

* bring oneshot into scope

* spaces

* wrap

* remove match

* wrap

* Update primitives/Cargo.toml

Co-Authored-By: gterzian <2792687+gterzian@users.noreply.github.com>

* Update runtime/wasm/Cargo.toml

Co-Authored-By: gterzian <2792687+gterzian@users.noreply.github.com>

* Update runtime/wasm/Cargo.toml

Co-Authored-By: gterzian <2792687+gterzian@users.noreply.github.com>

* Update test-parachains/adder/collator/src/main.rs

Co-Authored-By: gterzian <2792687+gterzian@users.noreply.github.com>

* indent

* add paranthese
  • Loading branch information
gterzian authored and rphmeier committed Feb 25, 2019
1 parent 05a7b52 commit 461ea31
Show file tree
Hide file tree
Showing 26 changed files with 1,134 additions and 904 deletions.
1,395 changes: 812 additions & 583 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions availability-store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ authors = ["Parity Technologies <admin@parity.io>"]
polkadot-primitives = { path = "../primitives" }
parking_lot = "0.4"
log = "0.3"
parity-codec = "2.1"
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "alexander-backports" }
parity-codec = "3.0"
parity-codec-derive = "3.0"
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "v0.10" }
kvdb = { git = "https://github.com/paritytech/parity-common", rev="616b40150ded71f57f650067fcbc5c99d7c343e6" }
kvdb-rocksdb = { git = "https://github.com/paritytech/parity-common", rev="616b40150ded71f57f650067fcbc5c99d7c343e6" }
kvdb-memorydb = { git = "https://github.com/paritytech/parity-common", rev="616b40150ded71f57f650067fcbc5c99d7c343e6" }
3 changes: 1 addition & 2 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ log = "0.3"
tokio = "0.1.7"
futures = "0.1.17"
exit-future = "0.1"
substrate-cli = { git = "https://github.com/paritytech/substrate", branch = "alexander-backports" }
substrate-cli = { git = "https://github.com/paritytech/substrate", branch = "v0.10" }
polkadot-service = { path = "../service" }
structopt = "0.2.13"
53 changes: 21 additions & 32 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ extern crate tokio;
extern crate substrate_cli as cli;
extern crate polkadot_service as service;
extern crate exit_future;
extern crate structopt;

#[macro_use]
extern crate log;
Expand All @@ -36,15 +35,14 @@ use std::ops::Deref;
use chain_spec::ChainSpec;
use futures::Future;
use tokio::runtime::Runtime;
use structopt::StructOpt;
use service::Service as BareService;

pub use service::{
Components as ServiceComponents, PolkadotService, CustomConfiguration, ServiceFactory, Factory,
ProvideRuntimeApi, CoreApi, ParachainHost,
};

pub use cli::{VersionInfo, IntoExit};
pub use cli::{VersionInfo, IntoExit, NoCustom};
pub use cli::error;

fn load_spec(id: &str) -> Result<Option<service::ChainSpec>, String> {
Expand Down Expand Up @@ -85,42 +83,33 @@ pub fn run<I, T, W>(args: I, worker: W, version: cli::VersionInfo) -> error::Res
T: Into<std::ffi::OsString> + Clone,
W: Worker,
{
let full_version = polkadot_service::full_version_from_strs(
version.version,
version.commit
);

let matches = match cli::CoreParams::clap()
.name(version.executable_name)
.author(version.author)
.about(version.description)
.version(&(full_version + "\n")[..])
.get_matches_from_safe(args) {
Ok(m) => m,
Err(e) => e.exit(),
};

let (spec, mut config) = cli::parse_matches::<service::Factory, _>(load_spec, &version, "parity-polkadot", &matches)?;

match cli::execute_default::<service::Factory, _>(spec, worker, &matches, &config)? {
cli::Action::ExecutedInternally => (),
cli::Action::RunService(worker) => {
info!("Parity ·:· Polkadot");
cli::parse_and_execute::<service::Factory, NoCustom, NoCustom, _, _, _, _, _>(
load_spec, &version, "parity-polkadot", args, worker,
|worker, _custom_args, mut config| {
info!("{}", version.name);
info!(" version {}", config.full_version());
info!(" by Parity Technologies, 2017, 2018");
info!(" by {}, 2017-2019", version.author);
info!("Chain specification: {}", config.chain_spec.name());
info!("Node name: {}", config.name);
info!("Roles: {:?}", config.roles);
config.custom = worker.configuration();
let mut runtime = Runtime::new()?;
let runtime = Runtime::new().map_err(|e| format!("{:?}", e))?;
let executor = runtime.executor();
match config.roles == service::Roles::LIGHT {
true => run_until_exit(runtime, Factory::new_light(config, executor)?, worker)?,
false => run_until_exit(runtime, Factory::new_full(config, executor)?, worker)?,
}
match config.roles {
service::Roles::LIGHT =>
run_until_exit(
runtime,
Factory::new_light(config, executor).map_err(|e| format!("{:?}", e))?,
worker
),
_ => run_until_exit(
runtime,
Factory::new_full(config, executor).map_err(|e| format!("{:?}", e))?,
worker
),
}.map_err(|e| format!("{:?}", e))
}
}
Ok(())
).map_err(Into::into).map(|_| ())
}

fn run_until_exit<T, C, W>(
Expand Down
4 changes: 2 additions & 2 deletions collator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ description = "Collator node implementation"

[dependencies]
futures = "0.1.17"
substrate-client = { git = "https://github.com/paritytech/substrate", branch = "alexander-backports" }
substrate-client = { git = "https://github.com/paritytech/substrate", branch = "v0.10" }
parity-codec = "2.1"
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "alexander-backports" }
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "v0.10" }
polkadot-runtime = { path = "../runtime", version = "0.1" }
polkadot-primitives = { path = "../primitives", version = "0.1" }
polkadot-cli = { path = "../cli" }
Expand Down
2 changes: 1 addition & 1 deletion collator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ impl<P, E> Worker for CollationNode<P, E> where
parachain_context,
key,
).map(move |collation| {
network.with_spec(|spec, ctx| spec.add_local_collation(
network.with_spec(move |spec, ctx| spec.add_local_collation(
ctx,
relay_parent,
targets,
Expand Down
23 changes: 13 additions & 10 deletions consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,23 @@ tokio = "0.1.7"
error-chain = "0.12"
log = "0.3"
exit-future = "0.1"
parity-codec = "2.1"
parity-codec = "3.0"
polkadot-availability-store = { path = "../availability-store" }
polkadot-parachain = { path = "../parachain" }
polkadot-primitives = { path = "../primitives" }
polkadot-runtime = { path = "../runtime" }
polkadot-statement-table = { path = "../statement-table" }
substrate-consensus-aura-primitives = { git = "https://github.com/paritytech/substrate", branch = "alexander-backports" }
substrate-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "alexander-backports" }
substrate-consensus-common = { git = "https://github.com/paritytech/substrate", branch = "alexander-backports" }
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "alexander-backports" }
substrate-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "alexander-backports" }
srml-support = { git = "https://github.com/paritytech/substrate", branch = "alexander-backports" }
substrate-client = { git = "https://github.com/paritytech/substrate", branch = "alexander-backports" }
sr-primitives = { git = "https://github.com/paritytech/substrate", branch = "alexander-backports" }
substrate-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "v0.10" }
substrate-consensus-aura-primitives = { git = "https://github.com/paritytech/substrate", branch = "v0.10" }
substrate-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "v0.10" }
substrate-inherents = { git = "https://github.com/paritytech/substrate", branch = "v0.10" }
substrate-consensus-common = { git = "https://github.com/paritytech/substrate", branch = "v0.10" }
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "v0.10" }
substrate-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "v0.10" }
srml-aura = { git = "https://github.com/paritytech/substrate", branch = "v0.10" }
srml-support = { git = "https://github.com/paritytech/substrate", branch = "v0.10" }
substrate-client = { git = "https://github.com/paritytech/substrate", branch = "v0.10" }
sr-primitives = { git = "https://github.com/paritytech/substrate", branch = "v0.10" }

[dev-dependencies]
substrate-keyring = { git = "https://github.com/paritytech/substrate", branch = "alexander-backports" }
substrate-keyring = { git = "https://github.com/paritytech/substrate", branch = "v0.10" }
4 changes: 2 additions & 2 deletions consensus/src/attestation_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use client::blockchain::HeaderBackend;
use client::runtime_api::Core;
use primitives::ed25519;
use futures::prelude::*;
use polkadot_primitives::{Block, BlockId, InherentData};
use polkadot_primitives::{Block, BlockId};
use polkadot_primitives::parachain::ParachainHost;
use extrinsic_store::Store as ExtrinsicStore;
use runtime_primitives::traits::ProvideRuntimeApi;
Expand Down Expand Up @@ -122,7 +122,7 @@ pub(crate) fn start<C, N, P>(
<C::Collation as IntoFuture>::Future: Send + 'static,
P: BlockchainEvents<Block> + ChainHead<Block> + BlockBody<Block>,
P: ProvideRuntimeApi + HeaderBackend<Block> + Send + Sync + 'static,
P::Api: ParachainHost<Block> + Core<Block> + BlockBuilder<Block, InherentData>,
P::Api: ParachainHost<Block> + Core<Block> + BlockBuilder<Block>,
N: Network + Send + Sync + 'static,
N::TableRouter: Send + 'static,
{
Expand Down
Loading

0 comments on commit 461ea31

Please sign in to comment.