mirror of
https://github.com/pezkuwichain/pez-minimal-template.git
synced 2026-04-21 22:38:00 +00:00
Update to 1.13.0 triggered by workflow_dispatch
This commit is contained in:
Generated
+481
-517
File diff suppressed because it is too large
Load Diff
-41
@@ -13,46 +13,5 @@ members = [
|
||||
]
|
||||
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" }
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
FROM docker.io/paritytech/ci-unified:latest as builder
|
||||
|
||||
WORKDIR /polkadot
|
||||
COPY . /polkadot
|
||||
|
||||
RUN cargo fetch
|
||||
RUN cargo build --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"]
|
||||
@@ -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>
|
||||
@@ -1,13 +1,100 @@
|
||||
# Minimal Template
|
||||
<div align="center">
|
||||
|
||||
This is a minimal template for creating a blockchain using the Polkadot SDK.
|
||||
# Polkadot SDK's Minimal Template
|
||||
|
||||
# Docs
|
||||
<img height="70px" alt="Polkadot SDK Logo" src="https://github.com/paritytech/polkadot-sdk/raw/master/docs/images/Polkadot_Logo_Horizontal_Pink_White.png#gh-dark-mode-only"/>
|
||||
<img height="70px" alt="Polkadot SDK Logo" src="https://github.com/paritytech/polkadot-sdk/raw/master/docs/images/Polkadot_Logo_Horizontal_Pink_Black.png#gh-light-mode-only"/>
|
||||
|
||||
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 Polkadot SDK.
|
||||
>
|
||||
> This template is automatically updated after releases in the main [Polkadot SDK monorepo](https://github.com/paritytech/polkadot-sdk).
|
||||
|
||||
</div>
|
||||
|
||||
🤏 This template is a minimal (in terms of complexity and the number of components) template for building a blockchain node.
|
||||
|
||||
🔧 Its runtime is configured of 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.
|
||||
|
||||
## Template Structure
|
||||
|
||||
A Polkadot SDK based project such as this one consists of:
|
||||
|
||||
* 💿 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.
|
||||
|
||||
👉 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.
|
||||
|
||||
### Build
|
||||
|
||||
🔨 Use the following command to build the node without launching it:
|
||||
|
||||
```sh
|
||||
cargo doc -p minimal-template --open
|
||||
cargo build --release
|
||||
```
|
||||
|
||||
🐳 Alternatively, build the docker image:
|
||||
|
||||
```sh
|
||||
docker build . -t polkadot-sdk-minimal-template
|
||||
```
|
||||
|
||||
### Single-Node Development Chain
|
||||
|
||||
👤 The following command starts a single-node development chain:
|
||||
|
||||
```sh
|
||||
./target/release/minimal-template-node --dev
|
||||
|
||||
# docker version:
|
||||
docker run --rm polkadot-sdk-minimal-template --dev
|
||||
```
|
||||
|
||||
Development chains:
|
||||
|
||||
* 🧹 Do not persist the state.
|
||||
* 💰 Are preconfigured with a genesis state that includes several prefunded development accounts.
|
||||
* 🧑⚖️ Development accounts are used as `sudo` accounts.
|
||||
|
||||
### Connect with the Polkadot-JS Apps Front-End
|
||||
|
||||
🌐 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
|
||||
available on [IPFS](https://dotapps.io/).
|
||||
|
||||
🧑🔧 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.
|
||||
|
||||
## Contributing
|
||||
|
||||
🔄 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).
|
||||
|
||||
😇 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, [Polkadot.network](https://polkadot.network/) website is a good starting point.
|
||||
|
||||
🧑🔧 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
|
||||
[Substrate StackExchange](https://substrate.stackexchange.com/).
|
||||
|
||||
+24
-27
@@ -1,8 +1,8 @@
|
||||
[package]
|
||||
name = "minimal-template-node"
|
||||
description = "A minimal Substrate-based Substrate node, ready for hacking. (polkadot v1.12.0)"
|
||||
description = "A minimal Substrate-based Substrate node, ready for hacking. (polkadot v1.13.0)"
|
||||
version = "0.1.0"
|
||||
license = "MIT-0"
|
||||
license = "Unlicense"
|
||||
authors.workspace = true
|
||||
homepage.workspace = true
|
||||
repository.workspace = true
|
||||
@@ -10,9 +10,6 @@ edition.workspace = true
|
||||
publish = false
|
||||
build = "build.rs"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
@@ -22,31 +19,31 @@ 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" }
|
||||
sc-cli = { version = "0.43.0" }
|
||||
sc-executor = { version = "0.39.0" }
|
||||
sc-network = { version = "0.41.0" }
|
||||
sc-service = { version = "0.42.0" }
|
||||
sc-telemetry = { version = "21.0.0" }
|
||||
sc-transaction-pool = { version = "35.0.0" }
|
||||
sc-transaction-pool-api = { version = "35.0.0" }
|
||||
sc-consensus = { version = "0.40.0" }
|
||||
sc-consensus-manual-seal = { version = "0.42.0" }
|
||||
sc-rpc-api = { version = "0.40.0" }
|
||||
sc-basic-authorship = { version = "0.41.0" }
|
||||
sc-offchain = { version = "36.0.0" }
|
||||
sc-client-api = { version = "35.0.0" }
|
||||
sp-timestamp = { version = "33.0.0" }
|
||||
sp-keyring = { version = "38.0.0" }
|
||||
sp-api = { version = "33.0.0" }
|
||||
sp-blockchain = { version = "35.0.0" }
|
||||
sp-block-builder = { version = "33.0.0" }
|
||||
sp-io = { version = "37.0.0" }
|
||||
sp-runtime = { version = "38.0.0" }
|
||||
substrate-frame-rpc-system = { version = "35.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"] }
|
||||
frame = { version = "0.4.0", package = "polkadot-sdk-frame", features = ["experimental", "runtime"] }
|
||||
runtime = { package = "minimal-template-runtime", path = "../runtime", version = "0.1.0" }
|
||||
|
||||
[build-dependencies]
|
||||
|
||||
@@ -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.
|
||||
@@ -21,7 +21,7 @@ use serde_json::{json, Value};
|
||||
use sp_keyring::AccountKeyring;
|
||||
|
||||
/// This is a specialization of the general Substrate ChainSpec type.
|
||||
pub type ChainSpec = sc_service::GenericChainSpec<()>;
|
||||
pub type ChainSpec = sc_service::GenericChainSpec;
|
||||
|
||||
fn props() -> Properties {
|
||||
let mut properties = Properties::new();
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ impl std::str::FromStr for Consensus {
|
||||
} else if let Some(block_time) = s.strip_prefix("manual-seal-") {
|
||||
Consensus::ManualSeal(block_time.parse().map_err(|_| "invalid block time")?)
|
||||
} else {
|
||||
return Err("incorrect consensus identifier".into())
|
||||
return Err("incorrect consensus identifier".into());
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ pub fn new_partial(config: &Configuration) -> Result<Service, ServiceError> {
|
||||
})
|
||||
.transpose()?;
|
||||
|
||||
let executor = sc_service::new_wasm_executor(&config);
|
||||
let executor = sc_service::new_wasm_executor(config);
|
||||
|
||||
let (client, backend, keystore_container, task_manager) =
|
||||
sc_service::new_full_parts::<Block, RuntimeApi, _>(
|
||||
|
||||
@@ -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.
|
||||
@@ -1,28 +1,25 @@
|
||||
[package]
|
||||
name = "pallet-minimal-template"
|
||||
description = "A minimal pallet built with FRAME, part of Polkadot Sdk. (polkadot v1.12.0)"
|
||||
description = "A minimal pallet built with FRAME, part of Polkadot Sdk. (polkadot v1.13.0)"
|
||||
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
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", features = [
|
||||
codec = { package = "parity-scale-codec", version = "3.6.12", 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"] }
|
||||
frame = { version = "0.4.0", package = "polkadot-sdk-frame", default-features = false, features = ["experimental", "runtime"] }
|
||||
|
||||
|
||||
[features]
|
||||
|
||||
+13
-16
@@ -1,45 +1,42 @@
|
||||
[package]
|
||||
name = "minimal-template-runtime"
|
||||
description = "A solochain runtime template built with Substrate, part of Polkadot Sdk. (polkadot v1.12.0)"
|
||||
description = "A solochain runtime template built with Substrate, part of Polkadot Sdk. (polkadot v1.13.0)"
|
||||
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 }
|
||||
codec = { package = "parity-scale-codec", version = "3.6.12", 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"] }
|
||||
frame = { version = "0.4.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 }
|
||||
pallet-balances = { version = "36.0.0", default-features = false }
|
||||
pallet-sudo = { version = "35.0.0", default-features = false }
|
||||
pallet-timestamp = { version = "34.0.0", default-features = false }
|
||||
pallet-transaction-payment = { version = "35.0.0", default-features = false }
|
||||
pallet-transaction-payment-rpc-runtime-api = { version = "35.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"] }
|
||||
sp-genesis-builder = { version = "0.14.0", default-features = false }
|
||||
sp-runtime = { version = "38.0.0", default-features = false, features = ["serde"] }
|
||||
|
||||
# local pallet templates
|
||||
pallet-minimal-template = { path = "../pallets/template", default-features = false, version = "0.1.0" }
|
||||
|
||||
[build-dependencies]
|
||||
substrate-wasm-builder = { version = "22.0.0", optional = true }
|
||||
substrate-wasm-builder = { version = "23.0.0", optional = true }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"parity-scale-codec/std",
|
||||
"codec/std",
|
||||
"scale-info/std",
|
||||
|
||||
"frame/std",
|
||||
|
||||
@@ -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
|
||||
[Polkadot SDK](https://github.com/paritytech/polkadot-sdk), and a [template for a custom pallet](../pallets/README.md).
|
||||
|
||||
👉 Learn more about FRAME
|
||||
[here](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/polkadot_sdk/frame_runtime/index.html).
|
||||
Reference in New Issue
Block a user