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

Rococo testnet parachain spec #145

Merged
merged 6 commits into from
Apr 21, 2023
Merged
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
23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Use Rust's native `cargo` command to build and launch the node:
cargo run --release -- --dev
```

### Build
### Build(Solo chain mode)

The `cargo run` command will perform an initial build. Use the following command to build the node
without launching it:
Expand All @@ -32,6 +32,15 @@ without launching it:
cargo build --release
```

### Build(Parachain mode)

The `cargo run` command will perform an initial build. Use the following command to build the node
without launching it:

```sh
cargo build --release --features=parachain
```

### Embedded Docs

Once the project has been built, the following command can be used to explore all parameters and
Expand All @@ -52,7 +61,7 @@ node.
This command will start the single-node development chain with non-persistent state:

```bash
./target/release/societal-node --dev
./target/release/societal-node --dev --enable-offchain-indexing true
```

Purge the development chain's state:
Expand All @@ -64,7 +73,7 @@ Purge the development chain's state:
Start the development chain with detailed logging:

```bash
RUST_BACKTRACE=1 ./target/release/societal-node -ldebug --dev
RUST_BACKTRACE=1 ./target/release/societal-node -ldebug --dev --enable-offchain-indexing true
```

> Development chain means that the state of our chain will be in a tmp folder while the nodes are
Expand Down Expand Up @@ -130,7 +139,7 @@ by appending your own. A few useful ones are as follow.

```bash
# Run Soceital node without re-compiling
./scripts/docker_run.sh ./target/release/societal-node --dev --ws-external
./scripts/docker_run.sh ./target/release/societal-node --dev --ws-external --enable-offchain-indexing true

# Purge the local dev chain
./scripts/docker_run.sh ./target/release/societal-node purge-chain --dev
Expand All @@ -139,6 +148,12 @@ by appending your own. A few useful ones are as follow.
./scripts/docker_run.sh cargo check
```

### Run Rococo Local Testnet with Societal Node Parachains
```bash
# Run Rococo local testnet docker-compose configuration
./scripts/rococo_testnet_docker_run.sh
```

### Unit Test

To run Unit Tests, execute the following command:
Expand Down
12 changes: 10 additions & 2 deletions deployment/dev-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
##
image:
repository: societal/societal-node
tag: latest
tag: solo-latest

## Deploy a substrate node
## ref: https://docs.substrate.io/tutorials/v3/private-network/
Expand All @@ -19,7 +19,7 @@ node:

# Enable Offchain Indexing.
# https://docs.substrate.io/fundamentals/offchain-operations/
offchainIndexing: true
enableOffchainIndexing: true

chainData:
volumeSize: 20Gi
Expand All @@ -28,6 +28,14 @@ node:
chainKeystore:
storageClass: gp2

resources:
limits:
cpu: 1
memory: 2Gi
requests:
cpu: 1
memory: Gi

## Creates an ingress resource
##
ingress:
Expand Down
129 changes: 129 additions & 0 deletions docker-compose-rococo-local-testnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
version: "3.2"

services:
validator-alice:
container_name: validator-alice
image: parity/polkadot:v0.9.37
ports:
- "30333:30333"
- "9944:9944"
volumes:
- ./examples/raw-local-chainspec.json:/chain/raw-local-chainspec.json
- validator-alice:/polkadot
command: >
--name "AliceRelayDocker"
--alice
--chain /chain/raw-local-chainspec.json
--port 30333
--ws-port 9944
--ws-external
--rpc-external
--rpc-cors all
--rpc-methods unsafe

validator-bob:
container_name: validator-bob
image: parity/polkadot:v0.9.37
ports:
- "30334:30334"
- "9945:9945"
volumes:
- ./examples/raw-local-chainspec.json:/chain/raw-local-chainspec.json
- validator-bob:/polkadot
command: >
--name "BobRelayDocker"
--bob
--chain /chain/raw-local-chainspec.json
--port 30334
--ws-port 9945
--ws-external
--rpc-external
--rpc-cors all
--rpc-methods unsafe

