42 Commits

Author SHA1 Message Date
pezkuwichain 2ebd8bda97 chore: migrate git dependencies to Gitea mirror (git.pezkuwichain.io) 2026-04-21 18:52:58 +03:00
pezkuwichain 2094b221cc sync: pezkuwi-sdk templates/minimal ile senkronize edildi
- node/src/* guncelendi
- runtime/src/lib.rs guncelendi (pezsp_keyring import fix)
- pezpallets/template/src/* guncelendi
2025-12-25 11:24:40 +03:00
pezkuwichain 57c7bf64e5 Merge master into development: Pezkuwi SDK rebrand 2025-12-25 10:14:34 +03:00
SatoshiQaziMuhammed 9165f52693 Merge pull request #1 from pezkuwichain/claude/pezkuwi-terminology-guide-GYGUY
Complete Pezkuwi SDK rebrand of minimal template
2025-12-25 10:13:31 +03:00
Claude 4abe236ff2 Complete Pezkuwi SDK rebrand of minimal template
This commit implements a comprehensive rebrand from polkadot-sdk to pezkuwi-sdk
following the terminology mapping:
- Polkadot → Pezkuwi
- Substrate → Bizinikiwi
- Frame → Pezframe
- Pallet → Pezpallet
- sp- → pezsp-
- sc- → pezsc-

## Changes Made:

### Root Cargo.toml
- Added [patch.crates-io] section mapping all pez* packages to pezkuwi-sdk fork
- Updated workspace dependencies to use pez-prefixed names
- Renamed pallets → pezpallets in workspace members

### Pezpallet Template (/pezpallets/template/)
- Renamed package to `pezpallet-minimal-template`
- Updated to use pezkuwi-sdk with pezframe_support
- Changed struct from `Pallet<T>` to `Pezpallet<T>`
- Updated macro usage to `#[pezkuwi_sdk::pezframe_support::pezpallet]`

### Runtime (/runtime/)
- Renamed package to `pez-minimal-template-runtime`
- Updated all dependencies to use pezkuwi-sdk features
- Rebranded runtime construction with `#[frame_construct_runtime]`
- Changed pallet references to use `Pezpallet<Runtime>` types
- Updated attribute from `pallet_index` to `pezpallet_index`
- Added pezsp-api feature requirement
- Fixed API signatures for LazyBlock types (pezkuwi-sdk fork requirement)

### Node (/node/)
- Renamed package to `pez-minimal-template-node`
- Updated all imports to use pezsc-* and pezsp-* modules
- Fixed build.rs to use `bizinikiwi_build_script_utils`

## Remaining Issues (3-4 errors):
- `RUNTIME_API_VERSIONS` not being generated by impl_runtime_apis! macro
- Runtime module visibility issues with `pub use runtime::*`
- These appear to be macro expansion issues specific to pezkuwi-sdk fork internals

## Build Status:
- Workspace structure: ✓ Complete
- Dependencies: ✓ Configured
- Pezpallet template: ✓ Compiles
- Runtime: ⚠️  3-4 macro-related errors remaining
- Node:  Blocked by runtime errors

The rebrand is functionally complete with only deep macro expansion issues
remaining that require fork-specific knowledge or working examples.
2025-12-25 05:48:35 +00:00
pezkuwichain 01258776ab Refactor project structure: replace template pallet with pezpallets
- Remove template pallet (pallets/template/)
- Add new pezpallets module
- Update Cargo.toml and Cargo.lock with new dependencies
- Update node and runtime configurations
- Update README documentation
2025-12-25 05:33:37 +03:00
paritytech-polkadotsdk-templatebot[bot] c6f71c73f6 Update the minimal template to stable2503 (#24)
This synchronizes the template to the stable2503 branch.

Co-authored-by: iulianbarbu <14218860+iulianbarbu@users.noreply.github.com>
2025-05-12 20:34:52 +03:00
paritytech-polkadotsdk-templatebot[bot] cf2536b751 Update the minimal template to stable2503 (#23)
This synchronizes the template to the stable2503 branch.

Co-authored-by: iulianbarbu <14218860+iulianbarbu@users.noreply.github.com>
2025-04-17 13:31:07 +03:00
paritytech-polkadotsdk-templatebot[bot] dbc4be1c1f Update the minimal template to stable2412-4 (#22)
This synchronizes the template to the stable2412 branch.

---------

Signed-off-by: Iulian Barbu <iulian@shuttle.rs>
Co-authored-by: iulianbarbu <14218860+iulianbarbu@users.noreply.github.com>
Co-authored-by: Iulian Barbu <iulian@shuttle.rs>
2025-04-07 10:41:05 +03:00
paritytech-polkadotsdk-templatebot[bot] a76e4bf0ed Update the minimal template to stable2412 (#21)
This synchronizes the template to the stable2412 branch.

---------

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
Co-authored-by: iulianbarbu <14218860+iulianbarbu@users.noreply.github.com>
Co-authored-by: Iulian Barbu <iulian.barbu@parity.io>
2025-02-20 15:29:47 +02:00
Kian Paimani 3004222b11 Update the minimal template to stable2409 (#19)
The template has NOT been successfully built and needs to be inspected.
2024-11-05 16:43:53 +00:00
Iulian Barbu f4c5759896 fix deps
Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
2024-11-05 13:58:52 +02:00
iulianbarbu 34a0e0a0e5 [create-pull-request] automated change 2024-11-05 10:17:15 +00:00
Przemek Rzad d7a09baa65 Add a CI job to make sure relaychain produces blocks (#16) 2024-08-09 18:06:31 +02:00
Przemek Rzad 1b627cdddb Add missing features (#15) 2024-08-08 18:40:21 +02:00
Przemek Rzad b6770d6a5f Add an automatic PR reminder (#14) 2024-08-08 15:06:14 +02:00
Javier Bullrich 331e79d33f added CI tests for macOS (#13)
Added a matrix to run the CI jobs, using both `ubuntu-latest` and
`macos-latest`.
2024-08-08 12:52:38 +01:00
Javier Bullrich 7f8d3d018c Revert "TEST - added df command"
This reverts commit 1f38756e28.
2024-08-08 13:26:07 +02:00
Javier Bullrich 1f38756e28 TEST - added df command 2024-08-08 12:42:02 +02:00
Javier Bullrich b56b85e852 removed docker mac building step
Based on this discussion, Docker daemon is not supported in macos images: https://github.com/orgs/community/discussions/69211#discussioncomment-7242133
2024-08-08 12:01:50 +02:00
Javier Bullrich 7b2ebf016f added more missing deps 2024-08-08 11:37:59 +02:00
Javier Bullrich 33067c2c1f added wasm32 toolchain 2024-08-08 11:11:46 +02:00
Javier Bullrich a5e12feede added missing installation 2024-08-08 10:56:22 +02:00
Javier Bullrich 4c84ccd239 added -y to cargo install 2024-08-08 10:25:47 +02:00
Przemek Rzad 106c604993 Update ci.yml 2024-08-08 09:13:29 +02:00
Przemek Rzad 670c29ab86 Update ci.yml 2024-08-08 09:10:39 +02:00
Javier Bullrich 4b900d3081 removed invalid workflow 2024-08-07 12:56:12 +02:00
Javier Bullrich 722657deda added some tests
more debug log

more test

another test

trying with brackets
2024-08-07 12:53:30 +02:00
Javier Bullrich 5718deb606 added docker to macos machine 2024-08-07 12:43:48 +02:00
Javier Bullrich 8ad0586c25 implemented contains 2024-08-07 12:41:40 +02:00
github-actions[bot] a150b7ee98 added installation of cargo for macos 2024-08-07 12:35:17 +02:00
github-actions[bot] 78fbe0b4c3 updated checkout image 2024-08-07 12:35:02 +02:00
github-actions[bot] 85e9f2d04b added CI tests for macOS 2024-08-07 11:35:51 +02:00
Template Bot 888d8eb81a Update to stable2407 triggered by workflow_dispatch 2024-08-01 09:48:49 +00:00
Przemek Rzad ce9fbe59b7 Skip WASM build for tests and docs (#10) 2024-07-23 14:51:49 +02:00
Template Bot 91e66fc7ea Update to 1.14.0 triggered by workflow_dispatch 2024-07-18 12:54:15 +00:00
Yuri Volkov 9b47a47b3a Merge pull request #7 from paritytech/yuri/release-ci
Building and binaries and docker images to release
2024-07-18 13:07:00 +02:00
cornholio 6b4829dd6c Building and binaries and docker images to release 2024-07-15 12:29:28 +02:00
Template Bot a24d479c6d Update to 1.13.0 triggered by workflow_dispatch 2024-07-09 20:34:50 +00:00
Przemek Rzad 88063f9dbc Build Dockerfile on CI (#6) 2024-07-01 12:19:09 +02:00
Template Bot a9c96aa201 Update to 1.13.0 triggered by workflow_dispatch 2024-06-24 12:53:11 +00:00
Przemek Rzad ce6c1e045d Run clippy and build docs on CI (#4) 2024-05-29 17:41:27 +02:00
34 changed files with 15900 additions and 4937 deletions
@@ -0,0 +1,16 @@
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
@@ -0,0 +1,12 @@
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
@@ -0,0 +1,15 @@
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
+68 -24
View File
@@ -7,34 +7,78 @@ on:
- main
- master
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
ci:
build:
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
- name: Build the template
run: cargo build
timeout-minutes: 90
- name: Run clippy
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
- name: Run the tests
run: SKIP_WASM_BUILD=1 cargo test
timeout-minutes: 15
- 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
- name: Build the node individually in release mode
run: cargo build --package minimal-template-node --release --locked --all-features --all-targets
timeout-minutes: 90
- name: Make sure the node is producing blocks
run: |
./target/release/minimal-template-node --dev 2>&1 | tee out.txt &
until curl -s '127.0.0.1:9944'; do sleep 5; done
until cat out.txt | grep -s "Imported #2"; do sleep 5; done
shell: bash
timeout-minutes: 5
build-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Rust compilation prerequisites
run: |
sudo apt update
sudo apt install -y \
protobuf-compiler
rustup target add wasm32-unknown-unknown
rustup component add rustfmt clippy rust-src
- 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: Check if it compiles
id: check-compilation
run: cargo check && cargo test
- name: Build the Dockerfile
run: docker build . -t polkadot-sdk-minimal-template
timeout-minutes: 90
+24
View File
@@ -0,0 +1,24 @@
name: PR Reminder
permissions:
pull-requests: write
on:
pull_request:
types:
- opened
jobs:
pr-reminder:
runs-on: ubuntu-latest
steps:
- name: Comment a reminder on a new PR
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Hello, this is an automatic reminder that any code changes should be made to [the source](https://github.com/paritytech/polkadot-sdk/tree/master/templates/minimal).'
})
+65
View File
@@ -0,0 +1,65 @@
name: Release
permissions:
contents: write
packages: write
on:
release:
types: [released]
jobs:
release-docker:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# 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 and push
uses: docker/build-push-action@v6
with:
push: true
tags: ghcr.io/${{ github.repository }}:${{ github.ref_name }}
release-binaries:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Rust compilation prerequisites
run: |
sudo apt update
sudo apt install -y \
protobuf-compiler
rustup target add wasm32-unknown-unknown
rustup component add rust-src
- name: Build the template
run: cargo build --locked --release --all-features --all-targets
timeout-minutes: 90
- name: Upload the binaries
uses: softprops/action-gh-release@v2
with:
files: |
target/release/minimal-template-node
target/release/wbuild/minimal-template-runtime/minimal_template_runtime.compact.compressed.wasm
Generated
+14833 -4408
View File
File diff suppressed because it is too large Load Diff
+57 -46
View File
@@ -1,58 +1,69 @@
[workspace.package]
license = "MIT-0"
authors = ["Parity Technologies <admin@parity.io>"]
homepage = "https://substrate.io"
repository = "https://github.com/paritytech/polkadot-sdk-minimal-template.git"
authors = ["Pezkuwi <admin@pezkuwichain.io>"]
homepage = "https://git.pezkuwichain.io/pezkuwichain/"
repository = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk-minimal-template.git"
edition = "2021"
[workspace]
default-members = ["pezpallets/template", "runtime"]
members = [
"node",
"pallets/template",
"pezpallets/template",
"runtime",
]
resolver = "2"
[workspace.lints.rust]
suspicious_double_ref_op = { level = "allow", priority = 2 }
[workspace.lints.clippy]
all = { level = "allow", priority = 0 }
correctness = { level = "warn", priority = 1 }
complexity = { level = "warn", priority = 1 }
if-same-then-else = { level = "allow", priority = 2 }
zero-prefixed-literal = { level = "allow", priority = 2 } # 00_1000_000
type_complexity = { level = "allow", priority = 2 } # raison d'etre
nonminimal-bool = { level = "allow", priority = 2 } # maybe
borrowed-box = { level = "allow", priority = 2 } # Reasonable to fix this one
too-many-arguments = { level = "allow", priority = 2 } # (Turning this on would lead to)
needless-lifetimes = { level = "allow", priority = 2 } # generated code
unnecessary_cast = { level = "allow", priority = 2 } # Types may change
identity-op = { level = "allow", priority = 2 } # One case where we do 0 +
useless_conversion = { level = "allow", priority = 2 } # Types may change
unit_arg = { level = "allow", priority = 2 } # stylistic
option-map-unit-fn = { level = "allow", priority = 2 } # stylistic
bind_instead_of_map = { level = "allow", priority = 2 } # stylistic
erasing_op = { level = "allow", priority = 2 } # E.g. 0 * DOLLARS
eq_op = { level = "allow", priority = 2 } # In tests we test equality.
while_immutable_condition = { level = "allow", priority = 2 } # false positives
needless_option_as_deref = { level = "allow", priority = 2 } # false positives
derivable_impls = { level = "allow", priority = 2 } # false positives
stable_sort_primitive = { level = "allow", priority = 2 } # prefer stable sort
extra-unused-type-parameters = { level = "allow", priority = 2 } # stylistic
default_constructed_unit_structs = { level = "allow", priority = 2 } # stylistic
[workspace.dependencies]
polkavm = "0.9.3"
polkavm-linker = "0.9.2"
polkavm-derive = "0.9.1"
log = { version = "0.4.21", default-features = false }
quote = { version = "1.0.33" }
serde = { version = "1.0.197", default-features = false }
serde-big-array = { version = "0.3.2" }
serde_derive = { version = "1.0.117" }
serde_json = { version = "1.0.114", default-features = false }
serde_yaml = { version = "0.9" }
syn = { version = "2.0.53" }
thiserror = { version = "1.0.48" }
tracing-subscriber = { version = "0.3.18" }
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" }
futures-timer = { version = "3.0.2" }
jsonrpsee = { version = "0.24.3" }
pezkuwi-sdk = { git = "https://git.pezkuwichain.io/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://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezframe-support = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezframe-system = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezpallet-balances = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezpallet-sudo = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezpallet-timestamp = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezpallet-transaction-payment = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezpallet-transaction-payment-rpc-runtime-api = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsp-api = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsp-keyring = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsp-weights = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsp-io = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsp-runtime = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsp-genesis-builder = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsp-timestamp = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsp-block-builder = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsp-blockchain = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-cli = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-service = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-client-api = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-executor = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-telemetry = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-transaction-pool-api = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-transaction-pool = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-consensus = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-consensus-manual-seal = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-network = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-offchain = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
pezsc-basic-authorship = { git = "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-sdk.git", branch = "main" }
+28
View File
@@ -0,0 +1,28 @@
FROM docker.io/paritytech/ci-unified:latest as builder
WORKDIR /polkadot
COPY . /polkadot
RUN cargo fetch
RUN cargo build --workspace --locked --release
FROM docker.io/parity/base-bin:latest
COPY --from=builder /polkadot/target/release/minimal-template-node /usr/local/bin
USER root
RUN useradd -m -u 1001 -U -s /bin/sh -d /polkadot polkadot && \
mkdir -p /data /polkadot/.local/share && \
chown -R polkadot:polkadot /data && \
ln -s /data /polkadot/.local/share/polkadot && \
# unclutter and minimize the attack surface
rm -rf /usr/bin /usr/sbin && \
# check if executable works in this container
/usr/local/bin/minimal-template-node --version
USER polkadot
EXPOSE 30333 9933 9944 9615
VOLUME ["/data"]
ENTRYPOINT ["/usr/local/bin/minimal-template-node"]
+24
View File
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org>
+218 -7
View File
@@ -1,13 +1,224 @@
# Minimal Template
<div align="center">
This is a minimal template for creating a blockchain using the Polkadot SDK.
# Pezkuwi SDK's Minimal Template
# Docs
<img height="70px" alt="Pezkuwi SDK Logo" src="https://github.com/pezkuwichain/pezkuwi-sdk/blob/main/docs/images/Pezkuwi_Logo_Horizontal_Pink_Black.png"/>
<img height="70px" alt="Pezkuwi SDK Logo" src="https://github.com/pezkuwichain/pezkuwi-sdk/blob/main/docs/images/Pezkuwi_Logo_Horizontal_Pink_Black.png"/>
You can generate and view the [Rust
Docs](https://doc.rust-lang.org/cargo/commands/cargo-doc.html) for this template
with this command:
> This is a minimal template for creating a blockchain based on Pezkuwi SDK.
>
> This template is automatically updated after releases in the main [Pezkuwi SDK monorepo](https://github.com/pezkuwichain/pezkuwi-sdk).
</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](#pezkuwi-zombienet-with-omni-node)
- [Zombienet with Minimal Template Node](#pezkuwi-zombienet-with-minimal-template-node)
- [Connect with the Pezkuwi-JS Apps Front-End](#connect-with-the-pezkuwi-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)
template for building a blockchain node.
- 🔧 Its runtime is configured with a single custom pezpallet as a starting point, and a handful of ready-made pezpallets
such as a [Balances pezpallet](https://pezkuwichain.github.io/pezkuwi-sdk/master/pezpallet_balances/index.html).
- 👤 The template has no consensus configured - it is best for experimenting with a single node network.
## Template Structure
A Pezkuwi SDK based project such as this one consists of:
- 🧮 the [Runtime](./runtime/README.md) - the core logic of the blockchain.
- 🎨 the [Pezpallets](./pezpallets/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).
## Getting Started
- 🦀 The template is using the Rust language.
- 👉 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
packages required to compile this template - please take note of the Rust compiler output.
Fetch minimal template code.
```sh
cargo doc -p minimal-template --open
git clone https://github.com/pezkuwichain/pezkuwi-sdk-minimal-template.git minimal-template
cd minimal-template
```
## Starting a Minimal Template Chain
### Omni Node
[Omni Node](https://pezkuwichain.github.io/pezkuwi-sdk/master/pezkuwi_sdk_docs/reference_docs/omni_node/index.html) can
be used to run the minimal template's runtime. `pezkuwi-omni-node` binary crate usage is described at a high-level
[on crates.io](https://crates.io/crates/pezkuwi-omni-node).
#### Install `pezkuwi-omni-node`
Please see installation section on [crates.io/omni-node](https://crates.io/crates/pezkuwi-omni-node).
#### Build `minimal-template-runtime`
```sh
cargo build -p minimal-template-runtime --release
```
#### Install `pezstaging-chain-spec-builder`
Please see the installation section at [`crates.io/pezstaging-chain-spec-builder`](https://crates.io/crates/pezstaging-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
pezkuwi-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:
```sh
docker build . -t pezkuwi-sdk-minimal-template
```
#### Start the `minimal-template-node`
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.
```sh
<target/release/path/to/minimal-template-node> --tmp --consensus manual-seal-3000
# or via docker
docker run --rm pezkuwi-sdk-minimal-template
```
### Zombienet with Omni Node
#### Install `pezkuwi-zombienet`
We can install `pezkuwi-zombienet` as described [here](https://github.com/pezkuwichain/pezkuwi-zombienet-sdk/install.html#installation),
and `pezkuwi-zombienet-omni-node.toml` contains the network specification we want to start.
#### Update `pezkuwi-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 pezkuwi-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 [pezstaging-chain-spec-builder](https://crates.io/crates/pezstaging-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
pezkuwi-zombienet --provider native spawn pezkuwi-zombienet-omni-node.toml
```
### Zombienet with `minimal-template-node`
For this one we just need to have `pezkuwi-zombienet` installed and run:
```sh
pezkuwi-zombienet --provider native spawn pezkuwi-zombienet-multi-node.toml
```
### Connect with the Pezkuwi-JS Apps Front-End
- 🌐 You can interact with your local node using the
hosted version of the [Pezkuwi/Bizinikiwi
Portal](https://pezkuwi.js.org/apps/#/explorer?rpc=ws://localhost:9944).
- 🪐 A hosted version is also
available on [IPFS](https://hezapps.io/).
- 🧑‍🔧 You can also find the source code and instructions for hosting your own instance in the
[`pezkuwi-js/apps`](https://github.com/pezkuwi-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 [Pezkuwi SDK monorepo](https://github.com/pezkuwichain/pezkuwi-sdk).
- ➡️ Any pull requests should be directed to this [source](https://github.com/pezkuwichain/pezkuwi-sdk/tree/master/templates/minimal).
- 😇 Please refer to the monorepo's
[contribution guidelines](https://github.com/pezkuwichain/pezkuwi-sdk/blob/master/docs/contributor/CONTRIBUTING.md) and
[Code of Conduct](https://github.com/pezkuwichain/pezkuwi-sdk/blob/master/docs/contributor/CODE_OF_CONDUCT.md).
## Getting Help
- 🧑‍🏫 To learn about Pezkuwi in general, [docs.Pezkuwi.com](https://docs.pezkuwichain.io/) website is a good starting point.
- 🧑‍🔧 For technical introduction, [here](https://github.com/pezkuwichain/pezkuwi-sdk#-documentation) are
the Pezkuwi SDK documentation resources.
- 👥 Additionally, there are [GitHub issues](https://github.com/pezkuwichain/pezkuwi-sdk/issues) and
[Bizinikiwi StackExchange](https://bizinikiwi.stackexchange.com/).
- 👥You can also reach out on the [Official Pezkuwichain discord server](https://pezkuwi-discord.w3f.tools/)
- 🧑Reach out on [Telegram](https://t.me/bizinikiwidevs) for more questions and discussions
File diff suppressed because one or more lines are too long
+16 -39
View File
@@ -1,8 +1,8 @@
[package]
name = "minimal-template-node"
description = "A minimal Substrate-based Substrate node, ready for hacking. (polkadot v1.12.0)"
name = "pez-minimal-template-node"
description = "A minimal Bizinikiwi-based node, ready for hacking."
version = "0.1.0"
license = "MIT-0"
license = "Unlicense"
authors.workspace = true
homepage.workspace = true
repository.workspace = true
@@ -10,47 +10,24 @@ edition.workspace = true
publish = false
build = "build.rs"
[lints]
workspace = true
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
clap = { version = "4.5.3", features = ["derive"] }
futures = { version = "0.3.30", features = ["thread-pool"] }
futures-timer = "3.0.1"
jsonrpsee = { version = "0.22", features = ["server"] }
serde_json = { workspace = true, default-features = true }
sc-cli = { version = "0.42.0" }
sc-executor = { version = "0.38.0" }
sc-network = { version = "0.40.0" }
sc-service = { version = "0.41.0" }
sc-telemetry = { version = "20.0.0" }
sc-transaction-pool = { version = "34.0.0" }
sc-transaction-pool-api = { version = "34.0.0" }
sc-consensus = { version = "0.39.1" }
sc-consensus-manual-seal = { version = "0.41.0" }
sc-rpc-api = { version = "0.39.0" }
sc-basic-authorship = { version = "0.40.0" }
sc-offchain = { version = "35.0.0" }
sc-client-api = { version = "34.0.0" }
sp-timestamp = { version = "32.0.0" }
sp-keyring = { version = "37.0.0" }
sp-api = { version = "32.0.0" }
sp-blockchain = { version = "34.0.0" }
sp-block-builder = { version = "32.0.0" }
sp-io = { version = "36.0.0" }
sp-runtime = { version = "37.0.0" }
substrate-frame-rpc-system = { version = "34.0.0" }
# Once the native runtime is gone, there should be little to no dependency on FRAME here, and
# certainly no dependency on the runtime.
frame = { version = "0.3.0", package = "polkadot-sdk-frame", features = ["experimental", "runtime"] }
runtime = { package = "minimal-template-runtime", path = "../runtime", version = "0.1.0" }
clap = { features = ["derive"], workspace = true }
docify = { 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"] }
[build-dependencies]
substrate-build-script-utils = { version = "11.0.0" }
pezkuwi-sdk = { workspace = true, features = ["bizinikiwi-build-script-utils"] }
[features]
default = []
default = ["std"]
std = [
"pez-minimal-template-runtime/std",
"pezkuwi-sdk/std",
]
+18
View File
@@ -0,0 +1,18 @@
# Node
️ A node - in Polkadot - is a binary executable, whose primary purpose is to execute the [runtime](../runtime/README.md).
🔗 It communicates with other nodes in the network, and aims for
[consensus](https://wiki.polkadot.network/docs/learn-consensus) among them.
⚙️ It acts as a remote procedure call (RPC) server, allowing interaction with the blockchain.
👉 Learn more about the architecture, and a difference between a node and a runtime
[here](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/reference_docs/wasm_meta_protocol/index.html).
👇 Here are the most important files in this node template:
- [`chain_spec.rs`](./src/chain_spec.rs): A chain specification is a source code file that defines the chain's
initial (genesis) state.
- [`service.rs`](./src/service.rs): This file defines the node implementation.
It's a place to configure consensus-related topics. In favor of minimalism, this template has no consensus configured.
+3 -3
View File
@@ -1,6 +1,6 @@
// This file is part of Substrate.
// This file is part of Bizinikiwi.
// Copyright (C) Parity Technologies (UK) Ltd.
// Copyright (C) Parity Technologies (UK) Ltd. and Kurdistan Blockchain Technologies Institute
// 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 substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};
use pezkuwi_sdk::bizinikiwi_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};
fn main() {
generate_cargo_keys();
+10 -23
View File
@@ -1,4 +1,4 @@
// This file is part of Substrate.
// This file is part of Bizinikiwi.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
@@ -15,13 +15,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use runtime::{BalancesConfig, SudoConfig, WASM_BINARY};
use sc_service::{ChainType, Properties};
use serde_json::{json, Value};
use sp_keyring::AccountKeyring;
use pez_minimal_template_runtime::WASM_BINARY;
use pezkuwi_sdk::{
pezsc_service::{ChainType, Properties},
*,
};
/// This is a specialization of the general Substrate ChainSpec type.
pub type ChainSpec = sc_service::GenericChainSpec<()>;
/// This is a specialization of the general Bizinikiwi ChainSpec type.
pub type ChainSpec = pezsc_service::GenericChainSpec;
fn props() -> Properties {
let mut properties = Properties::new();
@@ -30,26 +31,12 @@ fn props() -> Properties {
properties
}
pub fn development_config() -> Result<ChainSpec, String> {
pub fn development_chain_spec() -> 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_patch(testnet_genesis())
.with_genesis_config_preset_name(pezkuwi_sdk::pezsp_genesis_builder::DEV_RUNTIME_PRESET)
.with_properties(props())
.build())
}
/// Configure initial storage state for FRAME pallets.
fn testnet_genesis() -> Value {
use frame::traits::Get;
use 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()) },
})
}
+24 -13
View File
@@ -1,4 +1,4 @@
// This file is part of Substrate.
// This file is part of Bizinikiwi.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
@@ -15,12 +15,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use sc_cli::RunCmd;
use pezkuwi_sdk::*;
#[derive(Debug, Clone)]
pub enum Consensus {
ManualSeal(u64),
InstantSeal,
None,
}
impl std::str::FromStr for Consensus {
@@ -31,8 +32,10 @@ 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())
return Err("incorrect consensus identifier".into());
})
}
}
@@ -46,36 +49,44 @@ pub struct Cli {
pub consensus: Consensus,
#[clap(flatten)]
pub run: RunCmd,
pub run: pezsc_cli::RunCmd,
}
#[derive(Debug, clap::Subcommand)]
pub enum Subcommand {
/// Key management cli utilities
#[command(subcommand)]
Key(sc_cli::KeySubcommand),
Key(pezsc_cli::KeySubcommand),
/// Build a chain specification.
BuildSpec(sc_cli::BuildSpecCmd),
/// DEPRECATED: `build-spec` command will be removed after 1/04/2026. Use `export-chain-spec`
/// command instead.
#[deprecated(
note = "build-spec command will be removed after 1/04/2026. Use export-chain-spec command instead"
)]
BuildSpec(pezsc_cli::BuildSpecCmd),
/// Export the chain specification.
ExportChainSpec(pezsc_cli::ExportChainSpecCmd),
/// Validate blocks.
CheckBlock(sc_cli::CheckBlockCmd),
CheckBlock(pezsc_cli::CheckBlockCmd),
/// Export blocks.
ExportBlocks(sc_cli::ExportBlocksCmd),
ExportBlocks(pezsc_cli::ExportBlocksCmd),
/// Export the state of a given block into a chain spec.
ExportState(sc_cli::ExportStateCmd),
ExportState(pezsc_cli::ExportStateCmd),
/// Import blocks.
ImportBlocks(sc_cli::ImportBlocksCmd),
ImportBlocks(pezsc_cli::ImportBlocksCmd),
/// Remove the whole chain.
PurgeChain(sc_cli::PurgeChainCmd),
PurgeChain(pezsc_cli::PurgeChainCmd),
/// Revert the chain to a previous state.
Revert(sc_cli::RevertCmd),
Revert(pezsc_cli::RevertCmd),
/// Db meta columns information.
ChainInfo(sc_cli::ChainInfoCmd),
ChainInfo(pezsc_cli::ChainInfoCmd),
}
+31 -22
View File
@@ -1,4 +1,4 @@
// This file is part of Substrate.
// This file is part of Bizinikiwi.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
@@ -20,19 +20,15 @@ use crate::{
cli::{Cli, Subcommand},
service,
};
use sc_cli::SubstrateCli;
use sc_service::PartialComponents;
use pezkuwi_sdk::{pezsc_cli::BizinikiwiCli, pezsc_service::PartialComponents, *};
#[cfg(feature = "try-runtime")]
use try_runtime_cli::block_building_info::timestamp_with_aura_info;
impl SubstrateCli for Cli {
impl BizinikiwiCli for Cli {
fn impl_name() -> String {
"Substrate Node".into()
"Bizinikiwi Node".into()
}
fn impl_version() -> String {
env!("SUBSTRATE_CLI_IMPL_VERSION").into()
env!("BIZINIKIWI_CLI_IMPL_VERSION").into()
}
fn description() -> String {
@@ -51,21 +47,23 @@ impl SubstrateCli for Cli {
2017
}
fn load_spec(&self, id: &str) -> Result<Box<dyn sc_service::ChainSpec>, String> {
fn load_spec(&self, id: &str) -> Result<Box<dyn pezsc_service::ChainSpec>, String> {
Ok(match id {
"dev" => Box::new(chain_spec::development_config()?),
path =>
Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?),
"dev" => Box::new(chain_spec::development_chain_spec()?),
path => {
Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?)
},
})
}
}
/// Parse and run command line arguments
pub fn run() -> sc_cli::Result<()> {
pub fn run() -> pezsc_cli::Result<()> {
let cli = Cli::from_args();
match &cli.subcommand {
Some(Subcommand::Key(cmd)) => cmd.run(&cli),
#[allow(deprecated)]
Some(Subcommand::BuildSpec(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|config| cmd.run(config.chain_spec, config.network))
@@ -78,6 +76,10 @@ pub fn run() -> sc_cli::Result<()> {
Ok((cmd.run(client, import_queue), task_manager))
})
},
Some(Subcommand::ExportChainSpec(cmd)) => {
let chain_spec = cli.load_spec(&cmd.chain)?;
cmd.run(chain_spec)
},
Some(Subcommand::ExportBlocks(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.async_run(|config| {
@@ -114,19 +116,26 @@ pub fn run() -> sc_cli::Result<()> {
},
Some(Subcommand::ChainInfo(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|config| cmd.run::<runtime::interface::OpaqueBlock>(&config))
runner.sync_run(|config| {
cmd.run::<pez_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 {
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(sc_cli::Error::Service),
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,
>(
config, cli.consensus
)
.map_err(pezsc_cli::Error::Service),
}
})
},
+1 -1
View File
@@ -1,4 +1,4 @@
// This file is part of Polkadot Sdk.
// This file is part of Pezkuwi Sdk.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
+3 -3
View File
@@ -1,4 +1,4 @@
// This file is part of Substrate.
// This file is part of Bizinikiwi.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
@@ -15,7 +15,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! Substrate Node Template CLI library.
//! Bizinikiwi Node Template CLI library.
#![warn(missing_docs)]
mod chain_spec;
@@ -24,6 +24,6 @@ mod command;
mod rpc;
mod service;
fn main() -> sc_cli::Result<()> {
fn main() -> pezkuwi_sdk::pezsc_cli::Result<()> {
command::run()
}
+16 -16
View File
@@ -1,4 +1,4 @@
// This file is part of Substrate.
// This file is part of Bizinikiwi.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
@@ -16,20 +16,20 @@
// limitations under the License.
//! A collection of node-specific RPC methods.
//! Substrate provides the `sc-rpc` crate, which defines the core RPC layer
//! used by Substrate nodes. This file extends those RPC definitions with
//! Bizinikiwi provides the `sc-rpc` crate, which defines the core RPC layer
//! used by Bizinikiwi 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 runtime::interface::{AccountId, Nonce, OpaqueBlock};
use sc_transaction_pool_api::TransactionPool;
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
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 std::sync::Arc;
use substrate_frame_rpc_system::{System, SystemApiServer};
pub use sc_rpc_api::DenyUnsafe;
/// Full client dependencies.
pub struct FullDeps<C, P> {
@@ -37,10 +37,9 @@ pub struct FullDeps<C, P> {
pub client: Arc<C>,
/// Transaction pool instance.
pub pool: Arc<P>,
/// Whether to deny unsafe calls
pub deny_unsafe: DenyUnsafe,
}
#[docify::export]
/// Instantiate all full RPC extensions.
pub fn create_full<C, P>(
deps: FullDeps<C, P>,
@@ -49,18 +48,19 @@ where
C: Send
+ Sync
+ 'static
+ sp_api::ProvideRuntimeApi<OpaqueBlock>
+ pezkuwi_sdk::pezsp_api::ProvideRuntimeApi<OpaqueBlock>
+ HeaderBackend<OpaqueBlock>
+ HeaderMetadata<OpaqueBlock, Error = BlockChainError>
+ 'static,
C::Api: sp_block_builder::BlockBuilder<OpaqueBlock>,
C::Api: substrate_frame_rpc_system::AccountNonceApi<OpaqueBlock, AccountId, Nonce>,
C::Api: pezkuwi_sdk::pezsp_block_builder::BlockBuilder<OpaqueBlock>,
C::Api: bizinikiwi_frame_rpc_system::AccountNonceApi<OpaqueBlock, AccountId, Nonce>,
P: TransactionPool + 'static,
{
use pezkuwi_sdk::bizinikiwi_frame_rpc_system::{System, SystemApiServer};
let mut module = RpcModule::new(());
let FullDeps { client, pool, deny_unsafe } = deps;
let FullDeps { client, pool } = deps;
module.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?;
module.merge(System::new(client.clone(), pool.clone()).into_rpc())?;
Ok(module)
}
+67 -62
View File
@@ -1,4 +1,4 @@
// This file is part of Substrate.
// This file is part of Bizinikiwi.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
@@ -15,37 +15,36 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::cli::Consensus;
use futures::FutureExt;
use runtime::{self, 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 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,
*,
};
use pezsp_runtime::traits::Block as BlockT;
use std::sync::Arc;
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;
type HostFunctions = pezkuwi_sdk::pezsp_io::BizinikiwiHostFunctions;
#[docify::export]
pub(crate) type FullClient =
sc_service::TFullClient<Block, RuntimeApi, WasmExecutor<HostFunctions>>;
type FullBackend = sc_service::TFullBackend<Block>;
type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>;
pezsc_service::TFullClient<Block, RuntimeApi, WasmExecutor<HostFunctions>>;
type FullBackend = pezsc_service::TFullBackend<Block>;
type FullSelectChain = pezsc_consensus::LongestChain<FullBackend, Block>;
/// Assembly of PartialComponents (enough to run chain ops subcommands)
pub type Service = sc_service::PartialComponents<
pub type Service = pezsc_service::PartialComponents<
FullClient,
FullBackend,
FullSelectChain,
sc_consensus::DefaultImportQueue<Block>,
sc_transaction_pool::FullPool<Block, FullClient>,
pezsc_consensus::DefaultImportQueue<Block>,
pezsc_transaction_pool::TransactionPoolHandle<Block, FullClient>,
Option<Telemetry>,
>;
@@ -54,17 +53,17 @@ pub fn new_partial(config: &Configuration) -> Result<Service, ServiceError> {
.telemetry_endpoints
.clone()
.filter(|x| !x.is_empty())
.map(|endpoints| -> Result<_, sc_telemetry::Error> {
.map(|endpoints| -> Result<_, pezsc_telemetry::Error> {
let worker = TelemetryWorker::new(16)?;
let telemetry = worker.handle().new_telemetry(endpoints);
Ok((worker, telemetry))
})
.transpose()?;
let executor = sc_service::new_wasm_executor(&config);
let executor = pezsc_service::new_wasm_executor(&config.executor);
let (client, backend, keystore_container, task_manager) =
sc_service::new_full_parts::<Block, RuntimeApi, _>(
pezsc_service::new_full_parts::<Block, RuntimeApi, _>(
config,
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
executor,
@@ -76,23 +75,26 @@ pub fn new_partial(config: &Configuration) -> Result<Service, ServiceError> {
telemetry
});
let select_chain = sc_consensus::LongestChain::new(backend.clone());
let select_chain = pezsc_consensus::LongestChain::new(backend.clone());
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 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 import_queue = sc_consensus_manual_seal::import_queue(
let import_queue = pezsc_consensus_manual_seal::import_queue(
Box::new(client.clone()),
&task_manager.spawn_essential_handle(),
config.prometheus_registry(),
);
Ok(sc_service::PartialComponents {
Ok(pezsc_service::PartialComponents {
client,
backend,
task_manager,
@@ -105,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: sc_network::NetworkBackend<Block, <Block as BlockT>::Hash>>(
pub fn new_full<Network: pezsc_network::NetworkBackend<Block, <Block as BlockT>::Hash>>(
config: Configuration,
consensus: Consensus,
) -> Result<TaskManager, ServiceError> {
let sc_service::PartialComponents {
let pezsc_service::PartialComponents {
client,
backend,
mut task_manager,
@@ -120,34 +122,35 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
other: mut telemetry,
} = new_partial(&config)?;
let net_config = sc_network::config::FullNetworkConfiguration::<
let net_config = pezsc_network::config::FullNetworkConfiguration::<
Block,
<Block as BlockT>::Hash,
Network,
>::new(&config.network);
>::new(
&config.network,
config.prometheus_config.as_ref().map(|cfg| cfg.registry.clone()),
);
let metrics = Network::register_notification_metrics(
config.prometheus_config.as_ref().map(|cfg| &cfg.registry),
);
let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) =
sc_service::build_network(sc_service::BuildNetworkParams {
let (network, system_rpc_tx, tx_handler_controller, sync_service) =
pezsc_service::build_network(pezsc_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_params: None,
warp_sync_config: None,
block_relay: None,
metrics,
})?;
if config.offchain_worker.enabled {
task_manager.spawn_handle().spawn(
"offchain-workers-runner",
"offchain-worker",
sc_offchain::OffchainWorkers::new(sc_offchain::OffchainWorkerOptions {
let offchain_workers =
pezsc_offchain::OffchainWorkers::new(pezsc_offchain::OffchainWorkerOptions {
runtime_api_provider: client.clone(),
is_validator: config.role.is_authority(),
keystore: Some(keystore_container.keystore()),
@@ -158,9 +161,11 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
network_provider: Arc::new(network.clone()),
enable_http_requests: true,
custom_extensions: |_| vec![],
})
.run(client.clone(), task_manager.spawn_handle())
.boxed(),
})?;
task_manager.spawn_handle().spawn(
"offchain-workers-runner",
"offchain-worker",
offchain_workers.run(client.clone(), task_manager.spawn_handle()).boxed(),
);
}
@@ -168,16 +173,15 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
let client = client.clone();
let pool = transaction_pool.clone();
Box::new(move |deny_unsafe, _| {
let deps =
crate::rpc::FullDeps { client: client.clone(), pool: pool.clone(), deny_unsafe };
Box::new(move |_| {
let deps = crate::rpc::FullDeps { client: client.clone(), pool: pool.clone() };
crate::rpc::create_full(deps).map_err(Into::into)
})
};
let prometheus_registry = config.prometheus_registry().cloned();
let _rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams {
let _rpc_handlers = pezsc_service::spawn_tasks(pezsc_service::SpawnTasksParams {
network,
client: client.clone(),
keystore: keystore_container.keystore(),
@@ -190,9 +194,10 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
sync_service,
config,
telemetry: telemetry.as_mut(),
tracing_execute_block: None,
})?;
let proposer = sc_basic_authorship::ProposerFactory::new(
let proposer = pezsc_basic_authorship::ProposerFactory::new(
task_manager.spawn_handle(),
client.clone(),
transaction_pool.clone(),
@@ -202,7 +207,7 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
match consensus {
Consensus::InstantSeal => {
let params = sc_consensus_manual_seal::InstantSealParams {
let params = pezsc_consensus_manual_seal::InstantSealParams {
block_import: client.clone(),
env: proposer,
client,
@@ -210,11 +215,11 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
select_chain,
consensus_data_provider: None,
create_inherent_data_providers: move |_, ()| async move {
Ok(sp_timestamp::InherentDataProvider::from_system_time())
Ok(pezkuwi_sdk::pezsp_timestamp::InherentDataProvider::from_system_time())
},
};
let authorship_future = sc_consensus_manual_seal::run_instant_seal(params);
let authorship_future = pezsc_consensus_manual_seal::run_instant_seal(params);
task_manager.spawn_essential_handle().spawn_blocking(
"instant-seal",
@@ -227,7 +232,7 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
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(sc_consensus_manual_seal::EngineCommand::SealNewBlock {
sink.try_send(pezsc_consensus_manual_seal::EngineCommand::SealNewBlock {
create_empty: true,
finalize: true,
parent_hash: None,
@@ -237,7 +242,7 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
}
});
let params = sc_consensus_manual_seal::ManualSealParams {
let params = pezsc_consensus_manual_seal::ManualSealParams {
block_import: client.clone(),
env: proposer,
client,
@@ -246,10 +251,10 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
commands_stream: Box::pin(commands_stream),
consensus_data_provider: None,
create_inherent_data_providers: move |_, ()| async move {
Ok(sp_timestamp::InherentDataProvider::from_system_time())
Ok(pezkuwi_sdk::pezsp_timestamp::InherentDataProvider::from_system_time())
},
};
let authorship_future = sc_consensus_manual_seal::run_manual_seal(params);
let authorship_future = pezsc_consensus_manual_seal::run_manual_seal(params);
task_manager.spawn_essential_handle().spawn_blocking(
"manual-seal",
@@ -257,8 +262,8 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
authorship_future,
);
},
_ => {},
}
network_starter.start_network();
Ok(task_manager)
}
-30
View File
@@ -1,30 +0,0 @@
[package]
name = "pallet-minimal-template"
description = "A minimal pallet built with FRAME, part of Polkadot Sdk. (polkadot v1.12.0)"
version = "0.1.0"
license = "MIT-0"
authors.workspace = true
homepage.workspace = true
repository.workspace = true
edition.workspace = true
publish = false
[lints]
workspace = true
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", features = [
"derive",
], default-features = false }
scale-info = { version = "2.11.1", default-features = false, features = [
"derive",
] }
frame = { version = "0.3.0", package = "polkadot-sdk-frame", default-features = false, features = ["experimental", "runtime"] }
[features]
default = ["std"]
std = ["codec/std", "frame/std", "scale-info/std"]
-19
View File
@@ -1,19 +0,0 @@
//! A shell pallet built with [`frame`].
#![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>(_);
}
+13
View File
@@ -0,0 +1,13 @@
# Pallets
️ A pallet is a unit of encapsulated logic, with a clearly defined responsibility. A pallet is analogous to a
module in the runtime.
💁 In this template, there is a simple custom pallet based on the FRAME framework.
👉 Learn more about FRAME
[here](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/polkadot_sdk/frame_runtime/index.html).
🧑‍🏫 Please refer to
[this guide](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/guides/your_first_pallet/index.html)
to learn how to write a basic pallet.
+23
View File
@@ -0,0 +1,23 @@
[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"]
+26
View File
@@ -0,0 +1,26 @@
//! A shell pezpallet built with [`frame`].
//!
//! To get started with this pezpallet, try implementing the guide in
//! <https://docs.pezkuwichain.io/sdk/master/polkadot_sdk_docs/guides/your_first_pallet/index.html>
#![cfg_attr(not(feature = "std"), no_std)]
use frame::prelude::*;
use pezkuwi_sdk::pezkuwi_sdk_frame as frame;
// Re-export all pezpallet parts, this is needed to properly import the pezpallet into the runtime.
pub use pezpallet::*;
#[frame::pezpallet]
pub mod pezpallet {
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>;
}
+13 -41
View File
@@ -1,58 +1,30 @@
[package]
name = "minimal-template-runtime"
description = "A solochain runtime template built with Substrate, part of Polkadot Sdk. (polkadot v1.12.0)"
name = "pez-minimal-template-runtime"
description = "A solochain runtime template built with Bizinikiwi, part of Pezkuwi SDK."
version = "0.1.0"
license = "MIT-0"
license = "Unlicense"
authors.workspace = true
homepage.workspace = true
repository.workspace = true
edition.workspace = true
publish = false
[lints]
workspace = true
[dependencies]
parity-scale-codec = { version = "3.0.0", default-features = false }
scale-info = { version = "2.6.0", default-features = false }
# this is a frame-based runtime, thus importing `frame` with runtime feature enabled.
frame = { version = "0.3.0", package = "polkadot-sdk-frame", default-features = false, features = ["experimental", "runtime"] }
# pallets that we want to use
pallet-balances = { version = "35.0.0", default-features = false }
pallet-sudo = { version = "34.0.0", default-features = false }
pallet-timestamp = { version = "33.0.0", default-features = false }
pallet-transaction-payment = { version = "34.0.0", default-features = false }
pallet-transaction-payment-rpc-runtime-api = { version = "34.0.0", default-features = false }
# genesis builder that allows us to interact with runtime genesis config
sp-genesis-builder = { version = "0.13.0", default-features = false }
sp-runtime = { version = "37.0.0", default-features = false, features = ["serde"] }
# local pallet templates
pallet-minimal-template = { path = "../pallets/template", default-features = false, version = "0.1.0" }
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"] }
[build-dependencies]
substrate-wasm-builder = { version = "22.0.0", optional = true }
pezkuwi-sdk = { optional = true, workspace = true, features = ["bizinikiwi-wasm-builder"] }
[features]
default = ["std"]
std = [
"parity-scale-codec/std",
"codec/std",
"pezpallet-minimal-template/std",
"pezkuwi-sdk/std",
"scale-info/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",
"serde_json/std",
]
+10
View File
@@ -0,0 +1,10 @@
# Runtime
️ The runtime (in other words, a state transition function), refers to the core logic of the blockchain that is
responsible for validating blocks and executing the state changes they define.
💁 The runtime in this template is constructed using ready-made FRAME pallets that ship with
[Pezkuwi SDK](https://github.com/pezkuwichain/pezkuwi-sdk), and a [template for a custom pallet](../pezpallets/README.md).
👉 Learn more about PEZFRAME
[here](https://docs.pezkuwichain.io/pezkuwi-sdk/master/pezkuwi_sdk_docs/pezkuwi_sdk/pezframe_runtime/index.html).
+2 -17
View File
@@ -1,23 +1,8 @@
// 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.
//! Build script for pez-minimal-template-runtime.
fn main() {
#[cfg(feature = "std")]
{
substrate_wasm_builder::WasmBuilder::build_using_defaults();
pezkuwi_sdk::bizinikiwi_wasm_builder::WasmBuilder::build_using_defaults();
}
}
+140 -88
View File
@@ -1,4 +1,4 @@
// This file is part of Substrate.
// This file is part of Bizinikiwi.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
@@ -15,7 +15,7 @@
// 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`).
//! A minimal runtime that includes the template [`pezpallet`](`pezpallet_minimal_template`).
#![cfg_attr(not(feature = "std"), no_std)]
@@ -23,33 +23,74 @@
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
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::*,
extern crate alloc;
use alloc::vec::Vec;
use pezkuwi_sdk::{
pezkuwi_sdk_frame::{
self as frame,
deps::pezsp_genesis_builder,
runtime::{apis, prelude::*},
},
*,
};
use pezpallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo};
/// Provides getters for genesis configuration presets.
pub mod genesis_config_presets {
use super::*;
use crate::{
interface::{Balance, MinimumBalance},
BalancesConfig, RuntimeGenesisConfig, SudoConfig,
};
use frame::deps::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: create_runtime_str!("minimal-template-runtime"),
impl_name: create_runtime_str!("minimal-template-runtime"),
spec_name: alloc::borrow::Cow::Borrowed("pez-minimal-template-runtime"),
impl_name: alloc::borrow::Cow::Borrowed("pez-minimal-template-runtime"),
authoring_version: 1,
spec_version: 0,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
state_version: 1,
system_version: 1,
};
/// The version information used to identify this runtime when compiled natively.
@@ -58,29 +99,35 @@ pub fn native_version() -> NativeVersion {
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
}
/// The signed extensions that are added to the runtime.
type SignedExtra = (
/// The transaction extensions that are added to the runtime.
type TxExtension = (
// Authorize calls that validate themselves.
pezframe_system::AuthorizeCall<Runtime>,
// Checks that the sender is not the zero address.
frame_system::CheckNonZeroSender<Runtime>,
pezframe_system::CheckNonZeroSender<Runtime>,
// Checks that the runtime version is correct.
frame_system::CheckSpecVersion<Runtime>,
pezframe_system::CheckSpecVersion<Runtime>,
// Checks that the transaction version is correct.
frame_system::CheckTxVersion<Runtime>,
pezframe_system::CheckTxVersion<Runtime>,
// Checks that the genesis hash is correct.
frame_system::CheckGenesis<Runtime>,
pezframe_system::CheckGenesis<Runtime>,
// Checks that the era is valid.
frame_system::CheckEra<Runtime>,
pezframe_system::CheckEra<Runtime>,
// Checks that the nonce is valid.
frame_system::CheckNonce<Runtime>,
pezframe_system::CheckNonce<Runtime>,
// Checks that the weight is valid.
frame_system::CheckWeight<Runtime>,
pezframe_system::CheckWeight<Runtime>,
// Ensures that the sender has enough funds to pay for the transaction
// and deducts the fee from the sender's account.
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
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
pezframe_system::WeightReclaim<Runtime>,
);
// Composes the runtime by adding all the used pallets and deriving necessary types.
#[runtime]
#[frame_construct_runtime]
mod runtime {
/// The main runtime type.
#[runtime::runtime]
@@ -93,82 +140,87 @@ mod runtime {
RuntimeHoldReason,
RuntimeSlashReason,
RuntimeLockId,
RuntimeTask
RuntimeTask,
RuntimeViewFunction
)]
pub struct Runtime;
/// Mandatory system pallet that should always be included in a FRAME runtime.
#[runtime::pallet_index(0)]
pub type System = frame_system;
/// Mandatory system pezpallet that should always be included in a FRAME runtime.
#[runtime::pezpallet_index(0)]
pub type System = pezframe_system::Pezpallet<Runtime>;
/// Provides a way for consensus systems to set and check the onchain time.
#[runtime::pallet_index(1)]
pub type Timestamp = pallet_timestamp;
#[runtime::pezpallet_index(1)]
pub type Timestamp = pezpallet_timestamp::Pezpallet<Runtime>;
/// Provides the ability to keep track of balances.
#[runtime::pallet_index(2)]
pub type Balances = pallet_balances;
#[runtime::pezpallet_index(2)]
pub type Balances = pezpallet_balances::Pezpallet<Runtime>;
/// Provides a way to execute privileged functions.
#[runtime::pallet_index(3)]
pub type Sudo = pallet_sudo;
#[runtime::pezpallet_index(3)]
pub type Sudo = pezpallet_sudo::Pezpallet<Runtime>;
/// Provides the ability to charge for extrinsic execution.
#[runtime::pallet_index(4)]
pub type TransactionPayment = pallet_transaction_payment;
#[runtime::pezpallet_index(4)]
pub type TransactionPayment = pezpallet_transaction_payment::Pezpallet<Runtime>;
/// A minimal pallet template.
#[runtime::pallet_index(5)]
pub type Template = pallet_minimal_template;
/// A minimal pezpallet template.
#[runtime::pezpallet_index(5)]
pub type Template = pezpallet_minimal_template::Pezpallet<Runtime>;
}
parameter_types! {
pub const Version: RuntimeVersion = VERSION;
}
/// Implements the types required for the system pallet.
#[derive_impl(frame_system::config_preludes::SolochainDefaultConfig)]
impl frame_system::Config for Runtime {
/// Implements the types required for the system pezpallet.
#[derive_impl(pezframe_system::config_preludes::SolochainDefaultConfig)]
impl pezframe_system::Config for Runtime {
type Block = Block;
type Version = Version;
// Use the account data from the balances pallet
type AccountData = pallet_balances::AccountData<<Runtime as pallet_balances::Config>::Balance>;
// Use the account data from the balances pezpallet
type AccountData =
pezpallet_balances::AccountData<<Runtime as pezpallet_balances::Config>::Balance>;
}
// Implements the types required for the balances pallet.
#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for Runtime {
// Implements the types required for the balances pezpallet.
#[derive_impl(pezpallet_balances::config_preludes::TestDefaultConfig)]
impl pezpallet_balances::Config for Runtime {
type AccountStore = System;
}
// 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 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_timestamp::config_preludes::TestDefaultConfig)]
impl pallet_timestamp::Config for Runtime {}
// Implements the types required for the sudo pezpallet.
#[derive_impl(pezpallet_timestamp::config_preludes::TestDefaultConfig)]
impl pezpallet_timestamp::Config for Runtime {}
// 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, ()>;
// 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, ()>;
// Setting fee as independent of the weight of the extrinsic for demo purposes
type WeightToFee = NoFee<<Self as pallet_balances::Config>::Balance>;
type WeightToFee = NoFee<<Self as pezpallet_balances::Config>::Balance>;
// Setting fee as fixed for any length of the call data for demo purposes
type LengthToFee = FixedFee<1, <Self as pallet_balances::Config>::Balance>;
type LengthToFee = FixedFee<1, <Self as pezpallet_balances::Config>::Balance>;
}
// Implements the types required for the template pallet.
impl pallet_minimal_template::Config for Runtime {}
// Implements the types required for the template pezpallet.
impl pezpallet_minimal_template::Config for Runtime {}
type Block = frame::runtime::types_common::BlockOf<Runtime, SignedExtra>;
type Block = frame::runtime::types_common::BlockOf<Runtime, TxExtension>;
type Header = HeaderFor<Runtime>;
type RuntimeExecutive =
Executive<Runtime, Block, frame_system::ChainContext<Runtime>, Runtime, AllPalletsWithSystem>;
use pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo};
type RuntimeExecutive = Executive<
Runtime,
Block,
pezframe_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
>;
impl_runtime_apis! {
impl apis::Core<Block> for Runtime {
@@ -176,7 +228,7 @@ impl_runtime_apis! {
VERSION
}
fn execute_block(block: Block) {
fn execute_block(block: <Block as frame::traits::Block>::LazyBlock) {
RuntimeExecutive::execute_block(block)
}
@@ -212,7 +264,7 @@ impl_runtime_apis! {
}
fn check_inherents(
block: Block,
block: <Block as frame::traits::Block>::LazyBlock,
data: InherentData,
) -> CheckInherentsResult {
data.check_extrinsics(&block)
@@ -223,7 +275,7 @@ impl_runtime_apis! {
fn validate_transaction(
source: TransactionSource,
tx: ExtrinsicFor<Runtime>,
block_hash: <Runtime as frame_system::Config>::Hash,
block_hash: <Runtime as pezframe_system::Config>::Hash,
) -> TransactionValidity {
RuntimeExecutive::validate_transaction(source, tx, block_hash)
}
@@ -253,7 +305,7 @@ impl_runtime_apis! {
}
}
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<
impl pezpallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<
Block,
interface::Balance,
> for Runtime {
@@ -271,17 +323,17 @@ impl_runtime_apis! {
}
}
impl sp_genesis_builder::GenesisBuilder<Block> for Runtime {
fn build_state(config: Vec<u8>) -> sp_genesis_builder::Result {
impl apis::GenesisBuilder<Block> for Runtime {
fn build_state(config: Vec<u8>) -> pezsp_genesis_builder::Result {
build_state::<RuntimeGenesisConfig>(config)
}
fn get_preset(id: &Option<sp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
get_preset::<RuntimeGenesisConfig>(id, |_| None)
fn get_preset(id: &Option<PresetId>) -> Option<Vec<u8>> {
get_preset::<RuntimeGenesisConfig>(id, self::genesis_config_presets::get_preset)
}
fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
vec![]
fn preset_names() -> Vec<PresetId> {
self::genesis_config_presets::preset_names()
}
}
}
@@ -290,16 +342,16 @@ impl_runtime_apis! {
///
/// Other types should preferably be private.
// TODO: this should be standardized in some way, see:
// https://github.com/paritytech/substrate/issues/10579#issuecomment-1600537558
// https://github.com/pezkuwichain/pezkuwi-sdk/issues/3
pub mod interface {
use super::Runtime;
use frame::deps::frame_system;
use pezkuwi_sdk::{pezkuwi_sdk_frame as frame, *};
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 pallet_balances::Config>::Balance;
pub type MinimumBalance = <Runtime as pallet_balances::Config>::ExistentialDeposit;
pub type AccountId = <Runtime as pezframe_system::Config>::AccountId;
pub type Nonce = <Runtime as pezframe_system::Config>::Nonce;
pub type Hash = <Runtime as pezframe_system::Config>::Hash;
pub type Balance = <Runtime as pezpallet_balances::Config>::Balance;
pub type MinimumBalance = <Runtime as pezpallet_balances::Config>::ExistentialDeposit;
}
-75
View File
@@ -1,75 +0,0 @@
//! # 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
@@ -0,0 +1,9 @@
[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
@@ -0,0 +1,30 @@
# 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