Remove old service, 3rd try (#1776)

* Remove old service, 3rd try

i.e.
Revert "Revert "Remove Old Service, 2nd try (#1732)" (#1758)"

This reverts commit 9a0f08bfe1.

Closes #1757.

We now have some evidence that the polkadot validator was producing
blocks after all; the reason the blocks_constructed metric was 0 was
that as a new metric it hadn't yet been incorporated into that
branch's codebase. See
https://github.com/paritytech/polkadot/issues/1757#issuecomment-700977602

As this PR is based on a newer `master` branch than the previous one,
that should hopefully no longer be an issue.

* paras trait now has an Origin type

* initial work running a two node local net

* use the right incantations so the nodes produce blocks together

* improve internal documentation

Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
Peter Goodspeed-Niklaus
2020-10-08 12:54:29 +02:00
committed by GitHub
parent f2d7b6f5ac
commit c2941a2789
32 changed files with 1299 additions and 3146 deletions
+2 -1
View File
@@ -13,10 +13,11 @@ rand = "0.7.3"
tempfile = "3.1.0"
# Polkadot dependencies
polkadot-overseer = { path = "../overseer" }
polkadot-primitives = { path = "../../primitives" }
polkadot-rpc = { path = "../../rpc" }
polkadot-runtime-common = { path = "../../runtime/common" }
polkadot-service = { path = "../../service" }
polkadot-service = { path = "../service" }
polkadot-test-runtime = { path = "../../runtime/test-runtime" }
# Substrate dependencies
+14 -23
View File
@@ -22,12 +22,13 @@ mod chain_spec;
pub use chain_spec::*;
use futures::future::Future;
use polkadot_overseer::OverseerHandler;
use polkadot_primitives::v0::{
Block, Hash, CollatorId, Id as ParaId,
Block, CollatorId, Id as ParaId,
};
use polkadot_runtime_common::BlockHashCount;
use polkadot_service::{
new_full, NewFull, FullNodeHandles, AbstractClient, ClientHandle, ExecuteWithClient,
new_full, NewFull, FullClient, AbstractClient, ClientHandle, ExecuteWithClient,
};
use polkadot_test_runtime::{Runtime, SignedExtra, SignedPayload, VERSION};
use sc_chain_spec::ChainSpec;
@@ -36,7 +37,7 @@ use sc_executor::native_executor_instance;
use sc_informant::OutputFormat;
use sc_network::{
config::{NetworkConfiguration, TransportConfig},
multiaddr, NetworkService,
multiaddr,
};
use service::{
config::{DatabaseConfig, KeystoreConfig, MultiaddrWithPeerId, WasmExecutionMethod},
@@ -65,25 +66,15 @@ pub fn polkadot_test_new_full(
collating_for: Option<(CollatorId, ParaId)>,
authority_discovery_enabled: bool,
) -> Result<
(
TaskManager,
Arc<polkadot_service::FullClient<polkadot_test_runtime::RuntimeApi, PolkadotTestExecutor>>,
FullNodeHandles,
Arc<NetworkService<Block, Hash>>,
RpcHandlers,
),
NewFull<Arc<FullClient<polkadot_test_runtime::RuntimeApi, PolkadotTestExecutor>>>,
ServiceError,
> {
let NewFull { task_manager, client, node_handles, network, rpc_handlers, .. } =
new_full::<polkadot_test_runtime::RuntimeApi, PolkadotTestExecutor>(
config,
collating_for,
authority_discovery_enabled,
None,
true,
)?;
Ok((task_manager, client, node_handles, network, rpc_handlers))
new_full::<polkadot_test_runtime::RuntimeApi, PolkadotTestExecutor>(
config,
collating_for,
authority_discovery_enabled,
None,
).map_err(Into::into)
}
/// A wrapper for the test client that implements `ClientHandle`.
@@ -206,7 +197,7 @@ pub fn run_test_node(
let config = node_config(storage_update_func, task_executor, key, boot_nodes);
let multiaddr = config.network.listen_addresses[0].clone();
let authority_discovery_enabled = false;
let (task_manager, client, handles, network, rpc_handlers) =
let NewFull {task_manager, client, network, rpc_handlers, node_handles, ..} =
polkadot_test_new_full(config, None, authority_discovery_enabled)
.expect("could not create Polkadot test service");
@@ -216,7 +207,7 @@ pub fn run_test_node(
PolkadotTestNode {
task_manager,
client,
handles,
handles: node_handles,
addr,
rpc_handlers,
}
@@ -229,7 +220,7 @@ pub struct PolkadotTestNode<S, C> {
/// Client's instance.
pub client: Arc<C>,
/// Node's handles.
pub handles: FullNodeHandles,
pub handles: OverseerHandler,
/// The `MultiaddrWithPeerId` to this node. This is useful if you want to pass it as "boot node" to other nodes.
pub addr: MultiaddrWithPeerId,
/// RPCHandlers to make RPC queries.