validator-charlie:
container_name: validator-charlie
image: parity/polkadot:v0.9.37
ports:
- "30335:30335"
- "9946:9946"
volumes:
- ./examples/raw-local-chainspec.json:/chain/raw-local-chainspec.json
- validator-bob:/polkadot
command: >
--name "CharlieRelayDocker"
--bob
--chain /chain/raw-local-chainspec.json
--port 30335
--ws-port 9946
--ws-external
--rpc-external
--rpc-cors all
--rpc-methods unsafe

parachain-2000:
container_name: societal-node-parachain-2000
image: societal/societal-node:parachain-latest
ports:
- "40333:40333"
- "9954:9954"
- "30343:30343"
- "9977:9977"
volumes:
- ./examples/raw-local-chainspec.json:/chain/raw-local-chainspec.json
- ./examples/raw-parachain-chainspec.json:/chain/raw-parachain-chainspec.json
- parachain-2000:/polkadot
command: >
/usr/local/bin/societal-node
--name "SocietalParachain2000"
--alice
--collator
--chain /chain/raw-parachain-chainspec.json
--port 40333
--ws-port 9954
--enable-offchain-indexing true
--ws-external
--rpc-external
--rpc-cors all
--rpc-methods unsafe
--
--execution wasm
--chain /chain/raw-local-chainspec.json
--port 30343
--ws-port 9977

parachain-2001:
container_name: societal-node-parachain-2001
image: societal/societal-node:parachain-latest
ports:
- "40334:40334"
- "9955:9955"
- "30344:30344"
- "9978:9978"
volumes:
- ./examples/raw-local-chainspec.json:/chain/raw-local-chainspec.json
- ./examples/raw-parachain-chainspec-2001.json:/chain/raw-parachain-chainspec.json
- parachain-2001:/polkadot
command: >
/usr/local/bin/societal-node
--bob
--collator
--chain /chain/raw-parachain-chainspec.json
--port 40334
--ws-port 9955
--enable-offchain-indexing true
--ws-external
--rpc-external
--rpc-cors all
--rpc-methods unsafe
--
--execution wasm
--chain /chain/raw-local-chainspec.json
--port 30344
--ws-port 9978

volumes:
validator-alice:
validator-bob:
parachain-2000:
parachain-2001:
62 changes: 62 additions & 0 deletions docs/XCMTestingGuide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Societal Node Cumulus/XCM Testing Guide

## Launch Rococo Local Testnet

