From d5df61174bfaefc3770fbcc310ec5098db7c5c74 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Fri, 23 Apr 2021 13:37:51 +0200 Subject: [PATCH 1/7] refactor:cli: use PINT naming --- node/src/chain_spec.rs | 14 +++++++------- node/src/cli.rs | 6 +++--- node/src/command.rs | 16 ++++++++-------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 4517061204..b05c32f933 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -46,15 +46,15 @@ where AccountPublic::from(get_from_seed::(seed)).into_account() } -pub fn development_config(id: ParaId) -> ChainSpec { +pub fn pint_development_config(id: ParaId) -> ChainSpec { ChainSpec::from_genesis( // Name - "Development", + "PINT Development", // ID - "dev", + "pint_dev", ChainType::Local, move || { - testnet_genesis( + pint_testnet_genesis( get_account_id_from_seed::("Alice"), vec![ get_account_id_from_seed::("Alice"), @@ -76,7 +76,7 @@ pub fn development_config(id: ParaId) -> ChainSpec { ) } -pub fn local_testnet_config(id: ParaId) -> ChainSpec { +pub fn pint_local_config(id: ParaId) -> ChainSpec { ChainSpec::from_genesis( // Name "Local Testnet", @@ -84,7 +84,7 @@ pub fn local_testnet_config(id: ParaId) -> ChainSpec { "local_testnet", ChainType::Local, move || { - testnet_genesis( + pint_testnet_genesis( get_account_id_from_seed::("Alice"), vec![ get_account_id_from_seed::("Alice"), @@ -114,7 +114,7 @@ pub fn local_testnet_config(id: ParaId) -> ChainSpec { ) } -fn testnet_genesis( +fn pint_testnet_genesis( root_key: AccountId, endowed_accounts: Vec, id: ParaId, diff --git a/node/src/cli.rs b/node/src/cli.rs index 973fc2c849..c3654a8b14 100644 --- a/node/src/cli.rs +++ b/node/src/cli.rs @@ -47,8 +47,8 @@ pub struct ExportGenesisStateCommand { /// Id of the parachain this state is for. /// - /// Default: 100 - #[structopt(long, conflicts_with = "chain")] + /// Default: 200 + #[structopt(long)] pub parachain_id: Option, /// Write output in binary. Default is to write in hex. @@ -56,7 +56,7 @@ pub struct ExportGenesisStateCommand { pub raw: bool, /// The name of the chain for that the genesis state should be exported. - #[structopt(long, conflicts_with = "parachain-id")] + #[structopt(long)] pub chain: Option, } diff --git a/node/src/command.rs b/node/src/command.rs index 61b58efd55..0a16eb8017 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -30,8 +30,8 @@ fn load_spec( para_id: ParaId, ) -> std::result::Result, String> { Ok(match id { - "dev" => Box::new(chain_spec::development_config(para_id)), - "" | "local" => Box::new(chain_spec::local_testnet_config(para_id)), + "pint-dev" => Box::new(chain_spec::pint_development_config(para_id)), + "pint-local" => Box::new(chain_spec::pint_local_config(para_id)), path => Box::new(chain_spec::ChainSpec::from_json_file( std::path::PathBuf::from(path), )?), @@ -40,7 +40,7 @@ fn load_spec( impl SubstrateCli for Cli { fn impl_name() -> String { - "Parachain Collator Template".into() + "PINT Collator".into() } fn impl_version() -> String { @@ -49,7 +49,7 @@ impl SubstrateCli for Cli { fn description() -> String { format!( - "Parachain Collator Template\n\nThe command-line arguments provided first will be \ + "PINT 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]", @@ -62,7 +62,7 @@ impl SubstrateCli for Cli { } fn support_url() -> String { - "https://github.com/substrate-developer-hub/substrate-parachain-template/issues/new".into() + "https://github.com/ChainSafe/PINT/issues/new".into() } fn copyright_start_year() -> i32 { @@ -80,7 +80,7 @@ impl SubstrateCli for Cli { impl SubstrateCli for RelayChainCli { fn impl_name() -> String { - "Parachain Collator Template".into() + "PINT Collator".into() } fn impl_version() -> String { @@ -88,7 +88,7 @@ impl SubstrateCli for RelayChainCli { } fn description() -> String { - "Parachain Collator Template\n\nThe command-line arguments provided first will be \ + "PINT 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]" @@ -100,7 +100,7 @@ impl SubstrateCli for RelayChainCli { } fn support_url() -> String { - "https://github.com/substrate-developer-hub/substrate-parachain-template/issues/new".into() + "https://github.com/ChainSafe/PINT/issues/new".into() } fn copyright_start_year() -> i32 { From 204280e07bbe04b57e7e3df0507aee4fdcf35f31 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Fri, 23 Apr 2021 13:38:24 +0200 Subject: [PATCH 2/7] feat:launch: add polkadot-launch config --- config.json | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 config.json diff --git a/config.json b/config.json new file mode 100644 index 0000000000..c3e29d47f5 --- /dev/null +++ b/config.json @@ -0,0 +1,55 @@ +{ + "relaychain": { + "bin": "./bin/polkadot", + "chain": "rococo-local", + "nodes": [ + { + "name": "alice", + "wsPort": 9944, + "port": 30444 + }, + { + "name": "bob", + "wsPort": 9955, + "port": 30555 + }, + { + "name": "charlie", + "wsPort": 9966, + "port": 30666 + } + ] + }, + "parachains": [ + { + "bin": "./target/release/parachain-collator", + "chain": "pint-dev", + "id": "1", + "wsPort": 9988, + "port": 31200, + "balance": "1000000000000000000000", + "flags": ["--", "--execution=wasm"] + }, + { + "bin": "./target/release/parachain-collator", + "chain": "pint-dev", + "id": "300", + "wsPort": 9999, + "port": 31300, + "balance": "1000000000000000000000", + "flags": ["--", "--execution=wasm"] + } + ], + "simpleParachains": [ + ], + "hrmpChannels": [ + { + "sender": 1, + "recipient": 300, + "maxCapacity": 8, + "maxMessageSize": 512 + } + ], + "types": {}, + "finalization": false +} From d375ee39653ad3c558e2c970cf88b49e6a42aed1 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Fri, 23 Apr 2021 13:38:52 +0200 Subject: [PATCH 3/7] chore: add polkadot-launch instructions --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index a9f58faac0..7d37a42f8c 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,13 @@ cargo build --release --features real-overseer ./target/release/polkadot --chain ./rococo_local.json -d cumulus_relay0 --validator --alice --port 50556 ``` +* [polkadot-launch](https://github.com/paritytech/polkadot-launch) can be run by dropping the proper polkadot binary in the `./bin` folder and + * Run globally + * `polkadot-launch config.json` + * Run locally, navigate into polkadot-launch, + * ``` yarn ``` + * ``` yarn start ``` + Substrate Parachain Template: ``` # this command assumes the chain spec is in a directory named polkadot that is a sibling of the working directory From f4c9a1185e64b04e89badd834aefd5dc3a65573c Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Fri, 23 Apr 2021 13:54:17 +0200 Subject: [PATCH 4/7] refactor: rename crate and bin from parachain-collator to pint --- Cargo.lock | 106 ++++++++++++++++++++++++------------------------ config.json | 4 +- node/Cargo.toml | 4 +- 3 files changed, 57 insertions(+), 57 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c6b844e151..26ae51f34f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5155,59 +5155,6 @@ dependencies = [ "xcm", ] -[[package]] -name = "parachain-collator" -version = "2.0.0" -dependencies = [ - "cumulus-client-cli", - "cumulus-client-collator", - "cumulus-client-consensus-relay-chain", - "cumulus-client-network", - "cumulus-client-service", - "cumulus-primitives-core", - "derive_more 0.15.0", - "frame-benchmarking", - "frame-benchmarking-cli", - "hex-literal 0.2.1", - "jsonrpc-core", - "log", - "pallet-transaction-payment-rpc", - "parachain-runtime", - "parity-scale-codec", - "polkadot-cli", - "polkadot-parachain", - "polkadot-primitives", - "polkadot-service", - "polkadot-test-service", - "sc-basic-authorship", - "sc-chain-spec", - "sc-cli", - "sc-client-api", - "sc-consensus", - "sc-executor", - "sc-keystore", - "sc-rpc", - "sc-rpc-api", - "sc-service", - "sc-telemetry", - "sc-tracing", - "sc-transaction-pool", - "serde", - "sp-api", - "sp-block-builder", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-timestamp", - "sp-transaction-pool", - "sp-trie", - "structopt", - "substrate-build-script-utils", - "substrate-frame-rpc-system", -] - [[package]] name = "parachain-info" version = "0.1.0" @@ -5653,6 +5600,59 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pint" +version = "2.0.0" +dependencies = [ + "cumulus-client-cli", + "cumulus-client-collator", + "cumulus-client-consensus-relay-chain", + "cumulus-client-network", + "cumulus-client-service", + "cumulus-primitives-core", + "derive_more 0.15.0", + "frame-benchmarking", + "frame-benchmarking-cli", + "hex-literal 0.2.1", + "jsonrpc-core", + "log", + "pallet-transaction-payment-rpc", + "parachain-runtime", + "parity-scale-codec", + "polkadot-cli", + "polkadot-parachain", + "polkadot-primitives", + "polkadot-service", + "polkadot-test-service", + "sc-basic-authorship", + "sc-chain-spec", + "sc-cli", + "sc-client-api", + "sc-consensus", + "sc-executor", + "sc-keystore", + "sc-rpc", + "sc-rpc-api", + "sc-service", + "sc-telemetry", + "sc-tracing", + "sc-transaction-pool", + "serde", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-inherents", + "sp-runtime", + "sp-timestamp", + "sp-transaction-pool", + "sp-trie", + "structopt", + "substrate-build-script-utils", + "substrate-frame-rpc-system", +] + [[package]] name = "pkg-config" version = "0.3.19" diff --git a/config.json b/config.json index c3e29d47f5..aac730f544 100644 --- a/config.json +++ b/config.json @@ -22,7 +22,7 @@ }, "parachains": [ { - "bin": "./target/release/parachain-collator", + "bin": "./target/release/pint", "chain": "pint-dev", "id": "1", "wsPort": 9988, @@ -31,7 +31,7 @@ "flags": ["--", "--execution=wasm"] }, { - "bin": "./target/release/parachain-collator", + "bin": "./target/release/pint", "chain": "pint-dev", "id": "300", "wsPort": 9999, diff --git a/node/Cargo.toml b/node/Cargo.toml index 27f80aae69..aee153bf6f 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -202,7 +202,7 @@ git = "https://github.com/paritytech/polkadot" branch = 'rococo-v1' [[bin]] -name = 'parachain-collator' +name = 'pint' [package] authors = ['Anonymous'] @@ -211,7 +211,7 @@ description = 'A new Cumulus FRAME-based Substrate node, ready for hacking.' edition = '2018' homepage = 'https://substrate.dev' license = 'LGPL-3.0-only' -name = 'parachain-collator' +name = 'pint' repository = 'https://github.com/substrate-developer-hub/substrate-parachain-template' version = '2.0.0' [package.metadata.docs.rs] From 0911c7b1127ad5f35d69f3693f81994c4ad66bc1 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Fri, 23 Apr 2021 18:19:31 +0200 Subject: [PATCH 5/7] refactor: remove unneccessary bin --- node/Cargo.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/node/Cargo.toml b/node/Cargo.toml index aee153bf6f..530f8277cb 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -201,9 +201,6 @@ branch = 'rococo-v1' git = "https://github.com/paritytech/polkadot" branch = 'rococo-v1' -[[bin]] -name = 'pint' - [package] authors = ['Anonymous'] build = 'build.rs' From 41780fd111384b22d8c7ca3c10d5be2b84d3c12c Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Fri, 23 Apr 2021 18:24:00 +0200 Subject: [PATCH 6/7] chore: fmt json --- config.json | 112 +++++++++++++++++++++++++++------------------------- 1 file changed, 59 insertions(+), 53 deletions(-) diff --git a/config.json b/config.json index aac730f544..b69b2e0f6f 100644 --- a/config.json +++ b/config.json @@ -1,55 +1,61 @@ { - "relaychain": { - "bin": "./bin/polkadot", - "chain": "rococo-local", - "nodes": [ - { - "name": "alice", - "wsPort": 9944, - "port": 30444 - }, - { - "name": "bob", - "wsPort": 9955, - "port": 30555 - }, - { - "name": "charlie", - "wsPort": 9966, - "port": 30666 - } - ] - }, - "parachains": [ - { - "bin": "./target/release/pint", - "chain": "pint-dev", - "id": "1", - "wsPort": 9988, - "port": 31200, - "balance": "1000000000000000000000", - "flags": ["--", "--execution=wasm"] - }, - { - "bin": "./target/release/pint", - "chain": "pint-dev", - "id": "300", - "wsPort": 9999, - "port": 31300, - "balance": "1000000000000000000000", - "flags": ["--", "--execution=wasm"] - } - ], - "simpleParachains": [ - ], - "hrmpChannels": [ - { - "sender": 1, - "recipient": 300, - "maxCapacity": 8, - "maxMessageSize": 512 - } - ], - "types": {}, - "finalization": false + "relaychain": { + "bin": "./bin/polkadot", + "chain": "rococo-local", + "nodes": [ + { + "name": "alice", + "wsPort": 9944, + "port": 30444 + }, + { + "name": "bob", + "wsPort": 9955, + "port": 30555 + }, + { + "name": "charlie", + "wsPort": 9966, + "port": 30666 + } + ] + }, + "parachains": [ + { + "bin": "./target/release/pint", + "chain": "pint-dev", + "id": "1", + "wsPort": 9988, + "port": 31200, + "balance": "1000000000000000000000", + "flags": [ + "--", + "--execution=wasm" + ] + }, + { + "bin": "./target/release/pint", + "chain": "pint-dev", + "id": "300", + "wsPort": 9999, + "port": 31300, + "balance": "1000000000000000000000", + "flags": [ + "--", + "--execution=wasm" + ] + } + ], + "simpleParachains": [ + ], + "hrmpChannels": [ + { + "sender": 1, + "recipient": 300, + "maxCapacity": 8, + "maxMessageSize": 512 + } + ], + "types": {}, + "finalization": false } From d4d0009a160992ed7095710c9a0753fc7e6de144 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Fri, 23 Apr 2021 18:24:58 +0200 Subject: [PATCH 7/7] chore: update lockfile --- Cargo.lock | 65 +++++------------------------------------------------- 1 file changed, 6 insertions(+), 59 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 146a143530..63e0d5cd74 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5298,59 +5298,6 @@ dependencies = [ "xcm", ] -[[package]] -name = "parachain-collator" -version = "2.0.0" -dependencies = [ - "cumulus-client-cli", - "cumulus-client-collator", - "cumulus-client-consensus-relay-chain", - "cumulus-client-network", - "cumulus-client-service", - "cumulus-primitives-core", - "derive_more 0.15.0", - "frame-benchmarking 3.1.0 (git+https://github.com/paritytech/substrate.git?branch=rococo-v1)", - "frame-benchmarking-cli", - "hex-literal 0.2.1", - "jsonrpc-core", - "log", - "pallet-transaction-payment-rpc", - "parachain-runtime", - "parity-scale-codec", - "polkadot-cli", - "polkadot-parachain", - "polkadot-primitives", - "polkadot-service", - "polkadot-test-service", - "sc-basic-authorship", - "sc-chain-spec", - "sc-cli", - "sc-client-api", - "sc-consensus", - "sc-executor", - "sc-keystore", - "sc-rpc", - "sc-rpc-api", - "sc-service", - "sc-telemetry", - "sc-tracing", - "sc-transaction-pool", - "serde", - "sp-api 3.0.0 (git+https://github.com/paritytech/substrate.git?branch=rococo-v1)", - "sp-block-builder", - "sp-blockchain", - "sp-consensus", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?branch=rococo-v1)", - "sp-inherents 3.0.0 (git+https://github.com/paritytech/substrate.git?branch=rococo-v1)", - "sp-runtime 3.0.0 (git+https://github.com/paritytech/substrate.git?branch=rococo-v1)", - "sp-timestamp", - "sp-transaction-pool", - "sp-trie 3.0.0 (git+https://github.com/paritytech/substrate.git?branch=rococo-v1)", - "structopt", - "substrate-build-script-utils", - "substrate-frame-rpc-system", -] - [[package]] name = "parachain-info" version = "0.1.0" @@ -5807,7 +5754,7 @@ dependencies = [ "cumulus-client-service", "cumulus-primitives-core", "derive_more 0.15.0", - "frame-benchmarking", + "frame-benchmarking 3.1.0 (git+https://github.com/paritytech/substrate.git?branch=rococo-v1)", "frame-benchmarking-cli", "hex-literal 0.2.1", "jsonrpc-core", @@ -5834,16 +5781,16 @@ dependencies = [ "sc-tracing", "sc-transaction-pool", "serde", - "sp-api", + "sp-api 3.0.0 (git+https://github.com/paritytech/substrate.git?branch=rococo-v1)", "sp-block-builder", "sp-blockchain", "sp-consensus", - "sp-core", - "sp-inherents", - "sp-runtime", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?branch=rococo-v1)", + "sp-inherents 3.0.0 (git+https://github.com/paritytech/substrate.git?branch=rococo-v1)", + "sp-runtime 3.0.0 (git+https://github.com/paritytech/substrate.git?branch=rococo-v1)", "sp-timestamp", "sp-transaction-pool", - "sp-trie", + "sp-trie 3.0.0 (git+https://github.com/paritytech/substrate.git?branch=rococo-v1)", "structopt", "substrate-build-script-utils", "substrate-frame-rpc-system",