7 Commits

Author SHA1 Message Date
rzadp 0c51346d98 comment out for now 2024-08-08 18:35:19 +02:00
rzadp 10de7b33cb dumb 2024-08-08 18:35:15 +02:00
rzadp a62d6d31eb Give me a test for producing blocks 2024-08-08 18:12:40 +02:00
Przemek Rzad 3f74c0485e Update ci.yml 2024-08-08 17:13:10 +02:00
Przemek Rzad 2d91027ab6 Merge branch 'master' into rzadp/ci-package 2024-08-08 15:15:41 +02:00
Przemek Rzad 419eb3efda Update ci.yml 2024-08-08 14:05:41 +02:00
rzadp d31ced7974 Add missing features 2024-08-08 13:59:21 +02:00
30 changed files with 4840 additions and 15276 deletions
@@ -1,16 +0,0 @@
name: Free disk space
description: We've run into out-of-disk error when compiling Rust projects, so we free up some space this way.
runs:
using: "composite"
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # 1.3.1
with:
android: true # This alone is a 12 GB save.
# We disable the rest because it caused some problems. (they're enabled by default)
# The Android removal is enough.
dotnet: false
haskell: false
large-packages: false
swap-storage: false
@@ -1,12 +0,0 @@
name: Install macOS dependencies
description: Installs dependencies required to compile the template on macOS
runs:
using: "composite"
steps:
- run: |
curl https://sh.rustup.rs -sSf -y | sh
brew install protobuf
rustup target add wasm32-unknown-unknown --toolchain stable-aarch64-apple-darwin
rustup component add rust-src --toolchain stable-aarch64-apple-darwin
shell: sh
@@ -1,15 +0,0 @@
name: Install Ubuntu dependencies
description: Installs dependencies required to compile the template in Ubuntu
runs:
using: "composite"
steps:
- name: Rust compilation prerequisites (Ubuntu)
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt update
sudo apt install -y \
protobuf-compiler
rustup target add wasm32-unknown-unknown
rustup component add rustfmt clippy rust-src
shell: bash
+51 -46
View File
@@ -6,13 +6,14 @@ on:
branches:
- main
- master
- rzadp/test-produce-blocks
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
ci:
runs-on: ${{ matrix.os }}
strategy:
matrix:
@@ -20,48 +21,42 @@ jobs:
steps:
- uses: actions/checkout@v4
- if: contains(matrix.os, 'ubuntu')
uses: ./.github/actions/free-disk-space
- if: contains(matrix.os, 'ubuntu')
uses: ./.github/actions/ubuntu-dependencies
- if: contains(matrix.os, 'macos')
uses: ./.github/actions/macos-dependencies
- name: Build the template
run: cargo build
timeout-minutes: 90
- name: Run clippy
- name: Rust compilation prerequisites (Ubuntu)
if: contains(matrix.os, 'ubuntu')
run: |
SKIP_WASM_BUILD=1 cargo clippy --all-targets --locked --workspace --quiet
SKIP_WASM_BUILD=1 cargo clippy --all-targets --all-features --locked --workspace --quiet
timeout-minutes: 30
sudo apt update
sudo apt install -y \
protobuf-compiler
rustup target add wasm32-unknown-unknown
rustup component add rustfmt clippy rust-src
- name: Run the tests
run: SKIP_WASM_BUILD=1 cargo test
timeout-minutes: 15
- name: Install Cargo (MacOS)
if: contains(matrix.os, 'macos')
run: |
curl https://sh.rustup.rs -sSf -y | sh
brew install protobuf
rustup target add wasm32-unknown-unknown --toolchain stable-aarch64-apple-darwin
rustup component add rust-src --toolchain stable-aarch64-apple-darwin
- name: Build the docs
run: SKIP_WASM_BUILD=1 cargo doc --workspace --no-deps
timeout-minutes: 15
run-node:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- if: contains(matrix.os, 'ubuntu')
uses: ./.github/actions/free-disk-space
- if: contains(matrix.os, 'ubuntu')
uses: ./.github/actions/ubuntu-dependencies
- if: contains(matrix.os, 'macos')
uses: ./.github/actions/macos-dependencies
# We've run into out-of-disk error when compiling Polkadot in the next step, so we free up some space this way.
- name: Free Disk Space (Ubuntu)
if: contains(matrix.os, 'ubuntu')
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # 1.3.1
with:
android: true # This alone is a 12 GB save.
# We disable the rest because it caused some problems. (they're enabled by default)
# The Android removal is enough.
dotnet: false
haskell: false
large-packages: false
swap-storage: false
# This is mentioned as example in the README:
- name: Build the node individually in release mode
run: cargo build --package minimal-template-node --release --locked --all-features --all-targets
run: |
# Save some space from debug builds
rm -rf ./target
cargo build --package minimal-template-node --release
timeout-minutes: 90
- name: Make sure the node is producing blocks
@@ -72,13 +67,23 @@ jobs:
shell: bash
timeout-minutes: 5
build-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# build-docker:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
- uses: ./.github/actions/free-disk-space
# # We've run into out-of-disk error when compiling Polkadot in the next step, so we free up some space this way.
# - name: Free Disk Space (Ubuntu)
# uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # 1.3.1
# with:
# android: true # This alone is a 12 GB save.
# # We disable the rest because it caused some problems. (they're enabled by default)
# # The Android removal is enough.
# dotnet: false
# haskell: false
# large-packages: false
# swap-storage: false
- name: Build the Dockerfile
run: docker build . -t polkadot-sdk-minimal-template
timeout-minutes: 90
# - name: Build the Dockerfile
# run: docker build . -t polkadot-sdk-minimal-template
# timeout-minutes: 90
+1 -1
View File
@@ -54,7 +54,7 @@ jobs:
rustup component add rust-src
- name: Build the template
run: cargo build --locked --release --all-features --all-targets
run: cargo build --locked --release
timeout-minutes: 90
- name: Upload the binaries
Generated
+4249 -14512
View File
File diff suppressed because it is too large Load Diff
+43 -56
View File
@@ -1,69 +1,56 @@
[workspace.package]
license = "MIT-0"
authors = ["Pezkuwi <admin@pezkuwichain.io>"]
homepage = "https://github.com/pezkuwichain/"
repository = "https://github.com/pezkuwichain/pezkuwi-sdk-minimal-template.git"
authors = ["Parity Technologies <admin@parity.io>"]
homepage = "https://paritytech.github.io/polkadot-sdk/"
repository = "https://github.com/paritytech/polkadot-sdk-minimal-template.git"
edition = "2021"
[workspace]
default-members = ["pezpallets/template", "runtime"]
members = [
"node",
"pezpallets/template",
"pallets/template",
"runtime",
]
resolver = "2"
[workspace.dependencies]
pez-minimal-template-runtime = { path = "./runtime", default-features = false }
pezpallet-minimal-template = { path = "./pezpallets/template", default-features = false }
clap = { version = "4.5.13" }
docify = { version = "0.2.9" }
futures = { version = "0.3.31" }
minimal-template-runtime = { path = "./runtime", default-features = false }
pallet-minimal-template = { path = "./pallets/template", default-features = false }
clap = { version = "4.5.3" }
docify = { version = "0.2.8" }
frame = { version = "0.6.0", default-features = false, package = "polkadot-sdk-frame" }
futures = { version = "0.3.30" }
futures-timer = { version = "3.0.2" }
jsonrpsee = { version = "0.24.3" }
pezkuwi-sdk = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main", default-features = false }
codec = { version = "3.7.5", default-features = false, package = "parity-scale-codec" }
scale-info = { version = "2.11.6", default-features = false }
serde_json = { version = "1.0.132", default-features = false }
[profile.release]
opt-level = 3
panic = "unwind"
[profile.production]
codegen-units = 1
inherits = "release"
lto = true
[patch.crates-io]
# Map rebranded Pezkuwi packages from the forked Pezkuwi SDK repository
pezkuwi-sdk = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezframe-support = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezframe-system = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezpallet-balances = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezpallet-sudo = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezpallet-timestamp = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezpallet-transaction-payment = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezpallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsp-api = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsp-keyring = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsp-weights = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsp-io = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsp-runtime = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsp-genesis-builder = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsp-timestamp = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsp-block-builder = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsp-blockchain = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-cli = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-service = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-client-api = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-executor = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-telemetry = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-transaction-pool-api = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-transaction-pool = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-consensus = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-consensus-manual-seal = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-network = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-offchain = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-basic-authorship = { git = "https://github.com/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
jsonrpsee = { version = "0.23.2" }
sc-basic-authorship = { version = "0.44.0", default-features = false }
sc-cli = { version = "0.46.0", default-features = false }
sc-client-api = { version = "37.0.0", default-features = false }
sc-consensus = { version = "0.43.0", default-features = false }
sc-consensus-manual-seal = { version = "0.45.0", default-features = false }
sc-executor = { version = "0.40.0", default-features = false }
sc-network = { version = "0.44.0", default-features = false }
sc-offchain = { version = "39.0.0", default-features = false }
sc-rpc-api = { version = "0.43.0", default-features = false }
sc-service = { version = "0.45.0", default-features = false }
sc-telemetry = { version = "24.0.0", default-features = false }
sc-transaction-pool = { version = "37.0.0", default-features = false }
sc-transaction-pool-api = { version = "37.0.0", default-features = false }
serde_json = { version = "1.0.114", default-features = false }
sp-api = { version = "34.0.0", default-features = false }
sp-block-builder = { version = "34.0.0", default-features = false }
sp-blockchain = { version = "37.0.0", default-features = false }
sp-io = { version = "38.0.0", default-features = false }
sp-keyring = { version = "39.0.0", default-features = false }
sp-runtime = { version = "39.0.0", default-features = false }
sp-timestamp = { version = "34.0.0", default-features = false }
substrate-frame-rpc-system = { version = "38.0.0", default-features = false }
substrate-build-script-utils = { version = "11.0.0", default-features = false }
codec = { version = "3.6.12", default-features = false, package = "parity-scale-codec" }
pallet-balances = { version = "38.0.0", default-features = false }
pallet-sudo = { version = "37.0.0", default-features = false }
pallet-timestamp = { version = "36.0.0", default-features = false }
pallet-transaction-payment = { version = "37.0.0", default-features = false }
pallet-transaction-payment-rpc-runtime-api = { version = "37.0.0", default-features = false }
scale-info = { version = "2.11.1", default-features = false }
sp-genesis-builder = { version = "0.15.0", default-features = false }
substrate-wasm-builder = { version = "24.0.0", default-features = false }
+1 -1
View File
@@ -4,7 +4,7 @@ WORKDIR /polkadot
COPY . /polkadot
RUN cargo fetch
RUN cargo build --workspace --locked --release
RUN cargo build --locked --release
FROM docker.io/parity/base-bin:latest
+33 -156
View File
@@ -11,214 +11,91 @@
</div>
## Table of Contents
- [Intro](#intro)
- [Template Structure](#template-structure)
- [Getting Started](#getting-started)
- [Starting a Minimal Template Chain](#starting-a-minimal-template-chain)
- [Omni Node](#omni-node)
- [Minimal Template Node](#minimal-template-node)
- [Zombienet with Omni Node](#zombienet-with-omni-node)
- [Zombienet with Minimal Template Node](#zombienet-with-minimal-template-node)
- [Connect with the Polkadot-JS Apps Front-End](#connect-with-the-polkadot-js-apps-front-end)
- [Takeaways](#takeaways)
- [Contributing](#contributing)
- [Getting Help](#getting-help)
## Intro
- 🤏 This template is a minimal (in terms of complexity and the number of components)
* 🤏 This template is a minimal (in terms of complexity and the number of components)
template for building a blockchain node.
- 🔧 Its runtime is configured with a single custom pallet as a starting point, and a handful of ready-made pallets
* 🔧 Its runtime is configured with a single custom pallet as a starting point, and a handful of ready-made pallets
such as a [Balances pallet](https://paritytech.github.io/polkadot-sdk/master/pallet_balances/index.html).
- 👤 The template has no consensus configured - it is best for experimenting with a single node network.
* 👤 The template has no consensus configured - it is best for experimenting with a single node network.
## Template Structure
A Polkadot SDK based project such as this one consists of:
- 🧮 the [Runtime](./runtime/README.md) - the core logic of the blockchain.
- 🎨 the [Pallets](./pallets/README.md) - from which the runtime is constructed.
- 💿 a [Node](./node/README.md) - the binary application (which is not part of the cargo default-members list and is not
compiled unless building the entire workspace).
* 💿 a [Node](./node/README.md) - the binary application.
* 🧮 the [Runtime](./runtime/README.md) - the core logic of the blockchain.
* 🎨 the [Pallets](./pallets/README.md) - from which the runtime is constructed.
## Getting Started
- 🦀 The template is using the Rust language.
* 🦀 The template is using the Rust language.
- 👉 Check the
* 👉 Check the
[Rust installation instructions](https://www.rust-lang.org/tools/install) for your system.
- 🛠️ Depending on your operating system and Rust version, there might be additional
* 🛠️ Depending on your operating system and Rust version, there might be additional
packages required to compile this template - please take note of the Rust compiler output.
Fetch minimal template code.
### Build
🔨 Use the following command to build the node without launching it:
```sh
git clone https://github.com/paritytech/polkadot-sdk-minimal-template.git minimal-template
cd minimal-template
cargo build --package minimal-template-node --release
```
## Starting a Minimal Template Chain
### Omni Node
[Omni Node](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/reference_docs/omni_node/index.html) can
be used to run the minimal template's runtime. `polkadot-omni-node` binary crate usage is described at a high-level
[on crates.io](https://crates.io/crates/polkadot-omni-node).
#### Install `polkadot-omni-node`
Please see installation section on [crates.io/omni-node](https://crates.io/crates/polkadot-omni-node).
#### Build `minimal-template-runtime`
```sh
cargo build -p minimal-template-runtime --release
```
#### Install `staging-chain-spec-builder`
Please see the installation section at [`crates.io/staging-chain-spec-builder`](https://crates.io/crates/staging-chain-spec-builder).
#### Use chain-spec-builder to generate the chain_spec.json file
```sh
chain-spec-builder create --relay-chain "dev" --para-id 1000 --runtime \
target/release/wbuild/minimal-template-runtime/minimal_template_runtime.wasm named-preset development
```
**Note**: the `relay-chain` and `para-id` flags are extra bits of information required to
configure the node for the case of representing a parachain that is connected to a relay chain.
They are not relevant to minimal template business logic, but they are mandatory information for
Omni Node, nonetheless.
#### Run Omni Node
Start Omni Node in development mode (sets up block production and finalization based on manual seal,
sealing a new block every 3 seconds), with a minimal template runtime chain spec.
```sh
polkadot-omni-node --chain <path/to/chain_spec.json> --dev
```
### Minimal Template Node
#### Build both node & runtime
```sh
cargo build --workspace --release
```
🐳 Alternatively, build the docker image which builds all the workspace members,
and has as entry point the node binary:
🐳 Alternatively, build the docker image:
```sh
docker build . -t polkadot-sdk-minimal-template
```
#### Start the `minimal-template-node`
### Single-Node Development Chain
The `minimal-template-node` has dependency on the `minimal-template-runtime`. It will use
the `minimal_template_runtime::WASM_BINARY` constant (which holds the WASM blob as a byte
array) for chain spec building, while starting. This is in contrast to Omni Node which doesn't
depend on a specific runtime, but asks for the chain spec at startup.
👤 The following command starts a single-node development chain:
```sh
<target/release/path/to/minimal-template-node> --tmp --consensus manual-seal-3000
# or via docker
docker run --rm polkadot-sdk-minimal-template
./target/release/minimal-template-node --dev
# docker version:
docker run --rm polkadot-sdk-minimal-template --dev
```
### Zombienet with Omni Node
Development chains:
#### Install `zombienet`
We can install `zombienet` as described [here](https://paritytech.github.io/zombienet/install.html#installation),
and `zombienet-omni-node.toml` contains the network specification we want to start.
#### Update `zombienet-omni-node.toml` with a valid chain spec path
To simplify the process of starting the minimal template with ZombieNet and Omni Node, we've included a
pre-configured development chain spec (dev_chain_spec.json) in the minimal template. The zombienet-omni-node.toml
file in this template points to it, but you can update it to a new path for the chain spec generated on your machine.
To generate a chain spec refer to [staging-chain-spec-builder](https://crates.io/crates/staging-chain-spec-builder)
Then make the changes in the network specification like so:
```toml
# ...
chain = "dev"
chain_spec_path = "<TO BE UPDATED WITH A VALID PATH>"
default_args = ["--dev"]
# ..
```
#### Start the network
```sh
zombienet --provider native spawn zombienet-omni-node.toml
```
### Zombienet with `minimal-template-node`
For this one we just need to have `zombienet` installed and run:
```sh
zombienet --provider native spawn zombienet-multi-node.toml
```
* 🧹 Do not persist the state.
* 💰 Are pre-configured with a genesis state that includes several pre-funded development accounts.
* 🧑‍⚖️ One development account (`ALICE`) is used as `sudo` accounts.
### Connect with the Polkadot-JS Apps Front-End
- 🌐 You can interact with your local node using the
* 🌐 You can interact with your local node using the
hosted version of the [Polkadot/Substrate
Portal](https://polkadot.js.org/apps/#/explorer?rpc=ws://localhost:9944).
- 🪐 A hosted version is also
* 🪐 A hosted version is also
available on [IPFS](https://dotapps.io/).
- 🧑‍🔧 You can also find the source code and instructions for hosting your own instance in the
* 🧑‍🔧 You can also find the source code and instructions for hosting your own instance in the
[`polkadot-js/apps`](https://github.com/polkadot-js/apps) repository.
### Takeaways
Previously minimal template's development chains:
- ❌ Started in a multi-node setup will produce forks because minimal lacks consensus.
- 🧹 Do not persist the state.
- 💰 Are pre-configured with a genesis state that includes several pre-funded development accounts.
- 🧑‍⚖️ One development account (`ALICE`) is used as `sudo` accounts.
## Contributing
- 🔄 This template is automatically updated after releases in the main [Polkadot SDK monorepo](https://github.com/paritytech/polkadot-sdk).
* 🔄 This template is automatically updated after releases in the main [Polkadot SDK monorepo](https://github.com/paritytech/polkadot-sdk).
- ➡️ Any pull requests should be directed to this [source](https://github.com/paritytech/polkadot-sdk/tree/master/templates/minimal).
* ➡️ Any pull requests should be directed to this [source](https://github.com/paritytech/polkadot-sdk/tree/master/templates/minimal).
- 😇 Please refer to the monorepo's
* 😇 Please refer to the monorepo's
[contribution guidelines](https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/CONTRIBUTING.md) and
[Code of Conduct](https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/CODE_OF_CONDUCT.md).
## Getting Help
- 🧑‍🏫 To learn about Polkadot in general, [docs.Polkadot.com](https://docs.polkadot.com/) website is a good starting point.
* 🧑‍🏫 To learn about Polkadot in general, [Polkadot.network](https://polkadot.network/) website is a good starting point.
- 🧑‍🔧 For technical introduction, [here](https://github.com/paritytech/polkadot-sdk#-documentation) are
* 🧑‍🔧 For technical introduction, [here](https://github.com/paritytech/polkadot-sdk#-documentation) are
the Polkadot SDK documentation resources.
- 👥 Additionally, there are [GitHub issues](https://github.com/paritytech/polkadot-sdk/issues) and
* 👥 Additionally, there are [GitHub issues](https://github.com/paritytech/polkadot-sdk/issues) and
[Substrate StackExchange](https://substrate.stackexchange.com/).
- 👥You can also reach out on the [Official Polkdot discord server](https://polkadot-discord.w3f.tools/)
- 🧑Reach out on [Telegram](https://t.me/substratedevs) for more questions and discussions
File diff suppressed because one or more lines are too long
+51 -8
View File
@@ -1,6 +1,6 @@
[package]
name = "pez-minimal-template-node"
description = "A minimal Bizinikiwi-based node, ready for hacking."
name = "minimal-template-node"
description = "A minimal Substrate-based Substrate node, ready for hacking. (polkadot v1.15.0)"
version = "0.1.0"
license = "Unlicense"
authors.workspace = true
@@ -14,20 +14,63 @@ build = "build.rs"
targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
clap = { features = ["derive"], workspace = true }
docify = { workspace = true }
clap = { features = ["derive"], workspace = true }
futures = { features = ["thread-pool"], workspace = true }
futures-timer = { workspace = true }
jsonrpsee = { features = ["server"], workspace = true }
pez-minimal-template-runtime.workspace = true
pezkuwi-sdk = { workspace = true, features = ["experimental", "node"] }
serde_json = { workspace = true, default-features = true }
sc-cli.workspace = true
sc-cli.default-features = true
sc-executor.workspace = true
sc-executor.default-features = true
sc-network.workspace = true
sc-network.default-features = true
sc-service.workspace = true
sc-service.default-features = true
sc-telemetry.workspace = true
sc-telemetry.default-features = true
sc-transaction-pool.workspace = true
sc-transaction-pool.default-features = true
sc-transaction-pool-api.workspace = true
sc-transaction-pool-api.default-features = true
sc-consensus.workspace = true
sc-consensus.default-features = true
sc-consensus-manual-seal.workspace = true
sc-consensus-manual-seal.default-features = true
sc-rpc-api.workspace = true
sc-rpc-api.default-features = true
sc-basic-authorship.workspace = true
sc-basic-authorship.default-features = true
sc-offchain.workspace = true
sc-offchain.default-features = true
sc-client-api.workspace = true
sc-client-api.default-features = true
sp-timestamp.workspace = true
sp-timestamp.default-features = true
sp-keyring.workspace = true
sp-keyring.default-features = true
sp-api.workspace = true
sp-api.default-features = true
sp-blockchain.workspace = true
sp-blockchain.default-features = true
sp-block-builder.workspace = true
sp-block-builder.default-features = true
sp-io.workspace = true
sp-io.default-features = true
sp-runtime.workspace = true
sp-runtime.default-features = true
substrate-frame-rpc-system.workspace = true
substrate-frame-rpc-system.default-features = true
frame = { features = ["experimental", "runtime"], workspace = true, default-features = true }
minimal-template-runtime.workspace = true
[build-dependencies]
pezkuwi-sdk = { workspace = true, features = ["bizinikiwi-build-script-utils"] }
substrate-build-script-utils.workspace = true
substrate-build-script-utils.default-features = true
[features]
default = ["std"]
std = [
"pez-minimal-template-runtime/std",
"pezkuwi-sdk/std",
"minimal-template-runtime/std",
]
+3 -3
View File
@@ -1,6 +1,6 @@
// This file is part of Bizinikiwi.
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd. and Kurdistan Blockchain Technologies Institute
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,7 +15,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use pezkuwi_sdk::bizinikiwi_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};
use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};
fn main() {
generate_cargo_keys();
+25 -12
View File
@@ -1,6 +1,6 @@
// This file is part of pezkuwi-sdk.
// This file is part of Substrate.
// Copyright (C) Pezkuwi Foundation. and Kurdistan Blockchain Technologies Institute (KBTI) 2024.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,28 +15,41 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use pez_minimal_template_runtime::WASM_BINARY;
use pezkuwi_sdk::{
pezsc_service::{ChainType, Properties},
*,
};
use minimal_template_runtime::{BalancesConfig, SudoConfig, WASM_BINARY};
use sc_service::{ChainType, Properties};
use serde_json::{json, Value};
use sp_keyring::AccountKeyring;
/// This is a specialization of the general bizinikiwi ChainSpec type.
pub type ChainSpec = pezsc_service::GenericChainSpec;
/// This is a specialization of the general Substrate ChainSpec type.
pub type ChainSpec = sc_service::GenericChainSpec;
fn props() -> Properties {
let mut properties = Properties::new();
properties.insert("tokenDecimals".to_string(), 0.into());
properties.insert("tokenSymbol".to_string(), "PEZ".into());
properties.insert("tokenSymbol".to_string(), "MINI".into());
properties
}
pub fn development_chain_spec() -> Result<ChainSpec, String> {
pub fn development_config() -> Result<ChainSpec, String> {
Ok(ChainSpec::builder(WASM_BINARY.expect("Development wasm not available"), Default::default())
.with_name("Development")
.with_id("dev")
.with_chain_type(ChainType::Development)
.with_genesis_config_preset_name(pezsp_genesis_builder::DEV_RUNTIME_PRESET)
.with_genesis_config_patch(testnet_genesis())
.with_properties(props())
.build())
}
/// Configure initial storage state for FRAME pallets.
fn testnet_genesis() -> Value {
use frame::traits::Get;
use minimal_template_runtime::interface::{Balance, MinimumBalance};
let endowment = <MinimumBalance as Get<Balance>>::get().max(1) * 1000;
let balances = AccountKeyring::iter()
.map(|a| (a.to_account_id(), endowment))
.collect::<Vec<_>>();
json!({
"balances": BalancesConfig { balances },
"sudo": SudoConfig { key: Some(AccountKeyring::Alice.to_account_id()) },
})
}
+13 -15
View File
@@ -1,7 +1,8 @@
// This file is part of pezkuwi-sdk.
// This file is part of Substrate.
// Copyright (C) Pezkuwi Foundation. and Kurdistan Blockchain Technologies Institute (KBTI) 2024.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
@@ -14,13 +15,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use pezkuwi_sdk::{pezsc_cli::RunCmd, *};
use sc_cli::RunCmd;
#[derive(Debug, Clone)]
pub enum Consensus {
ManualSeal(u64),
InstantSeal,
None,
}
impl std::str::FromStr for Consensus {
@@ -31,8 +31,6 @@ impl std::str::FromStr for Consensus {
Consensus::InstantSeal
} else if let Some(block_time) = s.strip_prefix("manual-seal-") {
Consensus::ManualSeal(block_time.parse().map_err(|_| "invalid block time")?)
} else if s.to_lowercase() == "none" {
Consensus::None
} else {
return Err("incorrect consensus identifier".into());
})
@@ -55,29 +53,29 @@ pub struct Cli {
pub enum Subcommand {
/// Key management cli utilities
#[command(subcommand)]
Key(pezsc_cli::KeySubcommand),
Key(sc_cli::KeySubcommand),
/// Build a chain specification.
BuildSpec(pezsc_cli::BuildSpecCmd),
BuildSpec(sc_cli::BuildSpecCmd),
/// Validate blocks.
CheckBlock(pezsc_cli::CheckBlockCmd),
CheckBlock(sc_cli::CheckBlockCmd),
/// Export blocks.
ExportBlocks(pezsc_cli::ExportBlocksCmd),
ExportBlocks(sc_cli::ExportBlocksCmd),
/// Export the state of a given block into a chain spec.
ExportState(pezsc_cli::ExportStateCmd),
ExportState(sc_cli::ExportStateCmd),
/// Import blocks.
ImportBlocks(pezsc_cli::ImportBlocksCmd),
ImportBlocks(sc_cli::ImportBlocksCmd),
/// Remove the whole chain.
PurgeChain(pezsc_cli::PurgeChainCmd),
PurgeChain(sc_cli::PurgeChainCmd),
/// Revert the chain to a previous state.
Revert(pezsc_cli::RevertCmd),
Revert(sc_cli::RevertCmd),
/// Db meta columns information.
ChainInfo(pezsc_cli::ChainInfoCmd),
ChainInfo(sc_cli::ChainInfoCmd),
}
+21 -17
View File
@@ -1,6 +1,6 @@
// This file is part of pezkuwi-sdk.
// This file is part of Substrate.
// Copyright (C) Pezkuwi Foundation. and Kurdistan Blockchain Technologies Institute (KBTI) 2024.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,15 +20,19 @@ use crate::{
cli::{Cli, Subcommand},
service,
};
use pezkuwi_sdk::{pezsc_cli::BizinikiwiCli, pezsc_service::PartialComponents, *};
use sc_cli::SubstrateCli;
use sc_service::PartialComponents;
impl BizinikiwiCli for Cli {
#[cfg(feature = "try-runtime")]
use try_runtime_cli::block_building_info::timestamp_with_aura_info;
impl SubstrateCli for Cli {
fn impl_name() -> String {
"Bizinikiwi Node".into()
"Substrate Node".into()
}
fn impl_version() -> String {
env!("BIZINIKIWI_CLI_IMPL_VERSION").into()
env!("SUBSTRATE_CLI_IMPL_VERSION").into()
}
fn description() -> String {
@@ -47,9 +51,9 @@ impl BizinikiwiCli for Cli {
2017
}
fn load_spec(&self, id: &str) -> Result<Box<dyn pezsc_service::ChainSpec>, String> {
fn load_spec(&self, id: &str) -> Result<Box<dyn sc_service::ChainSpec>, String> {
Ok(match id {
"dev" => Box::new(chain_spec::development_chain_spec()?),
"dev" => Box::new(chain_spec::development_config()?),
path =>
Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?),
})
@@ -57,7 +61,7 @@ impl BizinikiwiCli for Cli {
}
/// Parse and run command line arguments
pub fn run() -> pezsc_cli::Result<()> {
pub fn run() -> sc_cli::Result<()> {
let cli = Cli::from_args();
match &cli.subcommand {
@@ -111,20 +115,20 @@ pub fn run() -> pezsc_cli::Result<()> {
Some(Subcommand::ChainInfo(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|config| {
cmd.run::<pez_minimal_template_runtime::interface::OpaqueBlock>(&config)
cmd.run::<minimal_template_runtime::interface::OpaqueBlock>(&config)
})
},
None => {
let runner = cli.create_runner(&cli.run)?;
runner.run_node_until_exit(|config| async move {
match config.network.network_backend.unwrap_or_default() {
pezsc_network::config::NetworkBackendType::Libp2p =>
service::new_full::<pezsc_network::NetworkWorker<_, _>>(config, cli.consensus)
.map_err(pezsc_cli::Error::Service),
pezsc_network::config::NetworkBackendType::Litep2p => service::new_full::<
pezsc_network::Litep2pNetworkBackend,
match config.network.network_backend {
sc_network::config::NetworkBackendType::Libp2p =>
service::new_full::<sc_network::NetworkWorker<_, _>>(config, cli.consensus)
.map_err(sc_cli::Error::Service),
sc_network::config::NetworkBackendType::Litep2p => service::new_full::<
sc_network::Litep2pNetworkBackend,
>(config, cli.consensus)
.map_err(pezsc_cli::Error::Service),
.map_err(sc_cli::Error::Service),
}
})
},
+2 -2
View File
@@ -1,6 +1,6 @@
// This file is part of Pezkuwi Sdk.
// This file is part of Polkadot Sdk.
// Copyright (C) Pezkuwi Foundation. and Kurdistan Blockchain Technologies Institute (KBTI) 2024.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
+4 -4
View File
@@ -1,6 +1,6 @@
// This file is part of pezkuwi-sdk.
// This file is part of Substrate.
// Copyright (C) Pezkuwi Foundation. and Kurdistan Blockchain Technologies Institute (KBTI) 2024.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,7 +15,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! Bizinikiwi Node Template CLI library.
//! Substrate Node Template CLI library.
#![warn(missing_docs)]
mod chain_spec;
@@ -24,6 +24,6 @@ mod command;
mod rpc;
mod service;
fn main() -> pezkuwi_sdk::pezsc_cli::Result<()> {
fn main() -> sc_cli::Result<()> {
command::run()
}
+17 -16
View File
@@ -1,6 +1,6 @@
// This file is part of pezkuwi-sdk.
// This file is part of Substrate.
// Copyright (C) Pezkuwi Foundation. and Kurdistan Blockchain Technologies Institute (KBTI) 2024.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,27 +16,28 @@
// limitations under the License.
//! A collection of node-specific RPC methods.
//! bizinikiwi provides the `pezsc-rpc` crate, which defines the core RPC layer
//! used by bizinikiwi nodes. This file extends those RPC definitions with
//! Substrate provides the `sc-rpc` crate, which defines the core RPC layer
//! used by Substrate nodes. This file extends those RPC definitions with
//! capabilities that are specific to this project's runtime configuration.
#![warn(missing_docs)]
use jsonrpsee::RpcModule;
use pez_minimal_template_runtime::interface::{AccountId, Nonce, OpaqueBlock};
use pezkuwi_sdk::{
pezsc_transaction_pool_api::TransactionPool,
pezsp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata},
*,
};
use minimal_template_runtime::interface::{AccountId, Nonce, OpaqueBlock};
use sc_transaction_pool_api::TransactionPool;
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
use std::sync::Arc;
pub use sc_rpc_api::DenyUnsafe;
/// Full client dependencies.
pub struct FullDeps<C, P> {
/// The client instance to use.
pub client: Arc<C>,
/// Transaction pool instance.
pub pool: Arc<P>,
/// Whether to deny unsafe calls
pub deny_unsafe: DenyUnsafe,
}
#[docify::export]
@@ -48,19 +49,19 @@ where
C: Send
+ Sync
+ 'static
+ pezsp_api::ProvideRuntimeApi<OpaqueBlock>
+ sp_api::ProvideRuntimeApi<OpaqueBlock>
+ HeaderBackend<OpaqueBlock>
+ HeaderMetadata<OpaqueBlock, Error = BlockChainError>
+ 'static,
C::Api: pezsp_block_builder::BlockBuilder<OpaqueBlock>,
C::Api: pezframe_rpc_system::AccountNonceApi<OpaqueBlock, AccountId, Nonce>,
C::Api: sp_block_builder::BlockBuilder<OpaqueBlock>,
C::Api: substrate_frame_rpc_system::AccountNonceApi<OpaqueBlock, AccountId, Nonce>,
P: TransactionPool + 'static,
{
use pezkuwi_sdk::pezframe_rpc_system::{System, SystemApiServer};
use substrate_frame_rpc_system::{System, SystemApiServer};
let mut module = RpcModule::new(());
let FullDeps { client, pool } = deps;
let FullDeps { client, pool, deny_unsafe } = deps;
module.merge(System::new(client.clone(), pool.clone()).into_rpc())?;
module.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?;
Ok(module)
}
+63 -65
View File
@@ -1,6 +1,6 @@
// This file is part of pezkuwi-sdk.
// This file is part of Substrate.
// Copyright (C) Pezkuwi Foundation. and Kurdistan Blockchain Technologies Institute (KBTI) 2024.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,36 +15,39 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::cli::Consensus;
use futures::FutureExt;
use pez_minimal_template_runtime::{interface::OpaqueBlock as Block, RuntimeApi};
use pezkuwi_sdk::{
pezsc_client_api::backend::Backend,
pezsc_executor::WasmExecutor,
pezsc_service::{error::Error as ServiceError, Configuration, TaskManager},
pezsc_telemetry::{Telemetry, TelemetryWorker},
pezsc_transaction_pool_api::OffchainTransactionPoolFactory,
pezsp_runtime::traits::Block as BlockT,
*,
};
use minimal_template_runtime::{interface::OpaqueBlock as Block, RuntimeApi};
use sc_client_api::backend::Backend;
use sc_executor::WasmExecutor;
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
use sc_telemetry::{Telemetry, TelemetryWorker};
use sc_transaction_pool_api::OffchainTransactionPoolFactory;
use sp_runtime::traits::Block as BlockT;
use std::sync::Arc;
type HostFunctions = pezsp_io::BizinikiwiHostFunctions;
use crate::cli::Consensus;
#[cfg(feature = "runtime-benchmarks")]
type HostFunctions =
(sp_io::SubstrateHostFunctions, frame_benchmarking::benchmarking::HostFunctions);
#[cfg(not(feature = "runtime-benchmarks"))]
type HostFunctions = sp_io::SubstrateHostFunctions;
#[docify::export]
pub(crate) type FullClient =
pezsc_service::TFullClient<Block, RuntimeApi, WasmExecutor<HostFunctions>>;
sc_service::TFullClient<Block, RuntimeApi, WasmExecutor<HostFunctions>>;
type FullBackend = pezsc_service::TFullBackend<Block>;
type FullSelectChain = pezsc_consensus::LongestChain<FullBackend, Block>;
type FullBackend = sc_service::TFullBackend<Block>;
type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>;
/// Assembly of PartialComponents (enough to run chain ops subcommands)
pub type Service = pezsc_service::PartialComponents<
pub type Service = sc_service::PartialComponents<
FullClient,
FullBackend,
FullSelectChain,
pezsc_consensus::DefaultImportQueue<Block>,
pezsc_transaction_pool::TransactionPoolHandle<Block, FullClient>,
sc_consensus::DefaultImportQueue<Block>,
sc_transaction_pool::FullPool<Block, FullClient>,
Option<Telemetry>,
>;
@@ -53,17 +56,17 @@ pub fn new_partial(config: &Configuration) -> Result<Service, ServiceError> {
.telemetry_endpoints
.clone()
.filter(|x| !x.is_empty())
.map(|endpoints| -> Result<_, pezsc_telemetry::Error> {
.map(|endpoints| -> Result<_, sc_telemetry::Error> {
let worker = TelemetryWorker::new(16)?;
let telemetry = worker.handle().new_telemetry(endpoints);
Ok((worker, telemetry))
})
.transpose()?;
let executor = pezsc_service::new_wasm_executor(&config.executor);
let executor = sc_service::new_wasm_executor(config);
let (client, backend, keystore_container, task_manager) =
pezsc_service::new_full_parts::<Block, RuntimeApi, _>(
sc_service::new_full_parts::<Block, RuntimeApi, _>(
config,
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
executor,
@@ -75,26 +78,23 @@ pub fn new_partial(config: &Configuration) -> Result<Service, ServiceError> {
telemetry
});
let select_chain = pezsc_consensus::LongestChain::new(backend.clone());
let select_chain = sc_consensus::LongestChain::new(backend.clone());
let transaction_pool = Arc::from(
pezsc_transaction_pool::Builder::new(
task_manager.spawn_essential_handle(),
client.clone(),
config.role.is_authority().into(),
)
.with_options(config.transaction_pool.clone())
.with_prometheus(config.prometheus_registry())
.build(),
let transaction_pool = sc_transaction_pool::BasicPool::new_full(
config.transaction_pool.clone(),
config.role.is_authority().into(),
config.prometheus_registry(),
task_manager.spawn_essential_handle(),
client.clone(),
);
let import_queue = pezsc_consensus_manual_seal::import_queue(
let import_queue = sc_consensus_manual_seal::import_queue(
Box::new(client.clone()),
&task_manager.spawn_essential_handle(),
config.prometheus_registry(),
);
Ok(pezsc_service::PartialComponents {
Ok(sc_service::PartialComponents {
client,
backend,
task_manager,
@@ -107,11 +107,11 @@ pub fn new_partial(config: &Configuration) -> Result<Service, ServiceError> {
}
/// Builds a new service for a full client.
pub fn new_full<Network: pezsc_network::NetworkBackend<Block, <Block as BlockT>::Hash>>(
pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Hash>>(
config: Configuration,
consensus: Consensus,
) -> Result<TaskManager, ServiceError> {
let pezsc_service::PartialComponents {
let sc_service::PartialComponents {
client,
backend,
mut task_manager,
@@ -122,35 +122,34 @@ pub fn new_full<Network: pezsc_network::NetworkBackend<Block, <Block as BlockT>:
other: mut telemetry,
} = new_partial(&config)?;
let net_config = pezsc_network::config::FullNetworkConfiguration::<
let net_config = sc_network::config::FullNetworkConfiguration::<
Block,
<Block as BlockT>::Hash,
Network,
>::new(
&config.network,
config.prometheus_config.as_ref().map(|cfg| cfg.registry.clone()),
);
>::new(&config.network);
let metrics = Network::register_notification_metrics(
config.prometheus_config.as_ref().map(|cfg| &cfg.registry),
);
let (network, system_rpc_tx, tx_handler_controller, sync_service) =
pezsc_service::build_network(pezsc_service::BuildNetworkParams {
let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) =
sc_service::build_network(sc_service::BuildNetworkParams {
config: &config,
net_config,
client: client.clone(),
transaction_pool: transaction_pool.clone(),
spawn_handle: task_manager.spawn_handle(),
import_queue,
net_config,
block_announce_validator_builder: None,
warp_sync_config: None,
warp_sync_params: None,
block_relay: None,
metrics,
})?;
if config.offchain_worker.enabled {
let offchain_workers =
pezsc_offchain::OffchainWorkers::new(pezsc_offchain::OffchainWorkerOptions {
task_manager.spawn_handle().spawn(
"offchain-workers-runner",
"offchain-worker",
sc_offchain::OffchainWorkers::new(sc_offchain::OffchainWorkerOptions {
runtime_api_provider: client.clone(),
is_validator: config.role.is_authority(),
keystore: Some(keystore_container.keystore()),
@@ -161,11 +160,9 @@ pub fn new_full<Network: pezsc_network::NetworkBackend<Block, <Block as BlockT>:
network_provider: Arc::new(network.clone()),
enable_http_requests: true,
custom_extensions: |_| vec![],
})?;
task_manager.spawn_handle().spawn(
"offchain-workers-runner",
"offchain-worker",
offchain_workers.run(client.clone(), task_manager.spawn_handle()).boxed(),
})
.run(client.clone(), task_manager.spawn_handle())
.boxed(),
);
}
@@ -173,15 +170,16 @@ pub fn new_full<Network: pezsc_network::NetworkBackend<Block, <Block as BlockT>:
let client = client.clone();
let pool = transaction_pool.clone();
Box::new(move |_| {
let deps = crate::rpc::FullDeps { client: client.clone(), pool: pool.clone() };
Box::new(move |deny_unsafe, _| {
let deps =
crate::rpc::FullDeps { client: client.clone(), pool: pool.clone(), deny_unsafe };
crate::rpc::create_full(deps).map_err(Into::into)
})
};
let prometheus_registry = config.prometheus_registry().cloned();
let _rpc_handlers = pezsc_service::spawn_tasks(pezsc_service::SpawnTasksParams {
let _rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams {
network,
client: client.clone(),
keystore: keystore_container.keystore(),
@@ -196,7 +194,7 @@ pub fn new_full<Network: pezsc_network::NetworkBackend<Block, <Block as BlockT>:
telemetry: telemetry.as_mut(),
})?;
let proposer = pezsc_basic_authorship::ProposerFactory::new(
let proposer = sc_basic_authorship::ProposerFactory::new(
task_manager.spawn_handle(),
client.clone(),
transaction_pool.clone(),
@@ -206,7 +204,7 @@ pub fn new_full<Network: pezsc_network::NetworkBackend<Block, <Block as BlockT>:
match consensus {
Consensus::InstantSeal => {
let params = pezsc_consensus_manual_seal::InstantSealParams {
let params = sc_consensus_manual_seal::InstantSealParams {
block_import: client.clone(),
env: proposer,
client,
@@ -214,11 +212,11 @@ pub fn new_full<Network: pezsc_network::NetworkBackend<Block, <Block as BlockT>:
select_chain,
consensus_data_provider: None,
create_inherent_data_providers: move |_, ()| async move {
Ok(pezsp_timestamp::InherentDataProvider::from_system_time())
Ok(sp_timestamp::InherentDataProvider::from_system_time())
},
};
let authorship_future = pezsc_consensus_manual_seal::run_instant_seal(params);
let authorship_future = sc_consensus_manual_seal::run_instant_seal(params);
task_manager.spawn_essential_handle().spawn_blocking(
"instant-seal",
@@ -231,7 +229,7 @@ pub fn new_full<Network: pezsc_network::NetworkBackend<Block, <Block as BlockT>:
task_manager.spawn_handle().spawn("block_authoring", None, async move {
loop {
futures_timer::Delay::new(std::time::Duration::from_millis(block_time)).await;
sink.try_send(pezsc_consensus_manual_seal::EngineCommand::SealNewBlock {
sink.try_send(sc_consensus_manual_seal::EngineCommand::SealNewBlock {
create_empty: true,
finalize: true,
parent_hash: None,
@@ -241,7 +239,7 @@ pub fn new_full<Network: pezsc_network::NetworkBackend<Block, <Block as BlockT>:
}
});
let params = pezsc_consensus_manual_seal::ManualSealParams {
let params = sc_consensus_manual_seal::ManualSealParams {
block_import: client.clone(),
env: proposer,
client,
@@ -250,10 +248,10 @@ pub fn new_full<Network: pezsc_network::NetworkBackend<Block, <Block as BlockT>:
commands_stream: Box::pin(commands_stream),
consensus_data_provider: None,
create_inherent_data_providers: move |_, ()| async move {
Ok(pezsp_timestamp::InherentDataProvider::from_system_time())
Ok(sp_timestamp::InherentDataProvider::from_system_time())
},
};
let authorship_future = pezsc_consensus_manual_seal::run_manual_seal(params);
let authorship_future = sc_consensus_manual_seal::run_manual_seal(params);
task_manager.spawn_essential_handle().spawn_blocking(
"manual-seal",
@@ -261,8 +259,8 @@ pub fn new_full<Network: pezsc_network::NetworkBackend<Block, <Block as BlockT>:
authorship_future,
);
},
_ => {},
}
network_starter.start_network();
Ok(task_manager)
}
+27
View File
@@ -0,0 +1,27 @@
[package]
name = "pallet-minimal-template"
description = "A minimal pallet built with FRAME, part of Polkadot Sdk. (polkadot v1.15.0)"
version = "0.1.0"
license = "Unlicense"
authors.workspace = true
homepage.workspace = true
repository.workspace = true
edition.workspace = true
publish = false
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
codec = { features = [
"derive",
], workspace = true }
scale-info = { features = [
"derive",
], workspace = true }
frame = { features = ["experimental", "runtime"], workspace = true }
[features]
default = ["std"]
std = ["codec/std", "frame/std", "scale-info/std"]
+22
View File
@@ -0,0 +1,22 @@
//! A shell pallet built with [`frame`].
//!
//! To get started with this pallet, try implementing the guide in
//! <https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/guides/your_first_pallet/index.html>
#![cfg_attr(not(feature = "std"), no_std)]
use frame::prelude::*;
// Re-export all pallet parts, this is needed to properly import the pallet into the runtime.
pub use pallet::*;
#[frame::pallet]
pub mod pallet {
use super::*;
#[pallet::config]
pub trait Config: frame_system::Config {}
#[pallet::pallet]
pub struct Pallet<T>(_);
}
-23
View File
@@ -1,23 +0,0 @@
[package]
name = "pezpallet-minimal-template"
description = "A minimal pezpallet built with Pezframe, part of Pezkuwi SDK."
version = "0.1.0"
license = "Unlicense"
authors.workspace = true
homepage.workspace = true
repository.workspace = true
edition.workspace = true
publish = false
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
codec = { features = ["derive"], workspace = true }
pezkuwi-sdk = { workspace = true, features = ["experimental", "runtime"], default-features = false }
scale-info = { features = ["derive"], workspace = true }
[features]
default = ["std"]
std = ["codec/std", "pezkuwi-sdk/std", "scale-info/std"]
-25
View File
@@ -1,25 +0,0 @@
//! A shell pezpallet built with [`pezframe`].
//!
//! To get started with this pezpallet, try implementing the guide in
//! <https://github.com/pezkuwichain/pezkuwi-sdk>
#![cfg_attr(not(feature = "std"), no_std)]
use pezkuwi_sdk::pezkuwi_sdk_frame::deps::pezframe_support::pezpallet_prelude::*;
// Re-export all pezpallet parts, this is needed to properly import the pezpallet into the runtime.
pub use pallet::*;
#[pezkuwi_sdk::pezframe_support::pezpallet]
pub mod pallet {
use super::*;
#[pezpallet::config]
pub trait Config: pezkuwi_sdk::pezframe_system::Config {}
#[pezpallet::pezpallet]
pub struct Pezpallet<T>(_);
#[pezpallet::storage]
pub type Value<T> = StorageValue<Value = u32>;
}
+26 -9
View File
@@ -1,6 +1,6 @@
[package]
name = "pez-minimal-template-runtime"
description = "A solochain runtime template built with Bizinikiwi, part of Pezkuwi SDK."
name = "minimal-template-runtime"
description = "A solochain runtime template built with Substrate, part of Polkadot Sdk. (polkadot v1.15.0)"
version = "0.1.0"
license = "Unlicense"
authors.workspace = true
@@ -11,20 +11,37 @@ publish = false
[dependencies]
codec = { workspace = true }
pezpallet-minimal-template.workspace = true
pezkuwi-sdk = { workspace = true, features = ["pezpallet-balances", "pezpallet-sudo", "pezpallet-timestamp", "pezpallet-transaction-payment", "pezpallet-transaction-payment-rpc-runtime-api", "runtime", "pezsp-api"] }
scale-info = { workspace = true }
serde_json = { workspace = true, default-features = false, features = ["alloc"] }
frame = { features = ["experimental", "runtime"], workspace = true }
pallet-balances.workspace = true
pallet-sudo.workspace = true
pallet-timestamp.workspace = true
pallet-transaction-payment.workspace = true
pallet-transaction-payment-rpc-runtime-api.workspace = true
sp-genesis-builder.workspace = true
sp-runtime = { features = ["serde"], workspace = true }
pallet-minimal-template.workspace = true
[build-dependencies]
pezkuwi-sdk = { optional = true, workspace = true, features = ["bizinikiwi-wasm-builder"] }
substrate-wasm-builder = { optional = true, workspace = true, default-features = true }
[features]
default = ["std"]
std = [
"codec/std",
"pezpallet-minimal-template/std",
"pezkuwi-sdk/std",
"scale-info/std",
"serde_json/std",
"frame/std",
"pallet-balances/std",
"pallet-sudo/std",
"pallet-timestamp/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-transaction-payment/std",
"pallet-minimal-template/std",
"sp-genesis-builder/std",
"sp-runtime/std",
"substrate-wasm-builder",
]
+17 -2
View File
@@ -1,8 +1,23 @@
//! Build script for pez-minimal-template-runtime.
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
fn main() {
#[cfg(feature = "std")]
{
pezkuwi_sdk::bizinikiwi_wasm_builder::WasmBuilder::build_using_defaults();
substrate_wasm_builder::WasmBuilder::build_using_defaults();
}
}
+96 -136
View File
@@ -1,4 +1,21 @@
//! A minimal runtime that includes the template [`pezpallet`](`pezpallet_minimal_template`).
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! A minimal runtime that includes the template [`pallet`](`pallet_minimal_template`).
#![cfg_attr(not(feature = "std"), no_std)]
@@ -8,74 +25,34 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
extern crate alloc;
use alloc::vec::Vec;
use pezpallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo};
use pezkuwi_sdk::{
pezkuwi_sdk_frame::{
self as frame,
deps::pezsp_genesis_builder,
runtime::{apis, prelude::*},
use alloc::{vec, vec::Vec};
use frame::{
deps::frame_support::{
genesis_builder_helper::{build_state, get_preset},
runtime,
weights::{FixedFee, NoFee},
},
prelude::*,
runtime::{
apis::{
self, impl_runtime_apis, ApplyExtrinsicResult, CheckInherentsResult,
ExtrinsicInclusionMode, OpaqueMetadata,
},
prelude::*,
},
pezframe_system as frame_system,
*,
};
/// Provides getters for genesis configuration presets.
pub mod genesis_config_presets {
use super::*;
use crate::{
interface::{Balance, MinimumBalance},
runtime::{BalancesConfig, RuntimeGenesisConfig, SudoConfig},
};
#[cfg(feature = "std")]
use pezkuwi_sdk::pezsp_keyring::Sr25519Keyring;
use alloc::{vec, vec::Vec};
use serde_json::Value;
/// Returns a development genesis config preset.
pub fn development_config_genesis() -> Value {
let endowment = <MinimumBalance as Get<Balance>>::get().max(1) * 1000;
pezframe_support::build_struct_json_patch!(RuntimeGenesisConfig {
balances: BalancesConfig {
balances: Sr25519Keyring::iter()
.map(|a| (a.to_account_id(), endowment))
.collect::<Vec<_>>(),
},
sudo: SudoConfig { key: Some(Sr25519Keyring::Alice.to_account_id()) },
})
}
/// Get the set of the available genesis config presets.
pub fn get_preset(id: &PresetId) -> Option<Vec<u8>> {
let patch = match id.as_ref() {
pezsp_genesis_builder::DEV_RUNTIME_PRESET => development_config_genesis(),
_ => return None,
};
Some(
serde_json::to_string(&patch)
.expect("serialization to json is expected to work. qed.")
.into_bytes(),
)
}
/// List of supported presets.
pub fn preset_names() -> Vec<PresetId> {
vec![PresetId::from(pezsp_genesis_builder::DEV_RUNTIME_PRESET)]
}
}
/// The runtime version.
#[runtime_version]
pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: alloc::borrow::Cow::Borrowed("pez-minimal-template-runtime"),
impl_name: alloc::borrow::Cow::Borrowed("pez-minimal-template-runtime"),
spec_name: create_runtime_str!("minimal-template-runtime"),
impl_name: create_runtime_str!("minimal-template-runtime"),
authoring_version: 1,
spec_version: 0,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
system_version: 1,
state_version: 1,
};
/// The version information used to identify this runtime when compiled natively.
@@ -84,8 +61,8 @@ pub fn native_version() -> NativeVersion {
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
}
/// The transaction extensions that are added to the runtime.
type TxExtension = (
/// The signed extensions that are added to the runtime.
type SignedExtra = (
// Checks that the sender is not the zero address.
frame_system::CheckNonZeroSender<Runtime>,
// Checks that the runtime version is correct.
@@ -102,18 +79,12 @@ type TxExtension = (
frame_system::CheckWeight<Runtime>,
// Ensures that the sender has enough funds to pay for the transaction
// and deducts the fee from the sender's account.
pezpallet_transaction_payment::ChargeTransactionPayment<Runtime>,
// Reclaim the unused weight from the block using post dispatch information.
// It must be last in the pipeline in order to catch the refund in previous transaction
// extensions
frame_system::WeightReclaim<Runtime>,
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
);
// Composes the runtime by adding all the used pezpallets and deriving necessary types.
#[frame_construct_runtime]
pub mod runtime {
use super::*;
// Composes the runtime by adding all the used pallets and deriving necessary types.
#[runtime]
mod runtime {
/// The main runtime type.
#[runtime::runtime]
#[runtime::derive(
@@ -125,100 +96,91 @@ pub mod runtime {
RuntimeHoldReason,
RuntimeSlashReason,
RuntimeLockId,
RuntimeTask,
RuntimeViewFunction
RuntimeTask
)]
#[derive(Clone, PartialEq, Eq)]
pub struct Runtime;
/// Mandatory system pezpallet that should always be included in a FRAME runtime.
#[runtime::pezpallet_index(0)]
pub type System = pezframe_system::Pezpallet<Runtime>;
/// Mandatory system pallet that should always be included in a FRAME runtime.
#[runtime::pallet_index(0)]
pub type System = frame_system::Pallet<Runtime>;
/// Provides a way for consensus systems to set and check the onchain time.
#[runtime::pezpallet_index(1)]
pub type Timestamp = pezpallet_timestamp::Pezpallet<Runtime>;
#[runtime::pallet_index(1)]
pub type Timestamp = pallet_timestamp::Pallet<Runtime>;
/// Provides the ability to keep track of balances.
#[runtime::pezpallet_index(2)]
pub type Balances = pezpallet_balances::Pezpallet<Runtime>;
#[runtime::pallet_index(2)]
pub type Balances = pallet_balances::Pallet<Runtime>;
/// Provides a way to execute privileged functions.
#[runtime::pezpallet_index(3)]
pub type Sudo = pezpallet_sudo::Pezpallet<Runtime>;
#[runtime::pallet_index(3)]
pub type Sudo = pallet_sudo::Pallet<Runtime>;
/// Provides the ability to charge for extrinsic execution.
#[runtime::pezpallet_index(4)]
pub type TransactionPayment = pezpallet_transaction_payment::Pezpallet<Runtime>;
#[runtime::pallet_index(4)]
pub type TransactionPayment = pallet_transaction_payment::Pallet<Runtime>;
/// A minimal pezpallet template.
#[runtime::pezpallet_index(5)]
pub type Template = pezpallet_minimal_template::Pezpallet<Runtime>;
/// A minimal pallet template.
#[runtime::pallet_index(5)]
pub type Template = pallet_minimal_template::Pallet<Runtime>;
}
pub use runtime::{
Runtime, System, Timestamp, Balances, Sudo, TransactionPayment, Template,
RuntimeCall, RuntimeEvent, RuntimeError, RuntimeOrigin, RuntimeFreezeReason,
RuntimeHoldReason, RuntimeSlashReason, RuntimeLockId, RuntimeTask, RuntimeViewFunction,
AllPalletsWithSystem, RuntimeGenesisConfig, BalancesConfig, SudoConfig,
};
parameter_types! {
pub const Version: RuntimeVersion = VERSION;
}
/// Implements the types required for the system pezpallet.
/// Implements the types required for the system pallet.
#[derive_impl(frame_system::config_preludes::SolochainDefaultConfig)]
impl frame_system::Config for Runtime {
type Block = Block;
type Version = Version;
// Use the account data from the balances pezpallet
type AccountData = pezpallet_balances::AccountData<<Runtime as pezpallet_balances::Config>::Balance>;
// Use the account data from the balances pallet
type AccountData = pallet_balances::AccountData<<Runtime as pallet_balances::Config>::Balance>;
}
// Implements the types required for the balances pezpallet.
#[derive_impl(pezpallet_balances::config_preludes::TestDefaultConfig)]
impl pezpallet_balances::Config for Runtime {
// Implements the types required for the balances pallet.
#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for Runtime {
type AccountStore = System;
}
// Implements the types required for the sudo pezpallet.
#[derive_impl(pezpallet_sudo::config_preludes::TestDefaultConfig)]
impl pezpallet_sudo::Config for Runtime {}
// Implements the types required for the sudo pallet.
#[derive_impl(pallet_sudo::config_preludes::TestDefaultConfig)]
impl pallet_sudo::Config for Runtime {}
// Implements the types required for the timestamp pezpallet.
#[derive_impl(pezpallet_timestamp::config_preludes::TestDefaultConfig)]
impl pezpallet_timestamp::Config for Runtime {}
// Implements the types required for the sudo pallet.
#[derive_impl(pallet_timestamp::config_preludes::TestDefaultConfig)]
impl pallet_timestamp::Config for Runtime {}
// Implements the types required for the transaction payment pezpallet.
#[derive_impl(pezpallet_transaction_payment::config_preludes::TestDefaultConfig)]
impl pezpallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = pezpallet_transaction_payment::FungibleAdapter<Balances, ()>;
// Implements the types required for the transaction payment pallet.
#[derive_impl(pallet_transaction_payment::config_preludes::TestDefaultConfig)]
impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = pallet_transaction_payment::FungibleAdapter<Balances, ()>;
// Setting fee as independent of the weight of the extrinsic for demo purposes
type WeightToFee = NoFee<<Self as pezpallet_balances::Config>::Balance>;
type WeightToFee = NoFee<<Self as pallet_balances::Config>::Balance>;
// Setting fee as fixed for any length of the call data for demo purposes
type LengthToFee = FixedFee<1, <Self as pezpallet_balances::Config>::Balance>;
type LengthToFee = FixedFee<1, <Self as pallet_balances::Config>::Balance>;
}
// Implements the types required for the template pezpallet.
impl pezpallet_minimal_template::Config for Runtime {}
// Implements the types required for the template pallet.
impl pallet_minimal_template::Config for Runtime {}
type Block = frame::runtime::types_common::BlockOf<Runtime, TxExtension>;
type Block = frame::runtime::types_common::BlockOf<Runtime, SignedExtra>;
type Header = HeaderFor<Runtime>;
type RuntimeExecutive =
Executive<Runtime, Block, frame_system::ChainContext<Runtime>, Runtime, AllPalletsWithSystem>;
impl_runtime_apis! {
use pezsp_runtime::traits::BlockT;
use pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo};
impl_runtime_apis! {
impl apis::Core<Block> for Runtime {
fn version() -> RuntimeVersion {
VERSION
}
fn execute_block(block: <Block as BlockT>::LazyBlock) {
RuntimeExecutive::execute_block(block.into())
fn execute_block(block: Block) {
RuntimeExecutive::execute_block(block)
}
fn initialize_block(header: &Header) -> ExtrinsicInclusionMode {
@@ -227,7 +189,7 @@ impl_runtime_apis! {
}
impl apis::Metadata<Block> for Runtime {
fn metadata() -> OpaqueMetadata {
Runtime::metadata()
OpaqueMetadata::new(Runtime::metadata().into())
}
fn metadata_at_version(version: u32) -> Option<OpaqueMetadata> {
@@ -249,16 +211,14 @@ impl_runtime_apis! {
}
fn inherent_extrinsics(data: InherentData) -> Vec<ExtrinsicFor<Runtime>> {
// TODO: Implement proper inherent extrinsics creation
Vec::new()
data.create_extrinsics()
}
fn check_inherents(
block: <Block as BlockT>::LazyBlock,
block: Block,
data: InherentData,
) -> CheckInherentsResult {
// TODO: Implement proper inherents checking
CheckInherentsResult::new()
data.check_extrinsics(&block)
}
}
@@ -296,7 +256,7 @@ impl_runtime_apis! {
}
}
impl pezpallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<
Block,
interface::Balance,
> for Runtime {
@@ -314,17 +274,17 @@ impl_runtime_apis! {
}
}
impl apis::GenesisBuilder<Block> for Runtime {
fn build_state(config: Vec<u8>) -> pezsp_genesis_builder::Result {
impl sp_genesis_builder::GenesisBuilder<Block> for Runtime {
fn build_state(config: Vec<u8>) -> sp_genesis_builder::Result {
build_state::<RuntimeGenesisConfig>(config)
}
fn get_preset(id: &Option<PresetId>) -> Option<Vec<u8>> {
get_preset::<RuntimeGenesisConfig>(id, self::genesis_config_presets::get_preset)
fn get_preset(id: &Option<sp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
get_preset::<RuntimeGenesisConfig>(id, |_| None)
}
fn preset_names() -> Vec<PresetId> {
self::genesis_config_presets::preset_names()
fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
vec![]
}
}
}
@@ -335,14 +295,14 @@ impl_runtime_apis! {
// TODO: this should be standardized in some way, see:
// https://github.com/paritytech/substrate/issues/10579#issuecomment-1600537558
pub mod interface {
use super::{Runtime, frame_system};
use pezkuwi_sdk::{pezkuwi_sdk_frame as frame, *, pezpallet_balances};
use super::Runtime;
use frame::deps::frame_system;
pub type Block = super::Block;
pub use frame::runtime::types_common::OpaqueBlock;
pub type AccountId = <Runtime as frame_system::Config>::AccountId;
pub type Nonce = <Runtime as frame_system::Config>::Nonce;
pub type Hash = <Runtime as frame_system::Config>::Hash;
pub type Balance = <Runtime as pezpallet_balances::Config>::Balance;
pub type MinimumBalance = <Runtime as pezpallet_balances::Config>::ExistentialDeposit;
pub type Balance = <Runtime as pallet_balances::Config>::Balance;
pub type MinimumBalance = <Runtime as pallet_balances::Config>::ExistentialDeposit;
}
+75
View File
@@ -0,0 +1,75 @@
//! # Minimal Template
//!
//! This is a minimal template for creating a blockchain using the Polkadot SDK.
//!
//! ## Components
//!
//! The template consists of the following components:
//!
//! ### Node
//!
//! A minimal blockchain [`node`](`minimal_template_node`) that is capable of running a
//! runtime. It uses a simple chain specification, provides an option to choose Manual or
//! InstantSeal for consensus and exposes a few commands to interact with the node.
//!
//! ### Runtime
//!
//! A minimal [`runtime`](`minimal_template_runtime`) (or a state transition function) that
//! is capable of being run on the node. It is built using the [`FRAME`](`frame`) framework
//! that enables the composition of the core logic via separate modules called "pallets".
//! FRAME defines a complete DSL for building such pallets and the runtime itself.
//!
//! #### Transaction Fees
//!
//! The runtime charges a transaction fee for every transaction that is executed. The fee is
//! calculated based on the weight of the transaction (accouting for the execution time) and
//! length of the call data. Please refer to
//! [`benchmarking docs`](`polkadot_sdk_docs::reference_docs::frame_benchmarking_weight`) for
//! more information on how the weight is calculated.
//!
//! This template sets the fee as independent of the weight of the extrinsic and fixed for any
//! length of the call data for demo purposes.
//!
//! ### Pallet
//!
//! A minimal [`pallet`](`pallet_minimal_template`) that is built using FRAME. It is a unit of
//! encapsulated logic that has a clearly defined responsibility and can be linked to other pallets.
//!
//! ## Getting Started
//!
//! To get started with the template, follow the steps below:
//!
//! ### Build the Node
//!
//! Build the node using the following command:
//!
//! ```bash
//! cargo build -p minimal-template-node --release
//! ```
//!
//! ### Run the Node
//!
//! Run the node using the following command:
//!
//! ```bash
//! ./target/release/minimal-template-node --dev
//! ```
//!
//! ### CLI Options
//!
//! The node exposes a few options that can be used to interact with the node. To see the list of
//! available options, run the following command:
//!
//! ```bash
//! ./target/release/minimal-template-node --help
//! ```
//!
//! #### Consensus Algorithm
//!
//! In order to run the node with a specific consensus algorithm, use the `--consensus` flag. For
//! example, to run the node with ManualSeal consensus with a block time of 5000ms, use the
//! following command:
//!
//! ```bash
//! ./target/release/minimal-template-node --dev --consensus manual-seal-5000
//! ```
-9
View File
@@ -1,9 +0,0 @@
[relaychain]
default_command = "polkadot-omni-node"
chain = "dev"
chain_spec_path = "./dev_chain_spec.json"
default_args = ["--dev-block-time 3000"]
[[relaychain.nodes]]
name = "alice"
ws_port = 9944
-30
View File
@@ -1,30 +0,0 @@
# The setup bellow allows only one node to produce
# blocks and the rest will follow.
[relaychain]
chain = "dev"
default_command = "minimal-template-node"
[[relaychain.nodes]]
name = "alice"
args = ["--consensus manual-seal-3000"]
validator = true
ws_port = 9944
[[relaychain.nodes]]
name = "bob"
args = ["--consensus None"]
validator = true
ws_port = 9955
[[relaychain.nodes]]
name = "charlie"
args = ["--consensus None"]
validator = true
ws_port = 9966
[[relaychain.nodes]]
name = "dave"
args = ["--consensus None"]
validator = true
ws_port = 9977