- Please refer to the [Run Local Rococo Testnet with Societal Node Parachains](../README.md#run-local-rococo-testnet-with-societal-node-parachains) section of the README

## Register Societal Parachain - Para ID 2000

- Connect to Alice validator Relay Chain: `https://cloudflare-ipfs.com/ipns/dotapps.io/?rpc=ws%3A%2F%2Flocalhost%3A9944#/explorer`

- Go to `Developer --> Extrinsics` section and select `parasSudoWrapper --> sudoScheduleParaInitialize(id, genesis)`

- Use `2000` as parachain `id` and set `parachain` to `true.

- Use [para-2000-genesis-state](../examples/para-2000-genesis-state) file as `genesisHead`

- Use [para-2000-wasm](../examples/para-2000-wasm) file as `validationCode`

- Go to `Network --> Parachains` section and wait for ~2 minutes to check whether the 2000 chain is in the `Parachains` list

- Connect to Societal Parachain(2000): `https://cloudflare-ipfs.com/ipns/dotapps.io/?rpc=ws%3A%2F%2Flocalhost%3A9954#/explorer`

- Go to `Network --> Explorer` and check that blocks are produced and finalized

## Register 2nd Parachain - Para ID 2001

- Basically the same steps as in previous steps but different genesis/wasm files taking part

- Connect to Alice validator Relay Chain: `https://cloudflare-ipfs.com/ipns/dotapps.io/?rpc=ws%3A%2F%2Flocalhost%3A9944#/explorer`

- Go to `Developer --> Extrinsics` section and select `parasSudoWrapper --> sudoScheduleParaInitialize(id, genesis)`

- Use `2001` as parachain `id` and set `parachain` to `true.

- Use [para-2001-genesis-state](../examples/para-2001-genesis-state) file as `genesisHead`

- Use [para-2001-wasm](../examples/para-2001-wasm) file as `validationCode`

- Go to `Network --> Parachains` section and wait for ~2 minutes to check whether the 2001 chain is in the `Parachains` list

- Connect to Societal Parachain(2000): `https://cloudflare-ipfs.com/ipns/dotapps.io/?rpc=ws%3A%2F%2Flocalhost%3A9955#/explorer`

- Go to `Network --> Explorer` and check that blocks are produced and finalized

## Open HRMP Channel from Parachain 2000 to 2001

- Refer to the [Open message passing channels](https://docs.substrate.io/tutorials/build-a-parachain/open-message-passing-channels/) section of Polkadot documentation

- Use the following sovereign accounts for Parachains connected:

```
ParaId 2000 - 5Ec4AhPUwPeyTFyuhGuBbD224mY85LKLMSqSSo33JYWCazU4
ParaId 2001 - 5Ec4AhPV91i9yNuiWuNunPf6AQCYDhFTTA4G5QCbtqYApH9E
```

- Please make sure you open bi-directional HRMP channel completing the guide from the previous step for both 2000 and 2001 parachains.

- Check whether the HRMP channels are opened in both directions:

<img src="images/xcm/Screenshot 2023-04-18 at 16.43.43.png" width="600" style="padding-left: 50px;">

- Make sure assets can be transferred via HRMP channel using the Polkadot tutorial doc: [Transfer assets with XCM](https://docs.substrate.io/tutorials/build-a-parachain/transfer-assets-with-xcm/)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/para-2000-genesis-state
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0x00000000000000000000000000000000000000000000000000000000000000000009bd4fc9abdcbab6574981b1435af9b6a31be8fd608015b7d24e3dbd8fa53f6803170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c11131400
1 change: 1 addition & 0 deletions examples/para-2000-wasm

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/para-2001-genesis-state
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0x00000000000000000000000000000000000000000000000000000000000000000070df20708770b025e48aece099074c7b74a98bcf1dd68687002e82fbd5c6559c03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c11131400
1 change: 1 addition & 0 deletions examples/para-2001-wasm

Large diffs are not rendered by default.

75 changes: 75 additions & 0 deletions examples/parachain-2001-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
## Image of Parachain Societal Node.
##
image:
repository: societal/societal-node
tag: parachain-latest

node:
role: collator
isParachain: true
command: societal-node

customChainspecUrl: "https://societal-dev.s3.amazonaws.com/raw-parachain-chainspec-2001.json"
forceDownloadChainspec: true

allowUnsafeRpcMethods: Unsafe

chainData:
volumeSize: 20Gi
storageClass: gp2-custom

chainKeystore:
storageClass: gp2-custom

collatorRelayChain:
customChainspecUrl: "https://societal-dev.s3.amazonaws.com/raw-local-chainspec.json"
chainData:
volumeSize: 20Gi
storageClass: gp2-custom
chainKeystore:
storageClass: gp2-custom

resources:
limits:
cpu: 1
memory: 2Gi
requests:
cpu: 1
memory: 2Gi

## Creates an ingress resource
##
ingress:
enabled: true
ingressClassName: nginx
annotations:
cert-manager.io/cluster-issuer: letsencrypt-development
nginx.ingress.kubernetes.io/rewrite-target: /
rules:
- host: node-rpc-rococo-2001.dev.sctl.link
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: societal-parachain-node-2001
port:
number: 9933
- host: node-ws-rococo-2001.dev.sctl.link
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: societal-parachain-node-2001
port:
number: 9944
tls:
- hosts:
- node-rpc-rococo-2001.dev.sctl.link
secretName: societal-parachain-node-2001-rpc-tls-secret
- hosts:
- node-ws-rococo-2001.dev.sctl.link
secretName: societal-parachain-node-2001-ws-tls-secret
Loading