From 1371b2549d6cdead46e9dfb4617041af96d21095 Mon Sep 17 00:00:00 2001 From: haerdib Date: Mon, 11 Apr 2022 11:19:44 +0200 Subject: [PATCH 01/16] update bad link --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 375fbdee..772d802a 100644 --- a/README.md +++ b/README.md @@ -83,12 +83,12 @@ integritee-collator \ --chain integritee-rococo-local-dev \ --rpc-cors all \ --name integritee-rococo-collator-1 \ - -- --execution wasm --chain rococo + -- --execution wasm --chain rococo ``` ### Runtime upgrade -Two runtimes are contained in this repository. First, the shell-runtime, which has been extended compared to the upstream shell-runtime. It has some additional modules including sudo to facilitate a +Two runtimes are contained in this repository. First, the shell-runtime, which has been extended compared to the upstream shell-runtime. It has some additional modules including sudo to facilitate a runtime upgrade with the [sudo upgrade](https://substrate.dev/docs/en/tutorials/forkless-upgrade/sudo-upgrade) method. Second, it runs with the same executor instance as the integritee-runtime, such that an eventual upgrade is simpler to perform, i.e., only the runtime needs to be upgraded whereas the client can remain the same. Hence, all modules revolving around aura have been included, which provide data the client needs. @@ -129,4 +129,4 @@ The benchmarks are run with the following script: ### More Resources * Thorough Readme about Rococo and Collators in general in the original [repository](https://github.com/paritytech/cumulus) of this fork. -* Parachains on Rococo in the [Polkadot Wiki](https://wiki.polkadot.network/docs/en/build-parachains-rococo#rococo-v1-parachain-requirements) +* Parachains Development in the [Polkadot Wiki](https://wiki.polkadot.network/docs/build-pdk) From b6516202c4905ff083fcfddbe4fbdf0c182c1241 Mon Sep 17 00:00:00 2001 From: haerdib Date: Mon, 11 Apr 2022 12:56:26 +0200 Subject: [PATCH 02/16] update launch procedure --- README.md | 116 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 86 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 772d802a..24ceecf3 100644 --- a/README.md +++ b/README.md @@ -8,46 +8,58 @@ Quick: see [polkadot-launch](https://github.com/paritytech/polkadot-launch.git) ``` node ../polkadot-launch/dist/cli.js launch-kusama-local-with-shell.json ``` +or +``` +polkadot-launch launch-kusama-local-with-shell.json +``` +depending on how you installed it. + +### Manually Launch a local Rococo Testnet +#### Launch a Rococo Relay Chain -### Manually Launch Local Rococo Testnet +Check out which polkadot release to use in the .json files in the [polkadot-launch](./polkadot-launch) folder. + +Example: +```json +{ + "relaychain": { + "bin": "../../../bin/polkadot-0.9.18", // <-- release to use + "chain": "kusama-local", + ... +``` ```bash # Compile Polkadot with the real overseer feature git clone https://github.com/paritytech/polkadot -git checkout // release tag that matches the branch id in the polkadot-deps +# Switch into the Polkadot directory +cd polkadot +# Checkout the proper commit +git checkout # release tag that matches the branch id in the polkadot-deps cargo build --release # Generate a raw chain spec ./target/release/polkadot build-spec --chain rococo-local --disable-default-bootnode --raw > rococo-local-cfde.json - -# Alice -./target/release/polkadot --chain rococo-local-cfde.json --alice --tmp - -# Bob (In a separate terminal) -./target/release/polkadot --chain rococo-local-cfde.json --bob --tmp --port 30334 ``` - -#### Launch the Parachain - +Start the `Alice` validator: ```bash -# Compile -git clone https://github.com/scs/integritee-parachain.git -git checkout master -cargo build --release - -# Export genesis state -./target/release/integritee-collator export-genesis-state --chain integritee-local-dev > integritee-local-dev.state +./target/release/polkadot --chain rococo-local-cfde.json --alice --validator --tmp +``` +When the node starts you will see several log messages. Take note of the node's Peer ID in the logs. We will need it when connecting other nodes to it. It will look something like this: +```bash +Local node identity is: 12D3KooWGjsmVmZCM1jPtVNp6hRbbkGBK3LADYNniJAKJ19NUYiq +``` +Start the `Bob` validator (in a second terminal): +```bash +./target/release/polkadot --chain rococo-local-cfde.json --validator --bob --bootnodes /ip4//tcp/30333/p2p/ --tmp --port 30334 --ws-port 9945 +``` -# Export genesis wasm -./target/release/integritee-collator export-genesis-wasm --chain integritee-local-dev > integritee-local.wasm +More information can be found in the Substrate tutorial [Start a Relay Chain](https://docs.substrate.io/tutorials/v3/cumulus/start-relay/) -# Collator -./target/release/integritee-collator --collator --tmp --chain integritee-rococo-local-dev --port 40335 --ws-port 9946 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30337 --ws-port 9981 -``` #### Register the Parachain -Go to [Polkadot Apps](https://polkadot.js.org/apps/) connect to the default local port (Alice) and register the parachain via the `paraSudoWrapper` pallet. After registering, the collator should start producing blocks when the next era starts. +Go to [Polkadot Apps](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/parachains/parathreads). Register the parachain via +Network > Parachains sub-page, click on Parathreads tab and use the + ParaId button or the `paraSudoWrapper` pallet. After registering, the collator should start producing blocks when the next era starts. **Note:** Change the `ParaId` to 2015 when registering the parachain. @@ -62,6 +74,51 @@ You may need to add custom type overwrites in Settings -> Developer: } ``` +#### Launch the Parachain +More information can be found in https://docs.substrate.io/tutorials/v3/cumulus/connect-parachain/. + +Build the parachain: +```bash +# Compile +git clone https://github.com/integritee-network/parachain +# Switch into the Integritee parachain directory & build it +cd parachain +cargo build --release + +``` +Generate custom parachain specification: +```bash +./target/release/integritee-collator build-spec --disable-default-bootnode > integritee-local-dev-plain.json +``` +and update the `para_id` to `2015` (default is `2000`): +```json +// --snip-- + "para_id": 2015, // <--- your already registered ID + // --snip-- + "parachainInfo": { + "parachainId": 2015 // <--- your already registered ID + }, + // --snip-- +``` +Then generate a raw chain spec derived from your modified plain chain spec: + +```bash +./target/release/parachain-collator build-spec --chain integritee-local-dev-plain.json --raw --disable-default-bootnode > integritee-local-dev.json +``` +Export genesis and wasm states: +```bash +# Export genesis state +./target/release/integritee-collator export-genesis-state --chain integritee-local-dev.json > integritee-local-dev.state + +# Export genesis wasm +./target/release/integritee-collator export-genesis-wasm --chain integritee-local-dev.json > integritee-local-dev.wasm +``` +Start the first collator node: +```bash +./target/release/integritee-collator --alice --force-authoring --collator --tmp --chain integritee-local-dev.json --port 40335 --ws-port 9946 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30337 --ws-port 9981 +``` + + ### Deploy on rococo Prepare genesis state and wasm as follows: @@ -94,11 +151,11 @@ needs to be upgraded whereas the client can remain the same. Hence, all modules #### Upgrade procedure Prepare a local shell network and generate the `integritee-runtime` wasm blob, which contains the upgraded runtime to be executed after the runtime upgrade. -```shell -// launch local setup +```bash +# launch local setup node ../polkadot-launch/dist/cli.js polkadot-launch/launch-rococo-local-with-shell.json -// generate wasm blob +# generate wasm blob ./target/release/integritee-collator export-genesis-wasm --chain integritee-rococo-local-dev > integritee-rococo-local-dev.wasm ``` @@ -106,12 +163,11 @@ After the parachain starts producing blocks, a runtime upgrade can be initiated ![image](./docs/sudo-set-code.png) -If successful, a `parachainSystem.validationFunctionStored` event is thrown followed by a `parachainSystem.validationFunctionApplied` event some blocks later. After this procedure, the `substrateeRegistry` module should be available in the -extrinsics tab in polkadot-js/apps. +If successful, a `parachainSystem.validationFunctionStored` event is thrown followed by a `parachainSystem.validationFunctionApplied` event some blocks later. After this procedure, the `Teerex` module should be available in the extrinsics tab in polkadot-js/apps. ### Caveats * Don't forget to enable file upload if you perform drag and drop for the `genesisHead` and `validationCode`. If it is not enabled, Polkadot-js will interpret the path as a string and won't complain but the registration will fail. -* Don't forget to add the argument `--chain integritee-rococo-local-dev` for the custom chain config. This argument is omitted in the [Cumulus Workshop](https://substrate.dev/cumulus-workshop/). +* Don't forget to add the argument `--chain integritee-rococo-local-dev.json` for the custom chain config. This argument is omitted in the [Cumulus Workshop](https://substrate.dev/cumulus-workshop/). * The relay chain and the collator need to be about equally recent. This might require frequent rebasing of this repository on the corresponding release branch. ## Benchmark From 2594b5d745f245ee4b255d6af597ae1335c57298 Mon Sep 17 00:00:00 2001 From: haerdib Date: Mon, 11 Apr 2022 12:59:45 +0200 Subject: [PATCH 03/16] update outdated labels --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 24ceecf3..bf413d0c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# IntegriTEE Parachain: +# Integritee Parachain: -This is the repository to run integritee as a parachain in the rococo-v1 testnet. It is forked from the [Cumulus](https://github.com/paritytech/cumulus) repository and only adds the SubstraTEE pallet and configuration. +This is the repository to run Integritee as a parachain on Kusama and Rococo.It is forked from the [Cumulus](https://github.com/paritytech/cumulus) repository. ## Launch a local setup including a Relay Chain and a Parachain @@ -12,7 +12,7 @@ or ``` polkadot-launch launch-kusama-local-with-shell.json ``` -depending on how you installed it. +depending on how you installed `polkadot-launch`. ### Manually Launch a local Rococo Testnet From 25fafa4023b5c83d1ce31ee588140ab8397c1017 Mon Sep 17 00:00:00 2001 From: haerdib Date: Mon, 11 Apr 2022 13:02:25 +0200 Subject: [PATCH 04/16] a little bit nicer --- README.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index bf413d0c..832c40bf 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Integritee Parachain: +# Integritee Parachain -This is the repository to run Integritee as a parachain on Kusama and Rococo.It is forked from the [Cumulus](https://github.com/paritytech/cumulus) repository. +This is the repository to run Integritee as a parachain on Kusama and Rococo. It is forked from the [Cumulus](https://github.com/paritytech/cumulus) repository. ## Launch a local setup including a Relay Chain and a Parachain @@ -18,17 +18,15 @@ depending on how you installed `polkadot-launch`. #### Launch a Rococo Relay Chain -Check out which polkadot release to use in the .json files in the [polkadot-launch](./polkadot-launch) folder. - -Example: +First, check out which polkadot release to use in the .json files in the [polkadot-launch](./polkadot-launch) folder: ```json { "relaychain": { "bin": "../../../bin/polkadot-0.9.18", // <-- release to use "chain": "kusama-local", - ... + // --snip-- ``` - +Then get and build `polkadot`: ```bash # Compile Polkadot with the real overseer feature git clone https://github.com/paritytech/polkadot From 87bb3c354dba150418a900eee89100afa792d46b Mon Sep 17 00:00:00 2001 From: haerdib Date: Mon, 11 Apr 2022 13:04:55 +0200 Subject: [PATCH 05/16] add release tag example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 832c40bf..81de8564 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ git clone https://github.com/paritytech/polkadot # Switch into the Polkadot directory cd polkadot # Checkout the proper commit -git checkout # release tag that matches the branch id in the polkadot-deps +git checkout # release tag, just like in the example above: polkadot-0.9.18 cargo build --release # Generate a raw chain spec From dbb394e0b0ffee511af635ce19d31439bf1ce918 Mon Sep 17 00:00:00 2001 From: haerdib Date: Mon, 11 Apr 2022 13:10:22 +0200 Subject: [PATCH 06/16] add cargo + nightly help --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 81de8564..fdfe4c06 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,8 @@ cd polkadot # Checkout the proper commit git checkout # release tag, just like in the example above: polkadot-0.9.18 cargo build --release +# If this fails due to `feature `edition2021` is required` you have set an outdated rust default version. To fix this, you can simply run: +cargo +nightly-2022-01-31 build --release # or any other up-to-date nightly version # Generate a raw chain spec ./target/release/polkadot build-spec --chain rococo-local --disable-default-bootnode --raw > rococo-local-cfde.json From b58befcf80839b60047693a7ac248de321274345 Mon Sep 17 00:00:00 2001 From: haerdib Date: Mon, 11 Apr 2022 13:30:18 +0200 Subject: [PATCH 07/16] add some better paraId reservation docs --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fdfe4c06..3c983a27 100644 --- a/README.md +++ b/README.md @@ -59,9 +59,12 @@ More information can be found in the Substrate tutorial [Start a Relay Chain](ht #### Register the Parachain Go to [Polkadot Apps](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/parachains/parathreads). Register the parachain via -Network > Parachains sub-page, click on Parathreads tab and use the + ParaId button or the `paraSudoWrapper` pallet. After registering, the collator should start producing blocks when the next era starts. +Network > Parachains sub-page, click on Parathreads tab and use the + ParaId button. After registering, the collator should start producing blocks when the next era starts. +![image](https://d33wubrfki0l68.cloudfront.net/ab3d311e37364a9706f2747b98b24fc259398152/2c4ba/static/4e9213b9ee2f65cc7fa9ccddd73679a3/c1b63/paraid-reserve.png +) -**Note:** Change the `ParaId` to 2015 when registering the parachain. + +**Note:** You may also register the parachain via the `paraSudoWrapper` module (see [Launch the Parachain](launch-the-parachain) for generating genesis state and wasm): ![image](https://user-images.githubusercontent.com/2915325/99548884-1be13580-2987-11eb-9a8b-20be658d34f9.png) @@ -90,7 +93,7 @@ Generate custom parachain specification: ```bash ./target/release/integritee-collator build-spec --disable-default-bootnode > integritee-local-dev-plain.json ``` -and update the `para_id` to `2015` (default is `2000`): +and update the `para_id` to the `para_id` you reserved on the relay-chain (default is `2000`): ```json // --snip-- "para_id": 2015, // <--- your already registered ID From 4d9e5f0156103e56902dde6ee46160b5da8607fe Mon Sep 17 00:00:00 2001 From: haerdib Date: Mon, 11 Apr 2022 13:34:13 +0200 Subject: [PATCH 08/16] change order --- README.md | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 3c983a27..7a5ac056 100644 --- a/README.md +++ b/README.md @@ -57,26 +57,6 @@ Start the `Bob` validator (in a second terminal): More information can be found in the Substrate tutorial [Start a Relay Chain](https://docs.substrate.io/tutorials/v3/cumulus/start-relay/) -#### Register the Parachain -Go to [Polkadot Apps](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/parachains/parathreads). Register the parachain via -Network > Parachains sub-page, click on Parathreads tab and use the + ParaId button. After registering, the collator should start producing blocks when the next era starts. -![image](https://d33wubrfki0l68.cloudfront.net/ab3d311e37364a9706f2747b98b24fc259398152/2c4ba/static/4e9213b9ee2f65cc7fa9ccddd73679a3/c1b63/paraid-reserve.png -) - - -**Note:** You may also register the parachain via the `paraSudoWrapper` module (see [Launch the Parachain](launch-the-parachain) for generating genesis state and wasm): - -![image](https://user-images.githubusercontent.com/2915325/99548884-1be13580-2987-11eb-9a8b-20be658d34f9.png) - -You may need to add custom type overwrites in Settings -> Developer: -``` -{ - "Address": "MultiAddress", - "LookupSource": "MultiAddress", - "ShardIdentifier": "Hash" -} -``` - #### Launch the Parachain More information can be found in https://docs.substrate.io/tutorials/v3/cumulus/connect-parachain/. @@ -122,6 +102,27 @@ Start the first collator node: ``` +#### Register the Parachain +Go to [Polkadot Apps](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/parachains/parathreads). Register the parachain via +Network > Parachains sub-page, click on Parathreads tab and use the + ParaId button. After registering, the collator should start producing blocks when the next era starts. +![image](https://d33wubrfki0l68.cloudfront.net/ab3d311e37364a9706f2747b98b24fc259398152/2c4ba/static/4e9213b9ee2f65cc7fa9ccddd73679a3/c1b63/paraid-reserve.png +) + + +**Note:** You may also register the parachain via the `paraSudoWrapper` module (see [Launch the Parachain](launch-the-parachain) for generating genesis state and wasm): + +![image](https://user-images.githubusercontent.com/2915325/99548884-1be13580-2987-11eb-9a8b-20be658d34f9.png) + +You may need to add custom type overwrites in Settings -> Developer: +``` +{ + "Address": "MultiAddress", + "LookupSource": "MultiAddress", + "ShardIdentifier": "Hash" +} +``` + + ### Deploy on rococo Prepare genesis state and wasm as follows: From 5a1d85697ad3fe3417cbc6a3c7cc1792ef4b47d2 Mon Sep 17 00:00:00 2001 From: haerdib Date: Mon, 11 Apr 2022 14:28:49 +0200 Subject: [PATCH 09/16] update reserve & register --- README.md | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 7a5ac056..07a14827 100644 --- a/README.md +++ b/README.md @@ -56,9 +56,14 @@ Start the `Bob` validator (in a second terminal): More information can be found in the Substrate tutorial [Start a Relay Chain](https://docs.substrate.io/tutorials/v3/cumulus/start-relay/) +#### Reserve a para ID +Go to [Polkadot Apps](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/parachains/parathreads). Register the parachain via +Network > Parachains sub-page, click on Parathreads tab and use the + ParaId button. After registering, the collator should start producing blocks when the next era starts. +![image](https://d33wubrfki0l68.cloudfront.net/ab3d311e37364a9706f2747b98b24fc259398152/2c4ba/static/4e9213b9ee2f65cc7fa9ccddd73679a3/c1b63/paraid-reserve.png) + + #### Launch the Parachain -More information can be found in https://docs.substrate.io/tutorials/v3/cumulus/connect-parachain/. Build the parachain: ```bash @@ -71,45 +76,43 @@ cargo build --release ``` Generate custom parachain specification: ```bash -./target/release/integritee-collator build-spec --disable-default-bootnode > integritee-local-dev-plain.json +./target/release/integritee-collator build-spec --chain integritee-rococo-local-dev --disable-default-bootnode > integritee-rococo-local-dev-plain.json ``` and update the `para_id` to the `para_id` you reserved on the relay-chain (default is `2000`): ```json // --snip-- - "para_id": 2015, // <--- your already registered ID + "para_id": 2000, // <--- your already registered ID // --snip-- "parachainInfo": { - "parachainId": 2015 // <--- your already registered ID + "parachainId": 2000 // <--- your already registered ID }, // --snip-- ``` Then generate a raw chain spec derived from your modified plain chain spec: ```bash -./target/release/parachain-collator build-spec --chain integritee-local-dev-plain.json --raw --disable-default-bootnode > integritee-local-dev.json +./target/release/parachain-collator build-spec --chain integritee-rococo-local-dev --raw --disable-default-bootnode > integritee-rococo-local-dev.json ``` Export genesis and wasm states: ```bash # Export genesis state -./target/release/integritee-collator export-genesis-state --chain integritee-local-dev.json > integritee-local-dev.state +./target/release/integritee-collator export-genesis-state --chain integritee-rococo-local-dev > integritee-rococo-local-dev.state # Export genesis wasm -./target/release/integritee-collator export-genesis-wasm --chain integritee-local-dev.json > integritee-local-dev.wasm +./target/release/integritee-collator export-genesis-wasm --chain integritee-rococo-local-dev > integritee-rococo-local-dev.wasm ``` Start the first collator node: ```bash -./target/release/integritee-collator --alice --force-authoring --collator --tmp --chain integritee-local-dev.json --port 40335 --ws-port 9946 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30337 --ws-port 9981 +./target/release/integritee-collator --alice --force-authoring --collator --tmp --chain integritee-rococo-local-dev --port 40335 --ws-port 9946 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30337 --ws-port 9981 ``` +Additional information can be found in https://docs.substrate.io/tutorials/v3/cumulus/connect-parachain/. -#### Register the Parachain -Go to [Polkadot Apps](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/parachains/parathreads). Register the parachain via -Network > Parachains sub-page, click on Parathreads tab and use the + ParaId button. After registering, the collator should start producing blocks when the next era starts. -![image](https://d33wubrfki0l68.cloudfront.net/ab3d311e37364a9706f2747b98b24fc259398152/2c4ba/static/4e9213b9ee2f65cc7fa9ccddd73679a3/c1b63/paraid-reserve.png -) +#### Register the Parachain +Go to [Polkadot Apps](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/parachains/parathreads). Register the parachain via the `paraSudoWrapper` pallet. After registering, the collator should start producing blocks when the next era starts -**Note:** You may also register the parachain via the `paraSudoWrapper` module (see [Launch the Parachain](launch-the-parachain) for generating genesis state and wasm): +**Note:** Change the `ParaId` to the value you used for reserving your parachain. ![image](https://user-images.githubusercontent.com/2915325/99548884-1be13580-2987-11eb-9a8b-20be658d34f9.png) @@ -171,7 +174,7 @@ If successful, a `parachainSystem.validationFunctionStored` event is thrown foll ### Caveats * Don't forget to enable file upload if you perform drag and drop for the `genesisHead` and `validationCode`. If it is not enabled, Polkadot-js will interpret the path as a string and won't complain but the registration will fail. -* Don't forget to add the argument `--chain integritee-rococo-local-dev.json` for the custom chain config. This argument is omitted in the [Cumulus Workshop](https://substrate.dev/cumulus-workshop/). +* Don't forget to add the argument `--chain integritee-rococo-local-dev` for the custom chain config. This argument is omitted in the [Cumulus Workshop](https://substrate.dev/cumulus-workshop/). * The relay chain and the collator need to be about equally recent. This might require frequent rebasing of this repository on the corresponding release branch. ## Benchmark From 9f3821eb6547deeb4d23b9016959a4951ec4af71 Mon Sep 17 00:00:00 2001 From: haerdib Date: Mon, 11 Apr 2022 14:33:55 +0200 Subject: [PATCH 10/16] fix .json ending --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 07a14827..4fba8432 100644 --- a/README.md +++ b/README.md @@ -91,19 +91,19 @@ and update the `para_id` to the `para_id` you reserved on the relay-chain (defau Then generate a raw chain spec derived from your modified plain chain spec: ```bash -./target/release/parachain-collator build-spec --chain integritee-rococo-local-dev --raw --disable-default-bootnode > integritee-rococo-local-dev.json +./target/release/integritee-collator build-spec --chain integritee-rococo-local-dev.json --raw --disable-default-bootnode > integritee-rococo-local-dev-raw.json ``` Export genesis and wasm states: ```bash # Export genesis state -./target/release/integritee-collator export-genesis-state --chain integritee-rococo-local-dev > integritee-rococo-local-dev.state +./target/release/integritee-collator export-genesis-state --chain integritee-rococo-local-dev-raw.json > integritee-rococo-local-dev.state # Export genesis wasm -./target/release/integritee-collator export-genesis-wasm --chain integritee-rococo-local-dev > integritee-rococo-local-dev.wasm +./target/release/integritee-collator export-genesis-wasm --chain integritee-rococo-local-dev-raw.json > integritee-rococo-local-dev.wasm ``` Start the first collator node: ```bash -./target/release/integritee-collator --alice --force-authoring --collator --tmp --chain integritee-rococo-local-dev --port 40335 --ws-port 9946 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30337 --ws-port 9981 +./target/release/integritee-collator --alice --force-authoring --collator --tmp --chain integritee-rococo-local-dev-raw.json --port 40335 --ws-port 9946 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30337 --ws-port 9981 ``` Additional information can be found in https://docs.substrate.io/tutorials/v3/cumulus/connect-parachain/. From 0c923b0d45bce52c3e98eae4c99ee1eb9be2a14d Mon Sep 17 00:00:00 2001 From: haerdib Date: Mon, 11 Apr 2022 14:35:25 +0200 Subject: [PATCH 11/16] update naming --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4fba8432..b2b3a8e0 100644 --- a/README.md +++ b/README.md @@ -76,9 +76,9 @@ cargo build --release ``` Generate custom parachain specification: ```bash -./target/release/integritee-collator build-spec --chain integritee-rococo-local-dev --disable-default-bootnode > integritee-rococo-local-dev-plain.json +./target/release/integritee-collator build-spec --chain integritee-rococo-local-dev --disable-default-bootnode > integritee-rococo-local-dev.json ``` -and update the `para_id` to the `para_id` you reserved on the relay-chain (default is `2000`): +and update the `para_id` to the one you reserved on the relay-chain (default is `2000`): ```json // --snip-- "para_id": 2000, // <--- your already registered ID From 38b091079332c8c795c0a6cb6c9b2ac49000cca0 Mon Sep 17 00:00:00 2001 From: haerdib Date: Mon, 11 Apr 2022 14:47:15 +0200 Subject: [PATCH 12/16] update bootnode options --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b2b3a8e0..91f7fa02 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ cargo +nightly-2022-01-31 build --release # or any other up-to-date nightly vers ``` Start the `Alice` validator: ```bash -./target/release/polkadot --chain rococo-local-cfde.json --alice --validator --tmp +./target/release/polkadot --chain rococo-local-cfde.json --alice --validator --tmp --port 30333 --ws-port 9944 ``` When the node starts you will see several log messages. Take note of the node's Peer ID in the logs. We will need it when connecting other nodes to it. It will look something like this: ```bash @@ -103,7 +103,7 @@ Export genesis and wasm states: ``` Start the first collator node: ```bash -./target/release/integritee-collator --alice --force-authoring --collator --tmp --chain integritee-rococo-local-dev-raw.json --port 40335 --ws-port 9946 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30337 --ws-port 9981 +./target/release/integritee-collator --dave --force-authoring --collator --tmp --chain integritee-rococo-local-dev-raw.json --port 40335 --ws-port 9946 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30337 --ws-port 9981 --bootnodes /ip4//tcp/30333/p2p/ ``` Additional information can be found in https://docs.substrate.io/tutorials/v3/cumulus/connect-parachain/. From b8224cddf16458ccc26c51545ff91bb6837e9ad3 Mon Sep 17 00:00:00 2001 From: haerdib Date: Tue, 12 Apr 2022 13:06:36 +0200 Subject: [PATCH 13/16] add better description of relay chain port usage in polkadot js --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 91f7fa02..255175e6 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,9 @@ Start the `Bob` validator (in a second terminal): More information can be found in the Substrate tutorial [Start a Relay Chain](https://docs.substrate.io/tutorials/v3/cumulus/start-relay/) #### Reserve a para ID -Go to [Polkadot Apps](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/parachains/parathreads). Register the parachain via +Go to [Polkadot Apps](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/parachains/parathreads). This links to the default port used for the alice relay chain node. But you can also use any other port of a node that is connected to your relay chain. + +Register the parachain via Network > Parachains sub-page, click on Parathreads tab and use the + ParaId button. After registering, the collator should start producing blocks when the next era starts. ![image](https://d33wubrfki0l68.cloudfront.net/ab3d311e37364a9706f2747b98b24fc259398152/2c4ba/static/4e9213b9ee2f65cc7fa9ccddd73679a3/c1b63/paraid-reserve.png) From 2a7e294065905179960e79e68601df3397669fb9 Mon Sep 17 00:00:00 2001 From: haerdib Date: Fri, 29 Apr 2022 10:47:24 +0200 Subject: [PATCH 14/16] remove blow up of manual set up --- README.md | 149 +++++------------------------------------------------- 1 file changed, 12 insertions(+), 137 deletions(-) diff --git a/README.md b/README.md index 255175e6..422ab294 100644 --- a/README.md +++ b/README.md @@ -4,154 +4,28 @@ This is the repository to run Integritee as a parachain on Kusama and Rococo. It ## Launch a local setup including a Relay Chain and a Parachain +### Polkadot-launch + Quick: see [polkadot-launch](https://github.com/paritytech/polkadot-launch.git) ``` -node ../polkadot-launch/dist/cli.js launch-kusama-local-with-shell.json +node ../polkadot-launch/dist/cli.js launch-rococo-local-with-integritee.json ``` or ``` -polkadot-launch launch-kusama-local-with-shell.json +polkadot-launch launch-rococo-local-with-integritee.json ``` depending on how you installed `polkadot-launch`. -### Manually Launch a local Rococo Testnet - -#### Launch a Rococo Relay Chain - -First, check out which polkadot release to use in the .json files in the [polkadot-launch](./polkadot-launch) folder: -```json -{ - "relaychain": { - "bin": "../../../bin/polkadot-0.9.18", // <-- release to use - "chain": "kusama-local", - // --snip-- -``` -Then get and build `polkadot`: -```bash -# Compile Polkadot with the real overseer feature -git clone https://github.com/paritytech/polkadot -# Switch into the Polkadot directory -cd polkadot -# Checkout the proper commit -git checkout # release tag, just like in the example above: polkadot-0.9.18 -cargo build --release -# If this fails due to `feature `edition2021` is required` you have set an outdated rust default version. To fix this, you can simply run: -cargo +nightly-2022-01-31 build --release # or any other up-to-date nightly version - -# Generate a raw chain spec -./target/release/polkadot build-spec --chain rococo-local --disable-default-bootnode --raw > rococo-local-cfde.json -``` -Start the `Alice` validator: -```bash -./target/release/polkadot --chain rococo-local-cfde.json --alice --validator --tmp --port 30333 --ws-port 9944 -``` -When the node starts you will see several log messages. Take note of the node's Peer ID in the logs. We will need it when connecting other nodes to it. It will look something like this: -```bash -Local node identity is: 12D3KooWGjsmVmZCM1jPtVNp6hRbbkGBK3LADYNniJAKJ19NUYiq -``` -Start the `Bob` validator (in a second terminal): -```bash -./target/release/polkadot --chain rococo-local-cfde.json --validator --bob --bootnodes /ip4//tcp/30333/p2p/ --tmp --port 30334 --ws-port 9945 -``` - -More information can be found in the Substrate tutorial [Start a Relay Chain](https://docs.substrate.io/tutorials/v3/cumulus/start-relay/) - -#### Reserve a para ID -Go to [Polkadot Apps](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/parachains/parathreads). This links to the default port used for the alice relay chain node. But you can also use any other port of a node that is connected to your relay chain. - -Register the parachain via -Network > Parachains sub-page, click on Parathreads tab and use the + ParaId button. After registering, the collator should start producing blocks when the next era starts. -![image](https://d33wubrfki0l68.cloudfront.net/ab3d311e37364a9706f2747b98b24fc259398152/2c4ba/static/4e9213b9ee2f65cc7fa9ccddd73679a3/c1b63/paraid-reserve.png) - - - -#### Launch the Parachain - -Build the parachain: -```bash -# Compile -git clone https://github.com/integritee-network/parachain -# Switch into the Integritee parachain directory & build it -cd parachain -cargo build --release - -``` -Generate custom parachain specification: -```bash -./target/release/integritee-collator build-spec --chain integritee-rococo-local-dev --disable-default-bootnode > integritee-rococo-local-dev.json -``` -and update the `para_id` to the one you reserved on the relay-chain (default is `2000`): -```json -// --snip-- - "para_id": 2000, // <--- your already registered ID - // --snip-- - "parachainInfo": { - "parachainId": 2000 // <--- your already registered ID - }, - // --snip-- -``` -Then generate a raw chain spec derived from your modified plain chain spec: - -```bash -./target/release/integritee-collator build-spec --chain integritee-rococo-local-dev.json --raw --disable-default-bootnode > integritee-rococo-local-dev-raw.json -``` -Export genesis and wasm states: -```bash -# Export genesis state -./target/release/integritee-collator export-genesis-state --chain integritee-rococo-local-dev-raw.json > integritee-rococo-local-dev.state +All polkadot launch script can be found in the [polkadot-launch](/polkadot-launch/) folder. -# Export genesis wasm -./target/release/integritee-collator export-genesis-wasm --chain integritee-rococo-local-dev-raw.json > integritee-rococo-local-dev.wasm -``` -Start the first collator node: -```bash -./target/release/integritee-collator --dave --force-authoring --collator --tmp --chain integritee-rococo-local-dev-raw.json --port 40335 --ws-port 9946 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30337 --ws-port 9981 --bootnodes /ip4//tcp/30333/p2p/ -``` +### Manually launch a local Rococo Testnet -Additional information can be found in https://docs.substrate.io/tutorials/v3/cumulus/connect-parachain/. +Follow the steps provided in https://docs.substrate.io/tutorials/v3/cumulus/start-relay/ - -#### Register the Parachain -Go to [Polkadot Apps](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/parachains/parathreads). Register the parachain via the `paraSudoWrapper` pallet. After registering, the collator should start producing blocks when the next era starts - -**Note:** Change the `ParaId` to the value you used for reserving your parachain. - -![image](https://user-images.githubusercontent.com/2915325/99548884-1be13580-2987-11eb-9a8b-20be658d34f9.png) - -You may need to add custom type overwrites in Settings -> Developer: -``` -{ - "Address": "MultiAddress", - "LookupSource": "MultiAddress", - "ShardIdentifier": "Hash" -} -``` - - -### Deploy on rococo - -Prepare genesis state and wasm as follows: - -```bash -# Export genesis state -./target/release/integritee-collator export-genesis-state --chain integritee-rococo-local-dev > integritee-rococo-local-dev.state - -# Export genesis wasm -./target/release/integritee-collator export-genesis-wasm --chain integritee-rococo-local-dev > integritee-rococo-local-dev.wasm - -``` -then propose the parachain on rococo relay-chain - -run collator -``` -integritee-collator \ - --collator \ - --chain integritee-rococo-local-dev \ - --rpc-cors all \ - --name integritee-rococo-collator-1 \ - -- --execution wasm --chain rococo - -``` +But keep the following in mind: +- Our chain has a paraid of 2015 on Rococo and Kusama (see [polkadot-parachains/src/command.rs#44-49](/polkadot-parachains/src/command.rs#44-49)) +- For testing on rococo-local use the chain spec `integritee-rococo-local-dev` +- More chain specs can be found in [polkadot-parachains/src/command.rs](/polkadot-parachains/src/command.rs) ### Runtime upgrade Two runtimes are contained in this repository. First, the shell-runtime, which has been extended compared to the upstream shell-runtime. It has some additional modules including sudo to facilitate a @@ -195,3 +69,4 @@ The benchmarks are run with the following script: ### More Resources * Thorough Readme about Rococo and Collators in general in the original [repository](https://github.com/paritytech/cumulus) of this fork. * Parachains Development in the [Polkadot Wiki](https://wiki.polkadot.network/docs/build-pdk) +* encointer parachain readme: https://github.com/encointer/encointer-parachain From 28e1ef87b756807d1373f0611c3e327327f54148 Mon Sep 17 00:00:00 2001 From: haerdib Date: Fri, 29 Apr 2022 10:50:17 +0200 Subject: [PATCH 15/16] some nice up ness --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 422ab294..361ae28d 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,12 @@ But keep the following in mind: - For testing on rococo-local use the chain spec `integritee-rococo-local-dev` - More chain specs can be found in [polkadot-parachains/src/command.rs](/polkadot-parachains/src/command.rs) -### Runtime upgrade +## Runtime upgrade Two runtimes are contained in this repository. First, the shell-runtime, which has been extended compared to the upstream shell-runtime. It has some additional modules including sudo to facilitate a runtime upgrade with the [sudo upgrade](https://substrate.dev/docs/en/tutorials/forkless-upgrade/sudo-upgrade) method. Second, it runs with the same executor instance as the integritee-runtime, such that an eventual upgrade is simpler to perform, i.e., only the runtime needs to be upgraded whereas the client can remain the same. Hence, all modules revolving around aura have been included, which provide data the client needs. -#### Upgrade procedure +### Upgrade procedure Prepare a local shell network and generate the `integritee-runtime` wasm blob, which contains the upgraded runtime to be executed after the runtime upgrade. ```bash # launch local setup @@ -66,7 +66,7 @@ The benchmarks are run with the following script: ``` -### More Resources +## More Resources * Thorough Readme about Rococo and Collators in general in the original [repository](https://github.com/paritytech/cumulus) of this fork. * Parachains Development in the [Polkadot Wiki](https://wiki.polkadot.network/docs/build-pdk) * encointer parachain readme: https://github.com/encointer/encointer-parachain From dd9ed119c4ce257ad965dc3c0b8942fdf9386f56 Mon Sep 17 00:00:00 2001 From: haerdib Date: Thu, 5 May 2022 14:04:54 +0200 Subject: [PATCH 16/16] remove 2nd polkadot launch cmd --- README.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 361ae28d..60c34001 100644 --- a/README.md +++ b/README.md @@ -6,17 +6,15 @@ This is the repository to run Integritee as a parachain on Kusama and Rococo. It ### Polkadot-launch -Quick: see [polkadot-launch](https://github.com/paritytech/polkadot-launch.git) -``` -node ../polkadot-launch/dist/cli.js launch-rococo-local-with-integritee.json -``` -or +Install polkadot-launch according to the instruction in [polkadot-launch](https://github.com/paritytech/polkadot-launch#install) + +and use it with + ``` polkadot-launch launch-rococo-local-with-integritee.json ``` -depending on how you installed `polkadot-launch`. -All polkadot launch script can be found in the [polkadot-launch](/polkadot-launch/) folder. +All polkadot launch scripts can be found in the [polkadot-launch](/polkadot-launch/) folder. ### Manually launch a local Rococo Testnet