Remove service, migrate all to service-new (#1630)

* import rococo into chain-spec

* make a few stabs at moving forward

* wip: rococo readme

* remove /service crate

- Move the chain-spec files to node-service
- update sufficient cargo files that polkadot-service-new builds
- not everything else builds yet

* wip: chase down some build errors in polkadot-cli

There's a lot more to go, but some progress has happened.

* make more progress getting polkadot-cli to build

* don't ignore polkadot.json within the res directory

* don't recreate pathbufs

* Prepare Polkadot to be used by Cumulus

This begins to make Polkadot usable from Cumulus.

* Remove old test

* migrate new_chain_ops fix from /service

* partially remove node/test-service

* Reset some changes

* Revert "partially remove node/test-service"

This reverts commit 7b8f9ba5bfc286a309df89853ae11facf3277ffb.

* WIP: replace v0 ParachainHost impl with v1 for test runtime

This is necessary because one of the current errors when building
the test service boils down to:

the trait bound `polkadot_test_runtime::RuntimeApiImpl<...>`:
  `polkadot_primitives::v1::ParachainHost<...>` is not satisfied

This is WIP because it appears to be causing some std leakage into
the wasm environment, or something; the compiler is currently
complaining about duplicate definitions of `panic_handler` and `oom`.
Presumably I have to identify all std types (Vec etc) and replace
them with sp_std equivalents.

* fix test runtime build

it wasn't std leakage, after all

* bump westend spec version

* use service-new as service within cli

* to revert: demo that forwarding the test runtime to the real impl blows up

* Revert "to revert: demo that forwarding the test runtime to the real impl blows up"

This reverts commit 68d2f385f378721c7433e3e39133434610cd2a51.

* Revert "Revert "to revert: demo that forwarding the test runtime to the real impl blows up""

This reverts commit 04cb1cbf8873b4429cb9c9fdccb7f4bb137dc720.

Might have just forgotten to disable default features

* More reverts

* MOARE

* plug in the runtime as the generic instantiation

This feels closer to a solution, but it still has problems: in particular,
it's assumed that Runtime implements all appropriate Trait traits,
which this one apparently does not.

* implement necessary traits to get the test runtime compiling

This is almost certainly not correct in some way; it really
looks like I need to mess with the construct_runtime! macro
somehow, to inject the inclusion trait's event type as a Event
variant. Still, better lock down this changeset while it all
compiles.

* add inclusion::Event as variant into Event enum

* implement unimplemented bits in kusama

* implement unimplemented bits in polkadot runtime

* implement unimplemented bits in westend runtime

* migrate client upgrades from master

* update test service with new node changes

* package metadata--that wasn't intended to be removed

* add parachains v1 modules to each runtime

It's not clear what precisely this does, but it's probably the right
thing to do.

* enable cli to opt out of full node features

* adjust rococo chainspec per example

https://github.com/paritytech/polkadot/blob/26f1fa47f7836ab4bee5d4aad127ebce748320dd/service/src/chain_spec.rs#L362

* try to fix Cargo.lock

Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Andronik Ordian <write@reusable.software>
This commit is contained in:
Peter Goodspeed-Niklaus
2020-09-18 10:27:54 +02:00
committed by GitHub
parent 23c1760b48
commit d531ba561c
31 changed files with 1293 additions and 3145 deletions
+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.