Rename canvas to contracts (#1265)

* Update SVG

* Rename `canvas-kusama` folder `contracts-rococo`

* Search-Replace `canvas-kusama` with `contracts-rococo`

* Search-Replace `canvas_kusama` with `contracts_rococo`

* Search-Replace `canvas_rococo` with `contracts_rococo`

* Rename `canvas-rococo.json` to `contracts-rococo.json`

* Rename `CanvasKusamaChainSpec` to `ContractsRococoChainSpec`

* Migrate chain specs and configurations to `contracts-rococo`

* Adapt readme

* Improve directory structure

* Remove last occurrences of `canvas`

* Apply `cargo fmt`

* Update README.md

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Fix funny indentation

* Fix wasm path renaming

Co-authored-by: Alexander Theißen <alex.theissen@me.com>
Co-authored-by: Wilfried Kopp <wilfried@parity.io>
Co-authored-by: Chevdor <chevdor@users.noreply.github.com>
This commit is contained in:
Michael Müller
2022-05-18 11:56:34 +02:00
committed by GitHub
parent a5bfd11b5f
commit d0e13bc311
25 changed files with 292 additions and 330 deletions
@@ -43,7 +43,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
runtime: ["shell", "statemine", "statemint", "westmint", "rococo-parachain", "canvas-kusama"]
runtime: ["shell", "statemine", "statemint", "westmint", "rococo-parachain", "contracts-rococo"]
steps:
- name: Checkout sources
uses: actions/checkout@v3
@@ -135,7 +135,7 @@ jobs:
STATEMINE_DIGEST: ${{ github.workspace}}/statemine-srtool-json/statemine-srtool-digest.json
STATEMINT_DIGEST: ${{ github.workspace}}/statemint-srtool-json/statemint-srtool-digest.json
ROCOCO_PARA_DIGEST: ${{ github.workspace}}/rococo-parachain-srtool-json/rococo-parachain-srtool-digest.json
CANVAS_KUSAMA_DIGEST: ${{ github.workspace}}/canvas-kusama-srtool-json/canvas-kusama-srtool-digest.json
CANVAS_KUSAMA_DIGEST: ${{ github.workspace}}/contracts-rococo-srtool-json/contracts-rococo-srtool-digest.json
REF1: ${{ github.event.inputs.ref1 }}
REF2: ${{ github.event.inputs.ref2 }}
PRE_RELEASE: ${{ github.event.inputs.pre_release }}
@@ -191,7 +191,7 @@ jobs:
RUNTIME_DIR: polkadot-parachains
strategy:
matrix:
runtime: ["shell", "statemine", "statemint", "westmint", "rococo-parachain", "canvas-kusama"]
runtime: ["shell", "statemine", "statemint", "westmint", "rococo-parachain", "contracts-rococo"]
steps:
- name: Checkout sources
uses: actions/checkout@v3
@@ -221,8 +221,7 @@ jobs:
id: fix-runtime-path
run: |
cd "${{ matrix.runtime }}-runtime/"
mv "$(sed 's/-parachain/_parachain/' <<< ${{ matrix.runtime }})_runtime.compact.compressed.wasm" "${{ matrix.runtime }}_runtime.compact.compressed.wasm" || true
mv "$(sed 's/-kusama/_kusama/' <<< ${{ matrix.runtime }})_runtime.compact.compressed.wasm" "${{ matrix.runtime }}_runtime.compact.compressed.wasm" || true
mv "$(sed -E 's/-(.*)/_\1/' <<< ${{ matrix.runtime }})_runtime.compact.compressed.wasm" "${{ matrix.runtime }}_runtime.compact.compressed.wasm" || true
- name: Upload compressed ${{ matrix.runtime }} wasm
uses: actions/upload-release-asset@v1
+1 -1
View File
@@ -27,7 +27,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
chain: ["statemine", "westmint", "statemint", "rococo-parachain", "shell", "canvas-kusama"]
chain: ["statemine", "westmint", "statemint", "rococo-parachain", "shell", "contracts-rococo"]
steps:
- uses: actions/checkout@v3
with:
Generated
+67 -67
View File
@@ -924,72 +924,6 @@ dependencies = [
"serde",
]
[[package]]
name = "canvas-kusama-runtime"
version = "0.2.0"
dependencies = [
"cumulus-pallet-aura-ext",
"cumulus-pallet-dmp-queue",
"cumulus-pallet-parachain-system",
"cumulus-pallet-session-benchmarking",
"cumulus-pallet-xcm",
"cumulus-pallet-xcmp-queue",
"cumulus-primitives-core",
"cumulus-primitives-timestamp",
"cumulus-primitives-utility",
"frame-benchmarking",
"frame-executive",
"frame-support",
"frame-system",
"frame-system-benchmarking",
"frame-system-rpc-runtime-api",
"frame-try-runtime",
"hex-literal",
"kusama-runtime-constants",
"log",
"pallet-aura",
"pallet-authorship",
"pallet-balances",
"pallet-collator-selection",
"pallet-contracts",
"pallet-contracts-primitives",
"pallet-contracts-rpc-runtime-api",
"pallet-multisig",
"pallet-randomness-collective-flip",
"pallet-session",
"pallet-sudo",
"pallet-timestamp",
"pallet-transaction-payment",
"pallet-transaction-payment-rpc-runtime-api",
"pallet-utility",
"pallet-xcm",
"parachain-info",
"parachains-common",
"parity-scale-codec",
"polkadot-core-primitives",
"polkadot-parachain 0.9.22",
"polkadot-runtime-common",
"scale-info",
"serde",
"smallvec",
"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",
"xcm",
"xcm-builder",
"xcm-executor",
]
[[package]]
name = "cargo-platform"
version = "0.1.2"
@@ -1231,6 +1165,72 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
[[package]]
name = "contracts-rococo-runtime"
version = "0.2.0"
dependencies = [
"cumulus-pallet-aura-ext",
"cumulus-pallet-dmp-queue",
"cumulus-pallet-parachain-system",
"cumulus-pallet-session-benchmarking",
"cumulus-pallet-xcm",
"cumulus-pallet-xcmp-queue",
"cumulus-primitives-core",
"cumulus-primitives-timestamp",
"cumulus-primitives-utility",
"frame-benchmarking",
"frame-executive",
"frame-support",
"frame-system",
"frame-system-benchmarking",
"frame-system-rpc-runtime-api",
"frame-try-runtime",
"hex-literal",
"kusama-runtime-constants",
"log",
"pallet-aura",
"pallet-authorship",
"pallet-balances",
"pallet-collator-selection",
"pallet-contracts",
"pallet-contracts-primitives",
"pallet-contracts-rpc-runtime-api",
"pallet-multisig",
"pallet-randomness-collective-flip",
"pallet-session",
"pallet-sudo",
"pallet-timestamp",
"pallet-transaction-payment",
"pallet-transaction-payment-rpc-runtime-api",
"pallet-utility",
"pallet-xcm",
"parachain-info",
"parachains-common",
"parity-scale-codec",
"polkadot-core-primitives",
"polkadot-parachain 0.9.22",
"polkadot-runtime-common",
"scale-info",
"serde",
"smallvec",
"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",
"xcm",
"xcm-builder",
"xcm-executor",
]
[[package]]
name = "convert_case"
version = "0.4.0"
@@ -7693,8 +7693,8 @@ version = "0.9.190"
dependencies = [
"assert_cmd",
"async-trait",
"canvas-kusama-runtime",
"clap 3.1.18",
"contracts-rococo-runtime",
"cumulus-client-cli",
"cumulus-client-consensus-aura",
"cumulus-client-consensus-common",
+1 -1
View File
@@ -33,7 +33,7 @@ members = [
"polkadot-parachains/statemint",
"polkadot-parachains/statemine",
"polkadot-parachains/westmint",
"polkadot-parachains/canvas-kusama",
"polkadot-parachains/contracts-rococo",
"test/client",
"test/relay-sproof-builder",
"test/relay-validation-worker-provider",
+3 -89
View File
@@ -59,95 +59,9 @@ CHAIN=westmint # or statemine
Refer to the [setup instructions below](#local-setup) to run a local network for development.
## Canvas 🧑‍🎨
## Contracts 📝
[![matrix][k1]][k2] [![discord][l1]][l2]
[k1]: https://img.shields.io/badge/matrix-chat-brightgreen.svg?style=flat
[k2]: https://riot.im/app/#/room/#ink:matrix.parity.io
[l1]: https://img.shields.io/discord/722223075629727774?style=flat-square&label=discord
[l2]: https://discord.com/invite/wGUDt2p
This is a node implementation of `Canvas`, a common good parachain for `pallet-contracts`
based wasm smart contracts. Right now this repository only contains the `canvas-kusama` runtime
which we plan to use for both Rococo and Kusama.
If you have any questions, feel free to talk to us on [Element][k2] or on [Discord][l2]
(in the [`ink_smart-contracts`](https://discord.com/channels/722223075629727774/765280480609828864) channel).
## Developing Smart Contracts for Canvas
![Canvas Overview](./docs/canvas-overview.svg)
This node contains Substrate's smart contracts module the
[`contracts`](https://github.com/paritytech/substrate/tree/master/frame/contracts) pallet.
This `contracts` pallet takes smart contracts as WebAssembly blobs and defines an API
for everything a smart contract needs (storage access, …).
As long as a programming language compiles to WebAssembly and there exists an implementation
of this API in it, you can write a smart contract for this pallet and thus for Canvas in
that language.
This is a list of languages you can currently choose from:
* [Parity's ink!](https://github.com/paritytech/ink) for Rust
* [ask!](https://github.com/patractlabs/ask) for Assembly Script
* The [Solang](https://github.com/hyperledger-labs/solang) compiler for Solidity
There are also different user interfaces and command-line tools you can use to deploy
or interact with contracts:
* [polkadot-js](https://polkadot.js.org/apps/)
* [Canvas UI](https://paritytech.github.io/canvas-ui/) (outdated)
If you are looking for a quickstart, we can recommend
[ink!'s Guided Tutorial for Beginners](https://docs.substrate.io/tutorials/v3/ink-workshop/pt1/).
### Build & Launch a Node
To run a Canvas node that connects to Rococo (Kusama and Polkadot parachains are not deployed, yet)
you will need to compile the `polkadot-parachain` binary:
```bash
cargo build --release --locked -p polkadot-parachain
```
Once the executable is built, launch the parachain node via:
```bash
./target/release/polkadot-parachain --chain rocanvas
```
Refer to the [setup instructions below](#local-setup) to run a local network for development.
### Rococo Deployment
We have a live deployment of the Canvas parachain on [Rococo](https://wiki.polkadot.network/docs/build-pdk#rococo-testnet)
a testnet for Polkadot and Kusama parachains.
You can interact with the network through Polkadot JS Apps,
[click here for a direct link to Canvas](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frococo-canvas-rpc.polkadot.io#/explorer).
The Canvas parachain uses the Rococo relay chain's native token (ROC) instead of having its own token.
Due to this you'll need ROC in order to deploy contracts on Canvas.
As a first step, you should create an account. See [here](https://wiki.polkadot.network/docs/learn-account-generation)
for a detailed guide.
As a second step, you have to get ROC testnet tokens through the [Rococo Faucet](https://wiki.polkadot.network/docs/learn-DOT#getting-rococo-tokens).
This is a chat room in which you need to write:
```bash
!drip YOUR_SS_58_ADDRESS:1002
```
The number `1002` is the parachain id of Canvas on Rococo, by supplying it the faucet will teleport ROC
tokens directly to your account on the parachain.
If everything worked out, the teleported ROC tokens will show up under
[the "Accounts" tab for Canvas](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frococo-canvas-rpc.polkadot.io#/accounts).
Once you have ROC on Canvas you can deploy a contract as you would normally.
If you're unsure about this, our [guided tutorial](https://docs.substrate.io/tutorials/v3/ink-workshop/pt1/)
will clarify that for you in no time.
See [the `contracts-rococo` readme](polkadot-parachains/contracts-rococo/README.md) for details.
## Rococo 👑
@@ -190,7 +104,7 @@ Once the executable is built, launch collators for each parachain (repeat once e
### Parachains
* [Statemint](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frococo-statemint-rpc.polkadot.io#/explorer)
* [Canvas on Rococo](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frococo-canvas-rpc.polkadot.io#/explorer)
* [Contracts on Rococo](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frococo-contracts-rpc.polkadot.io#/explorer)
* [RILT](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frococo.kilt.io#/explorer)
The network uses horizontal message passing (HRMP) to enable communication between parachains and
+2 -2
View File
@@ -26,8 +26,8 @@ seedling-runtime = { path = "seedling" }
statemint-runtime = { path = "statemint" }
statemine-runtime = { path = "statemine" }
westmint-runtime = { path = "westmint" }
canvas-kusama-runtime = { path = "canvas-kusama" }
jsonrpsee = { version = "0.13.1", features = ["server"] }
contracts-rococo-runtime = { path = "contracts-rococo" }
jsonrpsee = { version = "0.13.0", features = ["server"] }
parachains-common = { path = "parachains-common" }
# Substrate
@@ -1,5 +1,5 @@
[package]
name = "canvas-kusama-runtime"
name = "contracts-rococo-runtime"
version = "0.2.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
@@ -0,0 +1,88 @@
# Contracts 📝
This is a parachain node for smart contracts; it contains a default configuration of
Substrate's module for smart contracts the [`pallet-contracts`](https://github.com/paritytech/substrate/tree/master/frame/contracts).
The node is only available on Rococo, a testnet for Polkadot and Kusama parachains.
It has been configured as a common good parachain, as such it uses the Rococo relay
chain's native token `ROC` instead of defining a token of its own.
See the section [Rococo Deployment](#rococo-deployment) below for more details.
If you have any questions, it's best to ask in the
[Substrate StackExchange](https://substrate.stackexchange.com/).
## Smart Contracts Development
![Contracts Overview](./contracts-overview.svg)
This node contains Substrate's smart contracts module the
[`pallet-contracts`](https://github.com/paritytech/substrate/tree/master/frame/contracts).
This pallet takes smart contracts as WebAssembly blobs and defines an API
for everything a smart contract needs (storage access, …).
As long as a programming language compiles to WebAssembly and there exists an implementation
of this API in it, you can write a smart contract for this pallet (and thus for this parachain)
in that language.
This is a list of languages you can currently choose from:
* [Parity's ink!](https://github.com/paritytech/ink) for Rust.
* [ask!](https://github.com/patractlabs/ask) for Assembly Script.
* The [Solang](https://github.com/hyperledger-labs/solang) compiler for Solidity.
There are also different user interfaces and command-line tools you can use to deploy
or interact with contracts:
* [Contracts UI](https://paritytech.github.io/contracts-ui/) a beginner-friendly UI for smart contract developers.
* [polkadot-js](https://polkadot.js.org/apps/) the go-to expert UI for smart contract developers.
* [cargo-contract](https://github.com/paritytech/cargo-contract) a CLI tool, ideal for scripting or your terminal workflow.
If you are looking for a quickstart, we can recommend
[ink!'s Guided Tutorial for Beginners](https://docs.substrate.io/tutorials/v3/ink-workshop/pt1/).
### Build & Launch a Node
To run a Contracts node that connects to Rococo
you will need to compile the `polkadot-parachain` binary:
```bash
cargo build --release --locked -p polkadot-parachain
```
Once the executable is built, launch the parachain node via:
```bash
./target/release/polkadot-parachain --chain contracts-rococo
```
Refer to the [setup instructions below](#local-setup) to run a local network for development.
### Rococo Deployment
We have a live deployment on [Rococo](https://wiki.polkadot.network/docs/build-pdk#rococo-testnet)
a testnet for Polkadot and Kusama parachains.
You can interact with the network through Polkadot JS Apps,
[click here for a direct link to the parachain](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frococo-contracts-rpc.polkadot.io#/explorer).
This parachain uses the Rococo relay chain's native token `ROC` instead of defining a token of its own.
Due to this you'll need `ROC` in order to deploy contracts on this parachain.
As a first step, you should create an account. See [here](https://wiki.polkadot.network/docs/learn-account-generation)
for a detailed guide.
As a second step, you have to get `ROC` testnet tokens through the [Rococo Faucet](https://wiki.polkadot.network/docs/learn-DOT#getting-rococo-tokens).
This is a chat room in which you need to write:
```bash
!drip YOUR_SS_58_ADDRESS:1002
```
The number `1002` is the id of this parachain on Rococo, by supplying it the faucet will teleport `ROC`
tokens directly to your account on the parachain.
If everything worked out, the teleported `ROC` tokens will show up under
[the "Accounts" tab](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frococo-contracts-rpc.polkadot.io#/accounts).
Once you have `ROC` you can deploy a contract as you would normally.
If you're unsure about this, our [guided tutorial](https://docs.substrate.io/tutorials/v3/ink-workshop/pt1/)
will clarify that for you in no time.
@@ -5,8 +5,8 @@
viewBox="0 0 829 715"
version="1.1"
id="svg8"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20, custom)"
sodipodi:docname="how-it-works.svg"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04, custom)"
sodipodi:docname="contracts-overview.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
@@ -18,6 +18,12 @@
xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<defs
id="defs2">
<rect
x="1884.4672"
y="1809.4276"
width="15.066266"
height="98.981716"
id="rect5129" />
<marker
style="overflow:visible"
id="marker7726"
@@ -285,16 +291,16 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.12114248"
inkscape:cx="429.24663"
inkscape:cy="1943.9919"
inkscape:zoom="0.48456992"
inkscape:cx="1583.8788"
inkscape:cy="1657.1396"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
showguides="true"
inkscape:window-width="1471"
inkscape:window-height="1080"
inkscape:window-width="1918"
inkscape:window-height="1055"
inkscape:window-x="0"
inkscape:window-y="23"
inkscape:window-maximized="1"
@@ -487,26 +493,26 @@
x="649.55072"
y="591.22406"
id="text835-0-9"><tspan
sodipodi:role="line"
x="649.55072"
y="591.22406"
style="font-size:14.1111px;line-height:1.25;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke-width:0.264583"
id="tspan1075-9" /><tspan
sodipodi:role="line"
id="tspan1075-9"
sodipodi:role="line" /><tspan
x="649.55072"
y="617.64673"
style="font-size:15.875px;line-height:0.72;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke-width:0.264583"
id="tspan2428">The WebAssembly blob targets</tspan><tspan
sodipodi:role="line"
y="610.42358"
style="font-size:15.875px;line-height:1.25;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke-width:0.264583"
id="tspan2428"
sodipodi:role="line">The WebAssembly blob targets</tspan><tspan
x="649.55072"
y="640.50671"
style="font-size:15.875px;line-height:0.72;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke-width:0.264583"
id="tspan2430">an API exposed by Substrate's</tspan><tspan
sodipodi:role="line"
y="630.26733"
style="font-size:15.875px;line-height:1.25;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke-width:0.264583"
id="tspan2430"
sodipodi:role="line">an API exposed by Substrate's</tspan><tspan
x="649.55072"
y="651.93671"
style="font-size:15.875px;line-height:0.72;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke-width:0.264583"
id="tspan2432">contracts module.</tspan></text>
y="650.11108"
style="font-size:15.875px;line-height:1.25;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke-width:0.264583"
id="tspan2432"
sodipodi:role="line">contracts module.</tspan></text>
<g
id="g1342">
<g
@@ -709,56 +715,11 @@
r="5.4990706" />
</g>
</g>
<g
id="g1493">
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:25.4px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="223.87091"
y="475.59076"
id="text1087-3"><tspan
sodipodi:role="line"
x="223.87091"
y="475.59076"
style="font-size:25.4px;text-align:center;text-anchor:middle;fill:#000000;stroke-width:0.264583"
id="tspan2399-7">Canvas</tspan></text>
<g
id="g9297"
transform="translate(187.58423,255.21786)">
<circle
cx="-43.440742"
cy="211.92067"
r="26.458332"
fill="#000000"
id="circle9169"
style="stroke-width:0.264583" />
<path
d="m -48.732408,217.21233 h 10.583334 v 10.58333 h -10.583334 z"
fill="#ffffff"
id="path9171"
style="stroke-width:0.264583" />
<path
d="m -48.732408,196.04566 h 10.583334 V 206.629 h -10.583334 z"
fill="#ffffff"
id="path9173"
style="stroke-width:0.264583" />
<path
d="m -59.315741,206.629 h 10.583333 v 10.58333 h -10.583333 z"
fill="#ffffff"
id="path9175"
style="stroke-width:0.264583" />
<path
d="m -27.565741,206.629 c 0,-1.38983 -0.273844,-2.76604 -0.805656,-4.05006 -0.531813,-1.28405 -1.311275,-2.45073 -2.294202,-3.4335 -0.982663,-0.98274 -2.149475,-1.76231 -3.433498,-2.29417 -1.284023,-0.53187 -2.660121,-0.80561 -4.049977,-0.80561 V 206.629 Z"
fill="#ffffff"
id="path9177"
style="stroke-width:0.264583" />
<path
d="m -38.149074,227.79566 c 1.389856,0 2.765954,-0.27384 4.049977,-0.80565 1.284023,-0.53182 2.450835,-1.31128 3.433498,-2.29421 0.982927,-0.98266 1.762389,-2.14947 2.294202,-3.43349 0.531812,-1.28403 0.805656,-2.66012 0.805656,-4.04998 h -10.583333 z"
fill="#ffffff"
id="path9179"
style="stroke-width:0.264583" />
</g>
</g>
<text
xml:space="preserve"
transform="matrix(0.26458333,0,0,0.26458333,76.682965,41.563407)"
id="text5127"
style="fill:black;fill-opacity:1;stroke:none;font-family:sans-serif;font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;letter-spacing:0px;word-spacing:0px;white-space:pre;shape-inside:url(#rect5129)" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 86 KiB

@@ -108,8 +108,8 @@ impl_opaque_keys! {
#[sp_version::runtime_version]
pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("canvas-kusama"),
impl_name: create_runtime_str!("canvas-kusama"),
spec_name: create_runtime_str!("contracts-rococo"),
impl_name: create_runtime_str!("contracts-rococo"),
authoring_version: 1,
spec_version: 900,
impl_version: 0,
@@ -538,7 +538,7 @@ impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, B
#[cfg(feature = "try-runtime")]
impl frame_try_runtime::TryRuntime<Block> for Runtime {
fn on_runtime_upgrade() -> (Weight, Weight) {
log::info!("try-runtime::on_runtime_upgrade canvas");
log::info!("try-runtime::on_runtime_upgrade contracts");
let weight = Executive::try_runtime_upgrade().unwrap();
(weight, RuntimeBlockWeights::get().max_block)
}
@@ -1,6 +1,6 @@
{
"name": "Canvas on Rococo",
"id": "canvas-rococo",
"name": "Contracts on Rococo",
"id": "contracts-rococo",
"chainType": "Live",
"bootNodes": [
"/ip4/34.90.191.237/tcp/30333/p2p/12D3KooWKg3Rpxcr9oJ8n6khoxpGKWztCZydtUZk2cojHqnfLrpj",
@@ -80,4 +80,4 @@
"childrenDefault": {}
}
}
}
}
+46 -47
View File
@@ -835,39 +835,38 @@ fn westmint_genesis(
}
}
/// We use the same runtime on kusama and rococo.
pub type CanvasKusamaChainSpec =
sc_service::GenericChainSpec<canvas_kusama_runtime::GenesisConfig, Extensions>;
pub type ContractsRococoChainSpec =
sc_service::GenericChainSpec<contracts_rococo_runtime::GenesisConfig, Extensions>;
/// No relay chain suffix because the id is the same over all relay chains.
const CANVAS_PARACHAIN_ID: u32 = 1002;
const CONTRACTS_PARACHAIN_ID: u32 = 1002;
/// The existential deposit is determined by the runtime "canvas-kusama".
const CANVAS_KUSAMA_ED: canvas_kusama_runtime::Balance =
canvas_kusama_runtime::constants::currency::EXISTENTIAL_DEPOSIT;
/// The existential deposit is determined by the runtime "contracts-rococo".
const CONTRACTS_ROCOCO_ED: contracts_rococo_runtime::Balance =
contracts_rococo_runtime::constants::currency::EXISTENTIAL_DEPOSIT;
pub fn canvas_rococo_development_config() -> CanvasKusamaChainSpec {
pub fn contracts_rococo_development_config() -> ContractsRococoChainSpec {
let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "ROC".into());
properties.insert("tokenDecimals".into(), 12.into());
CanvasKusamaChainSpec::from_genesis(
ContractsRococoChainSpec::from_genesis(
// Name
"Canvas on Rococo Development",
"Contracts on Rococo Development",
// ID
"canvas-rococo-dev",
"contracts-rococo-dev",
ChainType::Development,
move || {
canvas_kusama_genesis(
contracts_rococo_genesis(
// initial collators.
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_collator_keys_from_seed::<canvas_kusama_runtime::AuraId>("Alice"),
get_collator_keys_from_seed::<contracts_rococo_runtime::AuraId>("Alice"),
),
(
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_collator_keys_from_seed::<canvas_kusama_runtime::AuraId>("Bob"),
get_collator_keys_from_seed::<contracts_rococo_runtime::AuraId>("Bob"),
),
],
vec![
@@ -884,7 +883,7 @@ pub fn canvas_rococo_development_config() -> CanvasKusamaChainSpec {
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
],
CANVAS_PARACHAIN_ID.into(),
CONTRACTS_PARACHAIN_ID.into(),
)
},
Vec::new(),
@@ -894,33 +893,33 @@ pub fn canvas_rococo_development_config() -> CanvasKusamaChainSpec {
None,
Extensions {
relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
para_id: CANVAS_PARACHAIN_ID,
para_id: CONTRACTS_PARACHAIN_ID,
},
)
}
pub fn canvas_rococo_local_config() -> CanvasKusamaChainSpec {
pub fn contracts_rococo_local_config() -> ContractsRococoChainSpec {
let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "ROC".into());
properties.insert("tokenDecimals".into(), 12.into());
CanvasKusamaChainSpec::from_genesis(
ContractsRococoChainSpec::from_genesis(
// Name
"Canvas on Rococo",
"Contracts on Rococo",
// ID
"canvas-rococo-local",
"contracts-rococo-local",
ChainType::Local,
move || {
canvas_kusama_genesis(
contracts_rococo_genesis(
// initial collators.
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_collator_keys_from_seed::<canvas_kusama_runtime::AuraId>("Alice"),
get_collator_keys_from_seed::<contracts_rococo_runtime::AuraId>("Alice"),
),
(
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_collator_keys_from_seed::<canvas_kusama_runtime::AuraId>("Bob"),
get_collator_keys_from_seed::<contracts_rococo_runtime::AuraId>("Bob"),
),
],
vec![
@@ -937,7 +936,7 @@ pub fn canvas_rococo_local_config() -> CanvasKusamaChainSpec {
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
],
CANVAS_PARACHAIN_ID.into(),
CONTRACTS_PARACHAIN_ID.into(),
)
},
// Bootnodes
@@ -953,25 +952,25 @@ pub fn canvas_rococo_local_config() -> CanvasKusamaChainSpec {
// Extensions
Extensions {
relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
para_id: CANVAS_PARACHAIN_ID,
para_id: CONTRACTS_PARACHAIN_ID,
},
)
}
pub fn canvas_rococo_config() -> CanvasKusamaChainSpec {
pub fn contracts_rococo_config() -> ContractsRococoChainSpec {
// Give your base currency a unit name and decimal places
let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "ROC".into());
properties.insert("tokenDecimals".into(), 12.into());
CanvasKusamaChainSpec::from_genesis(
ContractsRococoChainSpec::from_genesis(
// Name
"Canvas on Rococo",
"Contracts on Rococo",
// ID
"canvas-rococo",
"contracts-rococo",
ChainType::Live,
move || {
canvas_kusama_genesis(
contracts_rococo_genesis(
vec![
// 5GKFbTTgrVS4Vz1UWWHPqMZQNFWZtqo7H2KpCDyYhEL3aS26
(
@@ -1012,7 +1011,7 @@ pub fn canvas_rococo_config() -> CanvasKusamaChainSpec {
// AccountId of an account which `ink-waterfall` uses for automated testing
hex!["0e47e2344d523c3cc5c34394b0d58b9a4200e813a038e6c5a6163cc07d70b069"].into(),
],
CANVAS_PARACHAIN_ID.into(),
CONTRACTS_PARACHAIN_ID.into(),
)
},
// Bootnodes
@@ -1039,38 +1038,38 @@ pub fn canvas_rococo_config() -> CanvasKusamaChainSpec {
// Properties
Some(properties),
// Extensions
Extensions { relay_chain: "rococo".into(), para_id: CANVAS_PARACHAIN_ID },
Extensions { relay_chain: "rococo".into(), para_id: CONTRACTS_PARACHAIN_ID },
)
}
fn canvas_kusama_genesis(
fn contracts_rococo_genesis(
invulnerables: Vec<(AccountId, AuraId)>,
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> canvas_kusama_runtime::GenesisConfig {
canvas_kusama_runtime::GenesisConfig {
system: canvas_kusama_runtime::SystemConfig {
code: canvas_kusama_runtime::WASM_BINARY
) -> contracts_rococo_runtime::GenesisConfig {
contracts_rococo_runtime::GenesisConfig {
system: contracts_rococo_runtime::SystemConfig {
code: contracts_rococo_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
},
balances: canvas_kusama_runtime::BalancesConfig {
balances: contracts_rococo_runtime::BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
},
parachain_info: canvas_kusama_runtime::ParachainInfoConfig { parachain_id: id },
collator_selection: canvas_kusama_runtime::CollatorSelectionConfig {
parachain_info: contracts_rococo_runtime::ParachainInfoConfig { parachain_id: id },
collator_selection: contracts_rococo_runtime::CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: CANVAS_KUSAMA_ED * 16,
candidacy_bond: CONTRACTS_ROCOCO_ED * 16,
..Default::default()
},
session: canvas_kusama_runtime::SessionConfig {
session: contracts_rococo_runtime::SessionConfig {
keys: invulnerables
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // validator id
canvas_kusama_runtime::SessionKeys { aura }, // session keys
acc.clone(), // account id
acc, // validator id
contracts_rococo_runtime::SessionKeys { aura }, // session keys
)
})
.collect(),
@@ -1080,10 +1079,10 @@ fn canvas_kusama_genesis(
aura: Default::default(),
aura_ext: Default::default(),
parachain_system: Default::default(),
polkadot_xcm: canvas_kusama_runtime::PolkadotXcmConfig {
polkadot_xcm: contracts_rococo_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
},
sudo: canvas_kusama_runtime::SudoConfig {
sudo: contracts_rococo_runtime::SudoConfig {
key: Some(
hex!["2681a28014e7d3a5bfb32a003b3571f53c408acbc28d351d6bf58f5028c4ef14"].into(),
),
+20 -21
View File
@@ -46,7 +46,7 @@ trait IdentifyChain {
fn is_statemint(&self) -> bool;
fn is_statemine(&self) -> bool;
fn is_westmint(&self) -> bool;
fn is_canvas_kusama(&self) -> bool;
fn is_contracts_rococo(&self) -> bool;
}
impl IdentifyChain for dyn sc_service::ChainSpec {
@@ -65,9 +65,8 @@ impl IdentifyChain for dyn sc_service::ChainSpec {
fn is_westmint(&self) -> bool {
self.id().starts_with("westmint")
}
fn is_canvas_kusama(&self) -> bool {
// we use the same runtime on rococo and kusama
self.id().starts_with("canvas-kusama") || self.id().starts_with("canvas-rococo")
fn is_contracts_rococo(&self) -> bool {
self.id().starts_with("contracts-rococo")
}
}
@@ -87,8 +86,8 @@ impl<T: sc_service::ChainSpec + 'static> IdentifyChain for T {
fn is_westmint(&self) -> bool {
<dyn sc_service::ChainSpec>::is_westmint(self)
}
fn is_canvas_kusama(&self) -> bool {
<dyn sc_service::ChainSpec>::is_canvas_kusama(self)
fn is_contracts_rococo(&self) -> bool {
<dyn sc_service::ChainSpec>::is_contracts_rococo(self)
}
}
@@ -133,12 +132,12 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, St
"westmint" => Box::new(chain_spec::ChainSpec::from_json_bytes(
&include_bytes!("../res/westmint.json")[..],
)?),
// -- Canvas on Rococo
"canvas-rococo-dev" => Box::new(chain_spec::canvas_rococo_development_config()),
"canvas-rococo-local" => Box::new(chain_spec::canvas_rococo_local_config()),
"canvas-rococo-genesis" => Box::new(chain_spec::canvas_rococo_config()),
"canvas-rococo" => Box::new(chain_spec::ChainSpec::from_json_bytes(
&include_bytes!("../res/canvas-rococo.json")[..],
// -- Contracts on Rococo
"contracts-rococo-dev" => Box::new(chain_spec::contracts_rococo_development_config()),
"contracts-rococo-local" => Box::new(chain_spec::contracts_rococo_local_config()),
"contracts-rococo-genesis" => Box::new(chain_spec::contracts_rococo_config()),
"contracts-rococo" => Box::new(chain_spec::ChainSpec::from_json_bytes(
&include_bytes!("../res/contracts-rococo.json")[..],
)?),
// -- Fallback (generic chainspec)
"" => Box::new(chain_spec::get_chain_spec()),
@@ -155,8 +154,8 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, St
Box::new(chain_spec::ShellChainSpec::from_json_file(path.into())?)
} else if chain_spec.is_seedling() {
Box::new(chain_spec::SeedlingChainSpec::from_json_file(path.into())?)
} else if chain_spec.is_canvas_kusama() {
Box::new(chain_spec::CanvasKusamaChainSpec::from_json_file(path.into())?)
} else if chain_spec.is_contracts_rococo() {
Box::new(chain_spec::ContractsRococoChainSpec::from_json_file(path.into())?)
} else {
Box::new(chain_spec)
}
@@ -210,8 +209,8 @@ impl SubstrateCli for Cli {
&shell_runtime::VERSION
} else if chain_spec.is_seedling() {
&seedling_runtime::VERSION
} else if chain_spec.is_canvas_kusama() {
&canvas_kusama_runtime::VERSION
} else if chain_spec.is_contracts_rococo() {
&contracts_rococo_runtime::VERSION
} else {
&rococo_parachain_runtime::VERSION
}
@@ -343,11 +342,11 @@ macro_rules! construct_async_run {
let task_manager = $components.task_manager;
{ $( $code )* }.map(|v| (v, task_manager))
})
} else if runner.config().chain_spec.is_canvas_kusama() {
} else if runner.config().chain_spec.is_contracts_rococo() {
runner.async_run(|$config| {
let $components = new_partial::<canvas_kusama_runtime::RuntimeApi, _>(
let $components = new_partial::<contracts_rococo_runtime::RuntimeApi, _>(
&$config,
crate::service::canvas_kusama_build_import_queue,
crate::service::contracts_rococo_build_import_queue,
)?;
let task_manager = $components.task_manager;
{ $( $code )* }.map(|v| (v, task_manager))
@@ -638,8 +637,8 @@ pub fn run() -> Result<()> {
.await
.map(|r| r.0)
.map_err(Into::into)
} else if config.chain_spec.is_canvas_kusama() {
crate::service::start_canvas_kusama_node(
} else if config.chain_spec.is_contracts_rococo() {
crate::service::start_contracts_rococo_node(
config,
polkadot_config,
collator_options,
+2 -2
View File
@@ -70,8 +70,8 @@ where
Ok(module)
}
/// Instantiate all RPCs we want at the canvas-kusama chain.
pub fn create_canvas_kusama<C, P>(
/// Instantiate all RPCs we want at the contracts-rococo chain.
pub fn create_contracts_rococo<C, P>(
deps: FullDeps<C, P>,
) -> Result<RpcExtension, Box<dyn std::error::Error + Send + Sync>>
where
+16 -14
View File
@@ -158,18 +158,18 @@ impl sc_executor::NativeExecutionDispatch for WestmintRuntimeExecutor {
}
}
/// Native Canvas on Kusama executor instance.
pub struct CanvasKusamaRuntimeExecutor;
/// Native Contracts on Rococo executor instance.
pub struct ContractsRococoRuntimeExecutor;
impl sc_executor::NativeExecutionDispatch for CanvasKusamaRuntimeExecutor {
impl sc_executor::NativeExecutionDispatch for ContractsRococoRuntimeExecutor {
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
canvas_kusama_runtime::api::dispatch(method, data)
contracts_rococo_runtime::api::dispatch(method, data)
}
fn native_version() -> sc_executor::NativeVersion {
canvas_kusama_runtime::native_version()
contracts_rococo_runtime::native_version()
}
}
@@ -1334,7 +1334,7 @@ where
}
#[sc_tracing::logging::prefix_logs_with("Parachain")]
async fn start_canvas_kusama_node_impl<RuntimeApi, RB, BIQ, BIC>(
async fn start_contracts_rococo_node_impl<RuntimeApi, RB, BIQ, BIC>(
parachain_config: Configuration,
polkadot_config: Configuration,
collator_options: CollatorOptions,
@@ -1457,7 +1457,7 @@ where
deny_unsafe,
};
crate::rpc::create_canvas_kusama(deps).map_err(Into::into)
crate::rpc::create_contracts_rococo(deps).map_err(Into::into)
})
};
@@ -1545,15 +1545,17 @@ where
}
#[allow(clippy::type_complexity)]
pub fn canvas_kusama_build_import_queue(
client: Arc<TFullClient<Block, canvas_kusama_runtime::RuntimeApi, WasmExecutor<HostFunctions>>>,
pub fn contracts_rococo_build_import_queue(
client: Arc<
TFullClient<Block, contracts_rococo_runtime::RuntimeApi, WasmExecutor<HostFunctions>>,
>,
config: &Configuration,
telemetry: Option<TelemetryHandle>,
task_manager: &TaskManager,
) -> Result<
sc_consensus::DefaultImportQueue<
Block,
TFullClient<Block, canvas_kusama_runtime::RuntimeApi, WasmExecutor<HostFunctions>>,
TFullClient<Block, contracts_rococo_runtime::RuntimeApi, WasmExecutor<HostFunctions>>,
>,
sc_service::Error,
> {
@@ -1590,7 +1592,7 @@ pub fn canvas_kusama_build_import_queue(
}
/// Start a parachain node.
pub async fn start_canvas_kusama_node(
pub async fn start_contracts_rococo_node(
parachain_config: Configuration,
polkadot_config: Configuration,
collator_options: CollatorOptions,
@@ -1598,15 +1600,15 @@ pub async fn start_canvas_kusama_node(
hwbench: Option<sc_sysinfo::HwBench>,
) -> sc_service::error::Result<(
TaskManager,
Arc<TFullClient<Block, canvas_kusama_runtime::RuntimeApi, WasmExecutor<HostFunctions>>>,
Arc<TFullClient<Block, contracts_rococo_runtime::RuntimeApi, WasmExecutor<HostFunctions>>>,
)> {
start_canvas_kusama_node_impl::<canvas_kusama_runtime::RuntimeApi, _, _, _>(
start_contracts_rococo_node_impl::<contracts_rococo_runtime::RuntimeApi, _, _, _>(
parachain_config,
polkadot_config,
collator_options,
id,
|_| Ok(RpcModule::new(())),
canvas_kusama_build_import_queue,
contracts_rococo_build_import_queue,
|client,
prometheus_registry,
telemetry,
+3 -3
View File
@@ -81,7 +81,7 @@ WESTMINT_DIGEST = ENV['WESTMINT_DIGEST'] || 'digests/westmint-srtool-digest.json
STATEMINE_DIGEST = ENV['STATEMINE_DIGEST'] || 'digests/statemine-srtool-digest.json'
STATEMINT_DIGEST = ENV['STATEMINT_DIGEST'] || 'digests/statemint-srtool-digest.json'
ROCOCO_PARA_DIGEST = ENV['ROCOCO_PARA_DIGEST'] || 'digests/rococo-parachain-srtool-digest.json'
CANVAS_KUSAMA_DIGEST = ENV['CANVAS_KUSAMA_DIGEST'] || 'digests/canvas-kusama-srtool-digest.json'
CANVAS_KUSAMA_DIGEST = ENV['CANVAS_KUSAMA_DIGEST'] || 'digests/contracts-rococo-srtool-digest.json'
logger.debug("Release type: #{ENV['RELEASE_TYPE']}")
@@ -111,7 +111,7 @@ else
--slurpfile srtool_statemine %s \
--slurpfile srtool_statemint %s \
--slurpfile srtool_rococo_parachain %s \
--slurpfile srtool_canvas_kusama %s \
--slurpfile srtool_contracts_rococo %s \
-n \'{
cumulus: $cumulus[0],
substrate: $substrate[0],
@@ -122,7 +122,7 @@ else
{ name: "westmint", data: $srtool_westmint[0] },
{ name: "statemint", data: $srtool_statemint[0] },
{ name: "statemine", data: $srtool_statemine[0] },
{ name: "canvas", data: $srtool_canvas_kusama[0] }
{ name: "contracts", data: $srtool_contracts_rococo[0] }
] }\' > context.json', cumulus_data, substrate_data, polkadot_data,
SHELL_DIGEST,
WESTMINT_DIGEST,