Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to not use --parachain-id flag #160

Closed
wants to merge 20 commits into from
Closed
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
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,13 @@ rococo-local.json
rococo-local-raw.json
configLocal.json
bin

# Ignore file for non-zero install
# ref: https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
109 changes: 61 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,36 @@ cargo build --release -p polkadot-collator
cp ./target/release/polkadot-collator ../polkadot-launch/bin/polkadot-collator
```

## Use
## Usage

Help

```
polkadot-launch [options] <config_file>

Launching Polkadot network locally

Options:
-h, --help Show help [boolean]
--version Show version number [boolean]
-v, --verbose Verbose logging [count]
-o, --out Folder that assets and logs output to [string]
```

Examples

```bash
polkadot-launch config.json
# Launch relay chain - parachains networks locally
polkadot-launch examples/config.json

# Show the help text
polkadot-launch --help

# Launch the networks with all asset output to the specified folder
polkadot-launch -o out examples/config.json

# In addition to the above, the actual commands used to launch the networks are displayed
polkadot-launch -vo out examples/config.json
```

### Configuration File
Expand All @@ -50,21 +76,23 @@ The required configuration file defines the properties of the network you want t
You may use a json or a js file.

You can see the examples:
- [config.json](config.json)
- [config.js](config.js)
- [examples/config.json](examples/config.json)
- [examples/config.js](examples/config.js)

You may find the .js alternative more convenient if you need comments, trailing commas or if you prefer do dedup some portions of the config.
You may find the .js alternative more convenient if you need comments, trailing commas, or if you prefer do dedup some portions of the config.

#### `relaychain`

- `bin`: The path of the [Polkadot relay chain binary](https://github.com/paritytech/polkadot/) used
to setup your test network. For example `<path/to/polkadot>/target/release/polkadot`.
to setup your test network. For example `<path/to/polkadot>/target/release/polkadot`.
A relative path used here is resolved relative to the config file location.
- `chain`: The chain you want to use to generate your spec (probably `rococo-local`).
- `nodes`: An array of nodes that will be validators on the relay chain.
- `name`: Must be one of `alice`, `bob`, `charlie`, or `dave`.
- `wsPort`: The websocket port for this node.
- `rpcPort`: The RPC port for this node.
- `port`: The TCP port for this node.
- `nodeKey`: a secret key used for generating libp2p peer identifier. Optional.
- `nodeKey`: (Optional) A secret key used for generating libp2p peer identifier.
- `basePath`: The directory used for the blockchain db and other outputs. When unspecified, we use
`--tmp`.
- `flags`: Any additional command line flags you want to add when starting your node.
Expand All @@ -75,11 +103,12 @@ These variable are fed directly into the Polkadot binary and used to spawn a nod

```bash
<bin> \
--chain=<chain>-raw.json \
--tmp \
--ws-port=<wsPort> \
--port=<port> \
--<name> \
--chain=<chain>-raw.json \
--tmp \
--ws-port=<wsPort> \
--rpc-port=<rpcPort> \
--port=<port> \
--<name> \
```

An example of `genesis` is:
Expand Down Expand Up @@ -116,10 +145,13 @@ All `genesis` properties can be found in the chainspec output:
- `bin`: The path of the [collator node
binary](https://github.com/substrate-developer-hub/substrate-parachain-template) used to create
blocks for your parachain. For example
`<path/to/substrate-parachain-template>/target/release/polkadot-collator`.
- `id`: The id to assign to this parachain. Must be unique.
`<path/to/substrate-parachain-template>/target/release/polkadot-collator`.
A relative path used here is resolved relative to the config file location.
- `id`: The ParaId to assign to this parachain. Must be unique.
- `protocolId`: (Optional) The chain protocol ID.
- `wsPort`: The websocket port for this node.
- `port`: The TCP port for this node.
- `rpcPort`: The RPC port for this node.
- `balance`: (Optional) Configure a starting amount of balance on the relay chain for this chain's
account ID.
- `chain`: (Optional) Configure an alternative chain specification to be used for launching the
Expand All @@ -132,14 +164,15 @@ These variables are fed directly into the collator binary and used to spawn a no

```bash
<bin> \
--tmp \
--ws-port=<wsPort> \
--port=<port> \
--parachain-id=<id> \
--validator \
--chain=<chain>
-- \
--chain=<relaychain.chain>-raw.json \
--tmp \
--ws-port=<wsPort> \
--rpc-port=<rpcPort> \
--port=<port> \
--parachain-id=<id> \
--validator \
--chain=<chain>
-- \
--chain=<relaychain.chain>-raw.json \
```

#### `simpleParachains`
Expand All @@ -162,35 +195,15 @@ ways you need to open channels in both directions.

```json
"hrmpChannels": [
{
"sender": "200",
"recipient": "300",
"maxCapacity": 8,
"maxMessageSize": 512
}
{
"sender": "200",
"recipient": "300",
"maxCapacity": 8,
"maxMessageSize": 512
}
]
```

#### `types`

These are the Polkadot JS types you might need to include so that Polkadot JS will be able to
interface properly with your runtime.

```json
"types": {
"HrmpChannelId": {
"sender": "u32",
"receiver": "u32"
}
}
```

Or you can specify a path to the type definition json file instead:

```json
"types": "./typedefs.json"
```

#### `finalization`

A simple boolean flag for whether you want to make sure all of the transactions submitted in
Expand Down
52 changes: 34 additions & 18 deletions config.js → examples/config.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
// Collator flags
var flags = ["--force-authoring", "--", "--execution=wasm"];
const flags = ["--", "--execution=wasm"];

var config = {
const config = {
relaychain: {
bin: "./bin/polkadot",
bin: "../bin/polkadot",
chain: "rococo-local",
nodes: [
{
name: "alice",
wsPort: 9944,
rpcPort: 9844,
port: 30444,
},
{
name: "bob",
wsPort: 9955,
rpcPort: 9855,
port: 30555,
},
{
name: "charlie",
wsPort: 9966,
rpcPort: 9866,
port: 30666,
},
{
name: "dave",
wsPort: 9977,
rpcPort: 9877,
port: 30777,
},
],
Expand All @@ -42,40 +46,53 @@ var config = {
},
parachains: [
{
bin: "./bin/polkadot-collator",
id: "200",
bin: "../bin/polkadot-collator",
id: 200,
protocolId: "para-first",
balance: "1000000000000000000000",
nodes: [
{
name: "alice",
wsPort: 9988,
rpcPort: 9888,
port: 31200,
name: "alice",
flags,
},
{
name: "bob",
wsPort: 9989,
rpcPort: 9889,
port: 31201,
flags,
},
],
},
{
bin: "./bin/polkadot-collator",
id: "300",
bin: "../bin/polkadot-collator",
id: 300,
protocolId: "para-second",
balance: "1000000000000000000000",
nodes: [
{
wsPort: 9999,
port: 31300,
name: "alice",
wsPort: 9990,
rpcPort: 9890,
port: 31300,
flags,
},
],
},
],
simpleParachains: [
{
bin: "./bin/adder-collator",
id: "400",
port: "31400",
name: "alice",
balance: "1000000000000000000000",
},
// {
// bin: "../bin/adder-collator",
// id: 400,
// name: "alice",
// balance: "1000000000000000000000",
// // no `wsPort` for simpleParachains
// // no `rpcPort` for simpleParachains
// port: 31400,
// },
],
hrmpChannels: [
{
Expand All @@ -85,7 +102,6 @@ var config = {
maxMessageSize: 512,
},
],
types: {},
finalization: false,
};

Expand Down
31 changes: 19 additions & 12 deletions config.json → examples/config.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
{
"relaychain": {
"bin": "./bin/polkadot",
"bin": "../bin/polkadot",
"chain": "rococo-local",
"nodes": [
{
"name": "alice",
"wsPort": 9944,
"rpcPort": 9844,
"port": 30444
},
{
"name": "bob",
"wsPort": 9955,
"rpcPort": 9855,
"port": 30555
},
{
"name": "charlie",
"wsPort": 9966,
"rpcPort": 9866,
"port": 30666
},
{
"name": "dave",
"wsPort": 9977,
"rpcPort": 9877,
"port": 30777
}
],
Expand All @@ -39,39 +43,43 @@
},
"parachains": [
{
"bin": "./bin/polkadot-collator",
"id": "200",
"bin": "../bin/polkadot-collator",
"id": 200,
"protocolId": "para-first",
"balance": "1000000000000000000000",
"nodes": [
{
"name": "alice",
"wsPort": 9988,
"rpcPort": 9888,
"port": 31200,
"name": "alice",
"flags": ["--", "--execution=wasm"]
}
]
},
{
"bin": "./bin/polkadot-collator",
"id": "300",
"bin": "../bin/polkadot-collator",
"id": 300,
"protocolId": "para-second",
"balance": "1000000000000000000000",
"nodes": [
{
"name": "alice",
"wsPort": 9999,
"rpcPort": 9899,
"port": 31300,
"name": "alice",
"flags": ["--", "--execution=wasm"]
}
]
}
],
"simpleParachains": [
{
"bin": "./bin/adder-collator",
"id": "400",
"port": "31400",
"bin": "../bin/adder-collator",
"id": 400,
"name": "alice",
"balance": "1000000000000000000000"
"balance": "1000000000000000000000",
"port": 31400
}
],
"hrmpChannels": [
Expand All @@ -82,6 +90,5 @@
"maxMessageSize": 512
}
],
"types": {},
"finalization": false
}
Loading