Skip to content

Commit

Permalink
update substrate (paritytech#259)
Browse files Browse the repository at this point in the history
* WIP

* merging select_chain

* WIP

* update to point to gui-polkadot-master

* Fix collator

* update gui-polkadot-master and fix

* fix unwraps

* better returning an error
  • Loading branch information
gui1117 authored and rphmeier committed May 15, 2019
1 parent d36f852 commit ee0076f
Show file tree
Hide file tree
Showing 25 changed files with 1,005 additions and 943 deletions.
1,004 changes: 503 additions & 501 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion availability-store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ polkadot-primitives = { path = "../primitives" }
parking_lot = "0.7.1"
log = "0.4.6"
parity-codec = "3.0"
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "gui-polkadot-master" }
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" }
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ log = "0.4.6"
tokio = "0.1.7"
futures = "0.1.17"
exit-future = "0.1"
substrate-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-cli = { git = "https://github.com/paritytech/substrate", branch = "gui-polkadot-master" }
polkadot-service = { path = "../service" }
9 changes: 5 additions & 4 deletions collator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ description = "Collator node implementation"

[dependencies]
futures = "0.1.17"
substrate-client = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-client = { git = "https://github.com/paritytech/substrate", branch = "gui-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" }
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "gui-polkadot-master" }
substrate-consensus-authorities = { git = "https://github.com/paritytech/substrate", branch = "gui-polkadot-master" }
substrate-consensus-common= { git = "https://github.com/paritytech/substrate", branch = "gui-polkadot-master" }
polkadot-runtime = { path = "../runtime", version = "0.1" }
polkadot-primitives = { path = "../primitives", version = "0.1" }
polkadot-cli = { path = "../cli" }
Expand All @@ -19,4 +20,4 @@ log = "0.4"
tokio = "0.1.7"

[dev-dependencies]
substrate-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-keyring = { git = "https://github.com/paritytech/substrate", branch = "gui-polkadot-master" }
12 changes: 10 additions & 2 deletions collator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ 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 substrate_consensus_common as consensus_common;
extern crate tokio;

extern crate polkadot_cli;
Expand Down Expand Up @@ -82,6 +83,7 @@ use polkadot_network::validation::{ValidationNetwork, SessionParams};
use polkadot_network::NetworkService;
use tokio::timer::Timeout;
use consensus_authorities::AuthoritiesApi;
use consensus_common::SelectChain;

pub use polkadot_cli::VersionInfo;
pub use polkadot_network::validation::Incoming;
Expand Down Expand Up @@ -256,18 +258,24 @@ impl<P, E> Worker for CollationNode<P, E> where
let client = service.client();
let network = service.network();
let known_oracle = client.clone();
let select_chain = if let Some(select_chain) = service.select_chain() {
select_chain
} else {
info!("The node cannot work because it can't select chain.");
return Box::new(future::err(()));
};

