Rename rococo-collator to polkadot-collator (#435)

* Rename `rococo-collator` to `polkadot-collator`

Also contains some other small changes.

* Test fixes and some further search&replace
This commit is contained in:
Bastian Köcher
2021-05-12 17:53:22 +02:00
committed by GitHub
parent 8cd71668a3
commit 3194febb1f
30 changed files with 239 additions and 291 deletions
+121 -132
View File
@@ -1606,6 +1606,54 @@ dependencies = [
"xcm",
]
[[package]]
name = "cumulus-rococo-parachain-runtime"
version = "0.1.0"
dependencies = [
"cumulus-pallet-aura-ext",
"cumulus-pallet-dmp-queue",
"cumulus-pallet-parachain-system",
"cumulus-pallet-xcm",
"cumulus-pallet-xcmp-queue",
"cumulus-ping",
"cumulus-primitives-core",
"cumulus-primitives-utility",
"frame-executive",
"frame-support",
"frame-system",
"hex",
"hex-literal 0.3.1",
"log",
"pallet-assets",
"pallet-aura",
"pallet-balances",
"pallet-randomness-collective-flip",
"pallet-sudo",
"pallet-timestamp",
"pallet-transaction-payment",
"pallet-xcm",
"parachain-info",
"parity-scale-codec",
"polkadot-parachain",
"serde",
"sp-api",
"sp-block-builder",
"sp-consensus-aura",
"sp-core",
"sp-inherents",
"sp-io",
"sp-offchain",
"sp-runtime",
"sp-session",
"sp-std",
"sp-transaction-pool",
"sp-version",
"substrate-wasm-builder 4.0.0",
"xcm",
"xcm-builder",
"xcm-executor",
]
[[package]]
name = "cumulus-shell-runtime"
version = "0.1.0"
@@ -1624,7 +1672,6 @@ dependencies = [
"parachain-info",
"parity-scale-codec",
"polkadot-parachain",
"rococo-parachain-primitives",
"serde",
"sp-api",
"sp-block-builder",
@@ -1672,55 +1719,6 @@ dependencies = [
"substrate-test-client",
]
[[package]]
name = "cumulus-test-parachain-runtime"
version = "0.1.0"
dependencies = [
"cumulus-pallet-aura-ext",
"cumulus-pallet-dmp-queue",
"cumulus-pallet-parachain-system",
"cumulus-pallet-xcm",
"cumulus-pallet-xcmp-queue",
"cumulus-ping",
"cumulus-primitives-core",
"cumulus-primitives-utility",
"frame-executive",
"frame-support",
"frame-system",
"hex",
"hex-literal 0.3.1",
"log",
"pallet-assets",
"pallet-aura",
"pallet-balances",
"pallet-randomness-collective-flip",
"pallet-sudo",
"pallet-timestamp",
"pallet-transaction-payment",
"pallet-xcm",
"parachain-info",
"parity-scale-codec",
"polkadot-parachain",
"rococo-parachain-primitives",
"serde",
"sp-api",
"sp-block-builder",
"sp-consensus-aura",
"sp-core",
"sp-inherents",
"sp-io",
"sp-offchain",
"sp-runtime",
"sp-session",
"sp-std",
"sp-transaction-pool",
"sp-version",
"substrate-wasm-builder 4.0.0",
"xcm",
"xcm-builder",
"xcm-executor",
]
[[package]]
name = "cumulus-test-relay-sproof-builder"
version = "0.1.0"
@@ -6063,6 +6061,79 @@ dependencies = [
"try-runtime-cli",
]
[[package]]
name = "polkadot-collator"
version = "0.1.0"
dependencies = [
"assert_cmd",
"cumulus-client-cli",
"cumulus-client-collator",
"cumulus-client-consensus-aura",
"cumulus-client-consensus-common",
"cumulus-client-consensus-relay-chain",
"cumulus-client-network",
"cumulus-client-service",
"cumulus-primitives-core",
"cumulus-primitives-parachain-inherent",
"cumulus-rococo-parachain-runtime",
"cumulus-shell-runtime",
"derive_more 0.15.0",
"exit-future 0.1.4",
"futures 0.3.14",
"hex-literal 0.2.1",
"jsonrpc-core",
"log",
"nix",
"pallet-sudo",
"parity-scale-codec",
"parking_lot 0.9.0",
"polkadot-cli",
"polkadot-parachain",
"polkadot-primitives",
"polkadot-runtime-common",
"polkadot-service",
"polkadot-test-client",
"polkadot-test-runtime",
"polkadot-test-service",
"rand 0.7.3",
"sc-basic-authorship",
"sc-chain-spec",
"sc-cli",
"sc-client-api",
"sc-consensus",
"sc-executor",
"sc-finality-grandpa",
"sc-network",
"sc-rpc",
"sc-service",
"sc-telemetry",
"sc-tracing",
"sc-transaction-pool",
"serde",
"sp-api",
"sp-block-builder",
"sp-blockchain",
"sp-consensus",
"sp-consensus-aura",
"sp-core",
"sp-inherents",
"sp-io",
"sp-keystore",
"sp-offchain",
"sp-runtime",
"sp-session",
"sp-timestamp",
"sp-transaction-pool",
"structopt",
"substrate-build-script-utils",
"substrate-prometheus-endpoint",
"substrate-test-client",
"substrate-test-runtime-client",
"tempfile",
"tokio 0.2.24",
"trie-root 0.15.2",
]
[[package]]
name = "polkadot-collator-protocol"
version = "0.1.0"
@@ -7777,88 +7848,6 @@ dependencies = [
"librocksdb-sys",
]
[[package]]
name = "rococo-collator"
version = "0.1.0"
dependencies = [
"assert_cmd",
"cumulus-client-cli",
"cumulus-client-collator",
"cumulus-client-consensus-aura",
"cumulus-client-consensus-common",
"cumulus-client-consensus-relay-chain",
"cumulus-client-network",
"cumulus-client-service",
"cumulus-primitives-core",
"cumulus-primitives-parachain-inherent",
"cumulus-shell-runtime",
"cumulus-test-parachain-runtime",
"derive_more 0.15.0",
"exit-future 0.1.4",
"futures 0.3.14",
"hex-literal 0.2.1",
"jsonrpc-core",
"log",
"nix",
"pallet-sudo",
"parity-scale-codec",
"parking_lot 0.9.0",
"polkadot-cli",
"polkadot-parachain",
"polkadot-primitives",
"polkadot-runtime-common",
"polkadot-service",
"polkadot-test-client",
"polkadot-test-runtime",
"polkadot-test-service",
"rand 0.7.3",
"rococo-parachain-primitives",
"sc-basic-authorship",
"sc-chain-spec",
"sc-cli",
"sc-client-api",
"sc-consensus",
"sc-executor",
"sc-finality-grandpa",
"sc-network",
"sc-rpc",
"sc-service",
"sc-telemetry",
"sc-tracing",
"sc-transaction-pool",
"serde",
"sp-api",
"sp-block-builder",
"sp-blockchain",
"sp-consensus",
"sp-consensus-aura",
"sp-core",
"sp-inherents",
"sp-io",
"sp-keystore",
"sp-offchain",
"sp-runtime",
"sp-session",
"sp-timestamp",
"sp-transaction-pool",
"structopt",
"substrate-build-script-utils",
"substrate-prometheus-endpoint",
"substrate-test-client",
"substrate-test-runtime-client",
"tempfile",
"tokio 0.2.24",
"trie-root 0.15.2",
]
[[package]]
name = "rococo-parachain-primitives"
version = "0.1.0"
dependencies = [
"sp-core",
"sp-runtime",
]
[[package]]
name = "rococo-runtime"
version = "0.9.0"
+5 -6
View File
@@ -14,12 +14,11 @@ members = [
"primitives/core",
"primitives/parachain-inherent",
"primitives/utility",
"rococo-parachains/",
"rococo-parachains/pallets/parachain-info",
"rococo-parachains/pallets/ping",
"rococo-parachains/primitives",
"rococo-parachains/runtime",
"rococo-parachains/shell-runtime",
"polkadot-parachains/",
"polkadot-parachains/pallets/parachain-info",
"polkadot-parachains/pallets/ping",
"polkadot-parachains/rococo-runtime",
"polkadot-parachains/shell-runtime",
"test/runtime",
"test/runtime-upgrade",
"test/client",
+7 -7
View File
@@ -50,14 +50,14 @@ eventually be included by the relay chain for a parachain.
To run a Rococo collator you will need to compile the following binary:
```
cargo build --release -p rococo-collator
cargo build --release -p polkadot-collator
```
Once the executable is built, launch collators for each parachain (repeat once each for chain
`tick`, `trick`, `track`):
```
./target/release/rococo-collator --chain $CHAIN --validator
./target/release/polkadot-collator --chain $CHAIN --validator
```
## Parachains
@@ -105,19 +105,19 @@ cargo build --release
# Export genesis state
# --parachain-id 200 as an example that can be chosen freely. Make sure to everywhere use the same parachain id
./target/release/rococo-collator export-genesis-state --parachain-id 200 > genesis-state
./target/release/polkadot-collator export-genesis-state --parachain-id 200 > genesis-state
# Export genesis wasm
./target/release/rococo-collator export-genesis-wasm > genesis-wasm
./target/release/polkadot-collator export-genesis-wasm > genesis-wasm
# Collator1
./target/release/rococo-collator --collator --tmp --parachain-id <parachain_id_u32_type_range> --port 40335 --ws-port 9946 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30335
./target/release/polkadot-collator --collator --tmp --parachain-id <parachain_id_u32_type_range> --port 40335 --ws-port 9946 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30335
# Collator2
./target/release/rococo-collator --collator --tmp --parachain-id <parachain_id_u32_type_range> --port 40336 --ws-port 9947 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30336
./target/release/polkadot-collator --collator --tmp --parachain-id <parachain_id_u32_type_range> --port 40336 --ws-port 9947 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30336
# Parachain Full Node 1
./target/release/rococo-collator --tmp --parachain-id <parachain_id_u32_type_range> --port 40337 --ws-port 9948 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30337
./target/release/polkadot-collator --tmp --parachain-id <parachain_id_u32_type_range> --port 40337 --ws-port 9948 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30337
```
### Register the parachain
![image](https://user-images.githubusercontent.com/2915325/99548884-1be13580-2987-11eb-9a8b-20be658d34f9.png)
@@ -1,12 +1,12 @@
[package]
name = "rococo-collator"
name = "polkadot-collator"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs"
edition = "2018"
[[bin]]
name = "rococo-collator"
name = "polkadot-collator"
path = "src/main.rs"
[dependencies]
@@ -21,10 +21,9 @@ structopt = "0.3.3"
serde = { version = "1.0.101", features = ["derive"] }
hex-literal = "0.2.1"
# Parachain dependencies
parachain-runtime = { package = "cumulus-test-parachain-runtime", path = "runtime" }
# Parachain runtimes
rococo-parachain-runtime = { package = "cumulus-rococo-parachain-runtime", path = "rococo-runtime" }
shell-runtime = { package = "cumulus-shell-runtime", path = "shell-runtime" }
rococo-parachain-primitives = { path = "primitives" }
# Substrate dependencies
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
@@ -1,15 +1,15 @@
[package]
name = 'cumulus-test-parachain-runtime'
name = 'cumulus-rococo-parachain-runtime'
version = '0.1.0'
authors = ["Parity Technologies <admin@parity.io>"]
edition = '2018'
description = "Simple runtime used by the rococo parachain(s)"
[dependencies]
serde = { version = "1.0.101", optional = true, features = ["derive"] }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
log = { version = "0.4.14", default-features = false }
parachain-info = { path = "../pallets/parachain-info", default-features = false }
rococo-parachain-primitives = { path = "../primitives", default-features = false }
# Substrate dependencies
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
@@ -44,7 +44,7 @@ cumulus-primitives-utility = { path = "../../primitives/utility", default-featur
cumulus-pallet-dmp-queue = { path = "../../pallets/dmp-queue", default-features = false }
cumulus-pallet-xcmp-queue = { path = "../../pallets/xcmp-queue", default-features = false }
cumulus-pallet-xcm = { path = "../../pallets/xcm", default-features = false }
cumulus-ping = { path = "../../rococo-parachains/pallets/ping", default-features = false }
cumulus-ping = { path = "../pallets/ping", default-features = false }
# Polkadot dependencies
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
@@ -87,7 +87,6 @@ std = [
"pallet-sudo/std",
"pallet-transaction-payment/std",
"parachain-info/std",
"rococo-parachain-primitives/std",
"cumulus-pallet-aura-ext/std",
"cumulus-pallet-dmp-queue/std",
"cumulus-pallet-parachain-system/std",
@@ -22,7 +22,6 @@
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
use rococo_parachain_primitives::*;
use sp_api::impl_runtime_apis;
use sp_core::OpaqueMetadata;
use sp_runtime::{
@@ -427,7 +426,7 @@ impl pallet_aura::Config for Runtime {
construct_runtime! {
pub enum Runtime where
Block = Block,
NodeBlock = rococo_parachain_primitives::Block,
NodeBlock = generic::Block<Header, sp_runtime::OpaqueExtrinsic>,
UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
@@ -455,6 +454,19 @@ construct_runtime! {
}
}
/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
pub type Signature = sp_runtime::MultiSignature;
/// Some way of identifying an account on the chain. We intentionally make it equivalent
/// to the public key of our transaction signing scheme.
pub type AccountId = <<Signature as sp_runtime::traits::Verify>::Signer as sp_runtime::traits::IdentifyAccount>::AccountId;
/// Balance of an account.
pub type Balance = u128;
/// Index of a transaction in the chain.
pub type Index = u32;
/// A hash of some data used by the chain.
pub type Hash = sp_core::H256;
/// An index to a block.
pub type BlockNumber = u32;
/// The address format for describing accounts.
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
/// Block header type as expected by this runtime.
@@ -9,7 +9,6 @@ serde = { version = "1.0.101", optional = true, features = ["derive"] }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
log = { version = "0.4.14", default-features = false }
parachain-info = { path = "../pallets/parachain-info", default-features = false }
rococo-parachain-primitives = { path = "../primitives", default-features = false }
# Substrate dependencies
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
@@ -69,7 +68,6 @@ std = [
"frame-executive/std",
"frame-system/std",
"parachain-info/std",
"rococo-parachain-primitives/std",
"cumulus-pallet-parachain-system/std",
"cumulus-pallet-dmp-queue/std",
"cumulus-pallet-xcm/std",
@@ -22,7 +22,6 @@
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
use rococo_parachain_primitives::*;
use sp_api::impl_runtime_apis;
use sp_core::OpaqueMetadata;
use sp_runtime::{
@@ -222,7 +221,7 @@ impl cumulus_pallet_xcm::Config for Runtime {
construct_runtime! {
pub enum Runtime where
Block = Block,
NodeBlock = rococo_parachain_primitives::Block,
NodeBlock = generic::Block<Header, sp_runtime::OpaqueExtrinsic>,
UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
@@ -260,6 +259,17 @@ impl sp_runtime::traits::SignedExtension for DisallowSigned {
}
}
/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
pub type Signature = sp_runtime::MultiSignature;
/// Some way of identifying an account on the chain. We intentionally make it equivalent
/// to the public key of our transaction signing scheme.
pub type AccountId = <<Signature as sp_runtime::traits::Verify>::Signer as sp_runtime::traits::IdentifyAccount>::AccountId;
/// Index of a transaction in the chain.
pub type Index = u32;
/// A hash of some data used by the chain.
pub type Hash = sp_core::H256;
/// An index to a block.
pub type BlockNumber = u32;
/// The address format for describing accounts.
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
/// Block header type as expected by this runtime.
@@ -16,16 +16,15 @@
use cumulus_primitives_core::ParaId;
use hex_literal::hex;
use parachain_runtime::AuraId;
use rococo_parachain_primitives::{AccountId, Signature};
use rococo_parachain_runtime::{AccountId, AuraId, Signature};
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
use sc_service::ChainType;
use serde::{Deserialize, Serialize};
use sp_core::{sr25519, Pair, Public, crypto::UncheckedInto};
use sp_core::{crypto::UncheckedInto, sr25519, Pair, Public};
use sp_runtime::traits::{IdentifyAccount, Verify};
/// Specialized `ChainSpec` for the normal parachain runtime.
pub type ChainSpec = sc_service::GenericChainSpec<parachain_runtime::GenesisConfig, Extensions>;
pub type ChainSpec = sc_service::GenericChainSpec<rococo_parachain_runtime::GenesisConfig, Extensions>;
/// Specialized `ChainSpec` for the shell parachain runtime.
pub type ShellChainSpec = sc_service::GenericChainSpec<shell_runtime::GenesisConfig, Extensions>;
@@ -131,9 +130,11 @@ pub fn staging_test_net(id: ParaId) -> ChainSpec {
hex!["9ed7705e3c7da027ba0583a22a3212042f7e715d3c168ba14f1424e2bc111d00"].into(),
vec![
// $secret//one
hex!["aad9fa2249f87a210a0f93400b7f90e47b810c6d65caa0ca3f5af982904c2a33"].unchecked_into(),
hex!["aad9fa2249f87a210a0f93400b7f90e47b810c6d65caa0ca3f5af982904c2a33"]
.unchecked_into(),
// $secret//two
hex!["d47753f0cca9dd8da00c70e82ec4fc5501a69c49a5952a643d18802837c88212"].unchecked_into(),
hex!["d47753f0cca9dd8da00c70e82ec4fc5501a69c49a5952a643d18802837c88212"]
.unchecked_into(),
],
vec![
hex!["9ed7705e3c7da027ba0583a22a3212042f7e715d3c168ba14f1424e2bc111d00"].into(),
@@ -157,24 +158,24 @@ fn testnet_genesis(
initial_authorities: Vec<AuraId>,
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> parachain_runtime::GenesisConfig {
parachain_runtime::GenesisConfig {
frame_system: parachain_runtime::SystemConfig {
code: parachain_runtime::WASM_BINARY
) -> rococo_parachain_runtime::GenesisConfig {
rococo_parachain_runtime::GenesisConfig {
frame_system: rococo_parachain_runtime::SystemConfig {
code: rococo_parachain_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
changes_trie_config: Default::default(),
},
pallet_balances: parachain_runtime::BalancesConfig {
pallet_balances: rococo_parachain_runtime::BalancesConfig {
balances: endowed_accounts
.iter()
.cloned()
.map(|k| (k, 1 << 60))
.collect(),
},
pallet_sudo: parachain_runtime::SudoConfig { key: root_key },
parachain_info: parachain_runtime::ParachainInfoConfig { parachain_id: id },
pallet_aura: parachain_runtime::AuraConfig {
pallet_sudo: rococo_parachain_runtime::SudoConfig { key: root_key },
parachain_info: rococo_parachain_runtime::ParachainInfoConfig { parachain_id: id },
pallet_aura: rococo_parachain_runtime::AuraConfig {
authorities: initial_authorities,
},
cumulus_pallet_aura_ext: Default::default(),
@@ -22,7 +22,6 @@ use codec::Encode;
use cumulus_client_service::genesis::generate_genesis_block;
use cumulus_primitives_core::ParaId;
use log::info;
use parachain_runtime::Block;
use polkadot_parachain::primitives::AccountIdConversion;
use sc_cli::{
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
@@ -58,7 +57,7 @@ fn load_spec(
impl SubstrateCli for Cli {
fn impl_name() -> String {
"Cumulus Test Parachain Collator".into()
"Polkadot collator".into()
}
fn impl_version() -> String {
@@ -67,7 +66,7 @@ impl SubstrateCli for Cli {
fn description() -> String {
format!(
"Cumulus test parachain collator\n\nThe command-line arguments provided first will be \
"Polkadot collator\n\nThe command-line arguments provided first will be \
passed to the parachain node, while the arguments provided after -- will be passed \
to the relaychain node.\n\n\
{} [parachain-args] -- [relaychain-args]",
@@ -91,14 +90,18 @@ impl SubstrateCli for Cli {
load_spec(id, self.run.parachain_id.unwrap_or(100).into())
}
fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
&parachain_runtime::VERSION
fn native_runtime_version(chain_spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
if use_shell_runtime(chain_spec) {
&shell_runtime::VERSION
} else {
&rococo_parachain_runtime::VERSION
}
}
}
impl SubstrateCli for RelayChainCli {
fn impl_name() -> String {
"Cumulus Test Parachain Collator".into()
"Polkadot collator".into()
}
fn impl_version() -> String {
@@ -106,11 +109,13 @@ impl SubstrateCli for RelayChainCli {
}
fn description() -> String {
"Cumulus test parachain collator\n\nThe command-line arguments provided first will be \
format!(
"Polkadot collator\n\nThe command-line arguments provided first will be \
passed to the parachain node, while the arguments provided after -- will be passed \
to the relaychain node.\n\n\
rococo-collator [parachain-args] -- [relaychain-args]"
.into()
{} [parachain-args] -- [relaychain-args]",
Self::executable_name()
)
}
fn author() -> String {
@@ -148,7 +153,7 @@ fn use_shell_runtime(chain_spec: &Box<dyn ChainSpec>) -> bool {
chain_spec.id().starts_with("track") || chain_spec.id().starts_with("shell")
}
use crate::service::{new_partial, RuntimeExecutor, ShellRuntimeExecutor};
use crate::service::{new_partial, RococoParachainRuntimeExecutor, ShellRuntimeExecutor};
macro_rules! construct_async_run {
(|$components:ident, $cli:ident, $cmd:ident, $config:ident| $( $code:tt )* ) => {{
@@ -164,9 +169,13 @@ macro_rules! construct_async_run {
})
} else {
runner.async_run(|$config| {
let $components = new_partial::<parachain_runtime::RuntimeApi, RuntimeExecutor, _>(
let $components = new_partial::<
rococo_parachain_runtime::RuntimeApi,
RococoParachainRuntimeExecutor,
_
>(
&$config,
crate::service::build_import_queue,
crate::service::rococo_parachain_build_import_queue,
)?;
let task_manager = $components.task_manager;
{ $( $code )* }.map(|v| (v, task_manager))
@@ -233,7 +242,7 @@ pub fn run() -> Result<()> {
builder.with_profiling(sc_tracing::TracingReceiver::Log, "");
let _ = builder.init();
let block: Block = generate_genesis_block(&load_spec(
let block: crate::service::Block = generate_genesis_block(&load_spec(
&params.chain.clone().unwrap_or_default(),
params.parachain_id.unwrap_or(100).into(),
)?)?;
@@ -296,22 +305,26 @@ pub fn run() -> Result<()> {
let parachain_account =
AccountIdConversion::<polkadot_primitives::v0::AccountId>::into_account(&id);
let block: Block =
let block: crate::service::Block =
generate_genesis_block(&config.chain_spec).map_err(|e| format!("{:?}", e))?;
let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));
let task_executor = config.task_executor.clone();
let polkadot_config = SubstrateCli::create_configuration(
&polkadot_cli,
&polkadot_cli,
task_executor,
)
.map_err(|err| format!("Relay chain argument error: {}", err))?;
let polkadot_config =
SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, task_executor)
.map_err(|err| format!("Relay chain argument error: {}", err))?;
info!("Parachain id: {:?}", id);
info!("Parachain Account: {}", parachain_account);
info!("Parachain genesis state: {}", genesis_state);
info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" });
info!(
"Is collating: {}",
if config.role.is_authority() {
"yes"
} else {
"no"
}
);
if use_shell {
crate::service::start_shell_node(config, key, polkadot_config, id)
@@ -319,7 +332,7 @@ pub fn run() -> Result<()> {
.map(|r| r.0)
.map_err(Into::into)
} else {
crate::service::start_node(config, key, polkadot_config, id)
crate::service::start_rococo_parachain_node(config, key, polkadot_config, id)
.await
.map(|r| r.0)
.map_err(Into::into)
@@ -23,8 +23,7 @@ use cumulus_client_service::{
prepare_node_config, start_collator, start_full_node, StartCollatorParams, StartFullNodeParams,
};
use cumulus_primitives_core::ParaId;
use polkadot_primitives::v0::CollatorPair;
use rococo_parachain_primitives::{Block, Hash};
use polkadot_primitives::v1::CollatorPair;
use sc_client_api::ExecutorProvider;
use sc_executor::native_executor_instance;
@@ -40,11 +39,16 @@ use substrate_prometheus_endpoint::Registry;
pub use sc_executor::NativeExecutor;
type BlockNumber = u32;
type Header = sp_runtime::generic::Header<BlockNumber, sp_runtime::traits::BlakeTwo256>;
pub type Block = sp_runtime::generic::Block<Header, sp_runtime::OpaqueExtrinsic>;
type Hash = sp_core::H256;
// Native executor instance.
native_executor_instance!(
pub RuntimeExecutor,
parachain_runtime::api::dispatch,
parachain_runtime::native_version,
pub RococoParachainRuntimeExecutor,
rococo_parachain_runtime::api::dispatch,
rococo_parachain_runtime::native_version,
);
// Native executor instance.
@@ -320,16 +324,16 @@ where
Ok((task_manager, client))
}
/// Build the import queue for the "default" runtime.
pub fn build_import_queue(
client: Arc<TFullClient<Block, parachain_runtime::RuntimeApi, RuntimeExecutor>>,
/// Build the import queue for the rococo parachain runtime.
pub fn rococo_parachain_build_import_queue(
client: Arc<TFullClient<Block, rococo_parachain_runtime::RuntimeApi, RococoParachainRuntimeExecutor>>,
config: &Configuration,
telemetry: Option<TelemetryHandle>,
task_manager: &TaskManager,
) -> Result<
sp_consensus::DefaultImportQueue<
Block,
TFullClient<Block, shell_runtime::RuntimeApi, ShellRuntimeExecutor>,
TFullClient<Block, rococo_parachain_runtime::RuntimeApi, RococoParachainRuntimeExecutor>,
>,
sc_service::Error,
> {
@@ -372,22 +376,22 @@ pub fn build_import_queue(
.map_err(Into::into)
}
/// Start a rococo-test parachain node.
pub async fn start_node(
/// Start a rococo parachain node.
pub async fn start_rococo_parachain_node(
parachain_config: Configuration,
collator_key: CollatorPair,
polkadot_config: Configuration,
id: ParaId,
) -> sc_service::error::Result<
(TaskManager, Arc<TFullClient<Block, parachain_runtime::RuntimeApi, RuntimeExecutor>>)
(TaskManager, Arc<TFullClient<Block, rococo_parachain_runtime::RuntimeApi, RococoParachainRuntimeExecutor>>)
> {
start_node_impl::<parachain_runtime::RuntimeApi, RuntimeExecutor, _, _, _>(
start_node_impl::<rococo_parachain_runtime::RuntimeApi, RococoParachainRuntimeExecutor, _, _, _>(
parachain_config,
collator_key,
polkadot_config,
id,
|_| Default::default(),
build_import_queue,
rococo_parachain_build_import_queue,
|client,
prometheus_registry,
telemetry,
@@ -32,7 +32,7 @@ fn polkadot_argument_parsing() {
fn run_command_and_kill(signal: Signal) {
let _ = fs::remove_dir_all("polkadot_argument_parsing");
let mut cmd = Command::new(cargo_bin("rococo-collator"))
let mut cmd = Command::new(cargo_bin("polkadot-collator"))
.args(&[
"-d",
"polkadot_argument_parsing",
@@ -32,7 +32,7 @@ fn interrupt_polkadot_mdns_issue_test() {
fn run_command_and_kill(signal: Signal) {
let _ = fs::remove_dir_all("interrupt_polkadot_mdns_issue_test");
let mut cmd = Command::new(cargo_bin("rococo-collator"))
let mut cmd = Command::new(cargo_bin("polkadot-collator"))
.args(&["-d", "interrupt_polkadot_mdns_issue_test", "--", "--dev"])
.spawn()
.unwrap();
@@ -30,7 +30,7 @@ fn purge_chain_works() {
let base_path = tempfile::tempdir().unwrap();
let mut cmd = Command::new(cargo_bin("rococo-collator"))
let mut cmd = Command::new(cargo_bin("polkadot-collator"))
.args(&["-d"])
.arg(base_path.path())
.args(&["--"])
@@ -60,7 +60,7 @@ fn purge_chain_works() {
assert!(base_path.path().join("chains/local_testnet/db").exists());
assert!(base_path.path().join("polkadot/chains/westend_dev/db").exists());
let status = Command::new(cargo_bin("rococo-collator"))
let status = Command::new(cargo_bin("polkadot-collator"))
.args(&["purge-chain", "-d"])
.arg(base_path.path())
.arg("-y")
@@ -32,7 +32,7 @@ fn running_the_node_works_and_can_be_interrupted() {
fn run_command_and_kill(signal: Signal) {
let _ = fs::remove_dir_all("interrupt_test");
let mut cmd = Command::new(cargo_bin("rococo-collator"))
let mut cmd = Command::new(cargo_bin("polkadot-collator"))
.args(&["-d", "interrupt_test", "--", "--dev"])
.spawn()
.unwrap();
@@ -1,17 +0,0 @@
[package]
name = "rococo-parachain-primitives"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
# Substrate dependencies
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
[features]
default = [ "std" ]
std = [
"sp-runtime/std",
"sp-core/std"
]
@@ -1,59 +0,0 @@
// Copyright 2020-2021 Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Substrate is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Substrate is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Primitives used by the Parachains Tick, Trick and Track.
#![cfg_attr(not(feature = "std"), no_std)]
use sp_runtime::{
generic,
traits::{BlakeTwo256, IdentifyAccount, Verify},
MultiSignature,
};
pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;
/// Opaque block header type.
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
/// Opaque block type.
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
/// Opaque block identifier type.
pub type BlockId = generic::BlockId<Block>;
/// An index to a block.
pub type BlockNumber = u32;
/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
pub type Signature = MultiSignature;
/// Some way of identifying an account on the chain. We intentionally make it equivalent
/// to the public key of our transaction signing scheme.
pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;
/// The type for looking up accounts. We don't expect more than 4 billion of them, but you
/// never know...
pub type AccountIndex = u32;
/// Balance of an account.
pub type Balance = u128;
/// Index of a transaction in the chain.
pub type Index = u32;
/// A hash of some data used by the chain.
pub type Hash = sp_core::H256;
/// Digest item type.
pub type DigestItem = generic::DigestItem<Hash>;