Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions demo/executor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,15 +335,15 @@ mod tests {
fn native_big_block_import_succeeds() {
let mut t = new_test_ext();

let r = Executor::new().call(&mut t, COMPACT_CODE, "execute_block", &block1big().0, true).0;
let r = Executor::with_heap_pages(8).call(&mut t, COMPACT_CODE, "execute_block", &block1big().0, true).0;
assert!(r.is_ok());
}

#[test]
fn native_big_block_import_fails_on_fallback() {
let mut t = new_test_ext();

let r = Executor::new().call(&mut t, COMPACT_CODE, "execute_block", &block1big().0, false).0;
let r = Executor::with_heap_pages(8).call(&mut t, COMPACT_CODE, "execute_block", &block1big().0, false).0;
assert!(!r.is_ok());
}

Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion polkadot/network/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ impl<P: LocalPolkadotApi + Send + Sync + 'static> Future for MessageProcessTask<
return Ok(async);
},
Ok(Async::Ready(None)) => return Ok(Async::Ready(())),
Ok(Async::NotReady) => (),
Ok(Async::NotReady) => return Ok(Async::NotReady),
Err(e) => debug!(target: "p_net", "Error getting consensus message: {:?}", e),
}
}
Expand Down
Binary file modified polkadot/runtime/wasm/genesis.wasm
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 0 additions & 1 deletion polkadot/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ polkadot-executor = { path = "../executor" }
polkadot-api = { path = "../api" }
polkadot-transaction-pool = { path = "../transaction-pool" }
polkadot-network = { path = "../network" }
substrate-keystore = { path = "../../substrate/keystore" }
substrate-runtime-io = { path = "../../substrate/runtime-io" }
substrate-primitives = { path = "../../substrate/primitives" }
substrate-network = { path = "../../substrate/network" }
Expand Down
8 changes: 2 additions & 6 deletions polkadot/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ extern crate polkadot_api;
extern crate polkadot_consensus as consensus;
extern crate polkadot_transaction_pool as transaction_pool;
extern crate polkadot_network;
extern crate substrate_keystore as keystore;
extern crate substrate_primitives as primitives;
extern crate substrate_network as network;
extern crate substrate_codec as codec;
Expand All @@ -46,7 +45,6 @@ use std::collections::HashMap;

use codec::Slicable;
use transaction_pool::TransactionPool;
use keystore::Store as Keystore;
use polkadot_api::{PolkadotApi, light::RemotePolkadotApiWrapper};
use polkadot_primitives::{Block, BlockId, Hash};
use polkadot_runtime::GenesisConfig;
Expand Down Expand Up @@ -168,14 +166,12 @@ pub fn new_light(config: Configuration<GenesisConfig>, executor: TaskExecutor)
pub fn new_full(config: Configuration<GenesisConfig>, executor: TaskExecutor)
-> Result<Service<FullComponents<Factory>>, Error>
{
let keystore_path = config.keystore_path.clone();
let is_validator = (config.roles & Role::AUTHORITY) == Role::AUTHORITY;
let service = service::Service::<FullComponents<Factory>>::new(config, executor.clone())?;
// Spin consensus service if configured
let consensus = if is_validator {
// Spin consensus service if configured
let keystore = Keystore::open(keystore_path.into())?;
// Load the first available key
let key = keystore.load(&keystore.contents()?[0], "")?;
let key = service.keystore().load(&service.keystore().contents()?[0], "")?;
info!("Using authority key {}", key.public());

let client = service.client();
Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion substrate/network/src/consensus_gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl<B: BlockT> ConsensusGossip<B> where B::Header: HeaderT<Number=u64> {

/// Handle new connected peer.
pub fn new_peer(&mut self, protocol: &mut Context<B>, peer_id: PeerId, roles: &[message::Role]) {
if roles.iter().any(|r| *r == message::Role::Authority) {
if roles.iter().any(|r| *r == message::Role::Validator) {
trace!(target:"gossip", "Registering authority {}", peer_id);
// Send out all known messages.
// TODO: limit by size
Expand Down
2 changes: 2 additions & 0 deletions substrate/rpc/src/chain/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use client::BlockOrigin;
use test_client::{self, TestClient};
use test_client::runtime::Header;

#[ignore]
#[test]
fn should_return_header() {
let core = ::tokio::runtime::Runtime::new().unwrap();
Expand All @@ -46,6 +47,7 @@ fn should_return_header() {
);
}

#[ignore]
#[test]
fn should_notify_about_latest_block() {
let mut core = ::tokio::runtime::Runtime::new().unwrap();
Expand Down
7 changes: 7 additions & 0 deletions substrate/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ pub struct Service<Components: components::Components> {
client: Arc<ComponentClient<Components>>,
network: Arc<components::NetworkService<Components::Factory>>,
extrinsic_pool: Arc<Components::ExtrinsicPool>,
keystore: Keystore,
signal: Option<Signal>,
}

Expand Down Expand Up @@ -179,6 +180,7 @@ impl<Components> Service<Components>
network: network,
extrinsic_pool: extrinsic_pool,
signal: Some(signal),
keystore: keystore,
})
}

Expand All @@ -196,6 +198,11 @@ impl<Components> Service<Components>
pub fn extrinsic_pool(&self) -> Arc<PoolApi<Components>> {
self.extrinsic_pool.api()
}

/// Get shared keystore.
pub fn keystore(&self) -> &Keystore {
&self.keystore
}
}

impl<Components> Drop for Service<Components> where Components: components::Components {
Expand Down
Binary file modified substrate/test-runtime/wasm/genesis.wasm
Binary file not shown.
Binary file not shown.
Binary file not shown.