let message_validator = polkadot_network::gossip::register_validator(
&*network,
move |block_hash: &Hash| {
use client::{BlockStatus, ChainHead};
use client::BlockStatus;
use polkadot_network::gossip::Known;

match known_oracle.block_status(&BlockId::hash(*block_hash)) {
Err(_) | Ok(BlockStatus::Unknown) | Ok(BlockStatus::Queued) => None,
Ok(BlockStatus::KnownBad) => Some(Known::Bad),
Ok(BlockStatus::InChainWithState) | Ok(BlockStatus::InChainPruned) =>
match known_oracle.leaves() {
match select_chain.leaves() {
Err(_) => None,
Ok(leaves) => if leaves.contains(block_hash) {
Some(Known::Leaf)
Expand Down
4 changes: 2 additions & 2 deletions erasure-coding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ edition = "2018"
polkadot-primitives = { path = "../primitives" }
reed-solomon-erasure = { git = "https://github.com/paritytech/reed-solomon-erasure" }
parity-codec = "3.0"
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "gui-polkadot-master" }
substrate-trie = { git = "https://github.com/paritytech/substrate", branch = "gui-polkadot-master" }
4 changes: 2 additions & 2 deletions executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ authors = ["Parity Technologies <admin@parity.io>"]
description = "Polkadot node implementation in Rust."

[dependencies]
substrate-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-executor = { git = "https://github.com/paritytech/substrate", branch = "gui-polkadot-master" }
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "gui-polkadot-master" }
polkadot-runtime = { path = "../runtime" }
10 changes: 5 additions & 5 deletions network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ polkadot-validation = { path = "../validation" }
polkadot-primitives = { path = "../primitives" }
parity-codec = "3.0"
parity-codec-derive = "3.0"
substrate-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sr-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-network = { git = "https://github.com/paritytech/substrate", branch = "gui-polkadot-master" }
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "gui-polkadot-master" }
sr-primitives = { git = "https://github.com/paritytech/substrate", branch = "gui-polkadot-master" }
futures = "0.1"
tokio = "0.1.7"
log = "0.4"
slice-group-by = "0.2.2"
exit-future = "0.1.4"

[dev-dependencies]
substrate-client = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-client = { git = "https://github.com/paritytech/substrate", branch = "gui-polkadot-master" }
substrate-keyring = { git = "https://github.com/paritytech/substrate", branch = "gui-polkadot-master" }
15 changes: 2 additions & 13 deletions network/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ use polkadot_primitives::parachain::{
ConsolidatedIngressRoots,
};
use substrate_primitives::crypto::UncheckedInto;
use sr_primitives::traits::Block as BlockT;
use codec::Encode;
use substrate_network::{
PeerId, PeerInfo, ClientHandle, Context, config::Roles,
message::{BlockRequest, generic::ConsensusMessage},
message::{BlockRequest, generic::{ConsensusMessage, FinalityProofRequest}},
specialization::NetworkSpecialization, generic_message::Message as GenericMessage
};

Expand All @@ -47,10 +48,6 @@ struct TestContext {
}

impl Context<Block> for TestContext {
fn client(&self) -> &ClientHandle<Block> {
unimplemented!()
}

fn report_peer(&mut self, peer: PeerId, reputation: i32) {
let reputation = self.reputations.get(&peer).map_or(reputation, |v| v + reputation);
self.reputations.insert(peer.clone(), reputation);
Expand All @@ -62,14 +59,6 @@ impl Context<Block> for TestContext {
}
}

fn peer_info(&self, _peer: &PeerId) -> Option<PeerInfo<Block>> {
unimplemented!()
}

fn send_block_request(&mut self, _who: PeerId, _request: BlockRequest<Block>) {
unimplemented!()
}

fn send_consensus(&mut self, _who: PeerId, _consensus: ConsensusMessage) {
unimplemented!()
}
Expand Down
4 changes: 2 additions & 2 deletions network/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,12 @@ impl Knowledge {
// generated by valid execution.
match *statement {
GenericStatement::Candidate(ref c) => {
let mut entry = self.candidates.entry(c.hash()).or_insert_with(Default::default);
let entry = self.candidates.entry(c.hash()).or_insert_with(Default::default);
entry.knows_block_data.push(from.clone());
entry.knows_extrinsic.push(from);
}
GenericStatement::Valid(ref hash) => {
let mut entry = self.candidates.entry(*hash).or_insert_with(Default::default);
let entry = self.candidates.entry(*hash).or_insert_with(Default::default);
entry.knows_block_data.push(from.clone());
entry.knows_extrinsic.push(from);
}
Expand Down
Binary file modified parachain/tests/res/adder.wasm
Binary file not shown.
12 changes: 6 additions & 6 deletions primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ serde = { version = "1.0", optional = true }
serde_derive = { version = "1.0", optional = true }
parity-codec = { version = "3.0", default-features = false }
parity-codec-derive = { version = "3.0", default-features = false }
substrate-primitives = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
substrate-client = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
sr-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
sr-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
sr-primitives = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
substrate-primitives = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
substrate-client = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
sr-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
sr-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
sr-primitives = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
polkadot-parachain = { path = "../parachain", default-features = false }

[dev-dependencies]
substrate-serializer = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-serializer = { git = "https://github.com/paritytech/substrate", branch = "gui-polkadot-master" }
pretty_assertions = "0.5.1"

[features]
Expand Down
56 changes: 28 additions & 28 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,39 @@ safe-mix = { version = "1.0", default-features = false}
polkadot-primitives = { path = "../primitives", default-features = false }
parity-codec = { version = "3.0", default-features = false }
parity-codec-derive = { version = "3.0", default-features = false }
substrate-serializer = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
sr-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
sr-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
srml-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
substrate-primitives = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
substrate-client = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
substrate-inherents = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
substrate-consensus-aura-primitives = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
substrate-offchain-primitives = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
srml-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
srml-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
srml-consensus = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
srml-council = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
srml-democracy = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
srml-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
srml-grandpa = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
srml-indices = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
sr-primitives = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
srml-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
srml-staking = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
srml-sudo = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
srml-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
srml-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
srml-treasury = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
sr-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
substrate-consensus-authorities = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
substrate-serializer = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
sr-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
sr-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
srml-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
substrate-primitives = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
substrate-client = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
substrate-inherents = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
substrate-consensus-aura-primitives = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
substrate-offchain-primitives = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
srml-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
srml-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
srml-consensus = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
srml-council = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
srml-democracy = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
srml-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
srml-grandpa = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
srml-indices = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
sr-primitives = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
srml-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
srml-staking = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
srml-sudo = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
srml-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
srml-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
srml-treasury = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
sr-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }
substrate-consensus-authorities = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "gui-polkadot-master" }

[dev-dependencies]
hex-literal = "0.1.0"
libsecp256k1 = "0.2.1"
tiny-keccak = "1.4.2"
substrate-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-keyring = { git = "https://github.com/paritytech/substrate", branch = "gui-polkadot-master" }
substrate-trie = { git = "https://github.com/paritytech/substrate", branch = "gui-polkadot-master" }
trie-db = "0.12"

[features]
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ pub type UncheckedExtrinsic = generic::UncheckedMortalCompactExtrinsic<Address,
/// Extrinsic type that has already been checked.
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Nonce, Call>;
/// Executive: handles dispatch to the various modules.
pub type Executive = executive::Executive<Runtime, Block, system::ChainContext<Runtime>, Balances, AllModules>;
pub type Executive = executive::Executive<Runtime, Block, system::ChainContext<Runtime>, Balances, Runtime, AllModules>;

impl_runtime_apis! {
impl client_api::Core<Block> for Runtime {
Expand Down
Loading

0 comments on commit ee0076f

Please sign in to comment.