Skip to content

Commit a9c96aa

Browse files
Update to 1.13.0 triggered by workflow_dispatch
1 parent ce6c1e0 commit a9c96aa

File tree

14 files changed

+712
-618
lines changed

14 files changed

+712
-618
lines changed

Cargo.lock

Lines changed: 481 additions & 517 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -13,46 +13,5 @@ members = [
1313
]
1414
resolver = "2"
1515

16-
[workspace.lints.rust]
17-
suspicious_double_ref_op = { level = "allow", priority = 2 }
18-
19-
[workspace.lints.clippy]
20-
all = { level = "allow", priority = 0 }
21-
correctness = { level = "warn", priority = 1 }
22-
complexity = { level = "warn", priority = 1 }
23-
if-same-then-else = { level = "allow", priority = 2 }
24-
zero-prefixed-literal = { level = "allow", priority = 2 } # 00_1000_000
25-
type_complexity = { level = "allow", priority = 2 } # raison d'etre
26-
nonminimal-bool = { level = "allow", priority = 2 } # maybe
27-
borrowed-box = { level = "allow", priority = 2 } # Reasonable to fix this one
28-
too-many-arguments = { level = "allow", priority = 2 } # (Turning this on would lead to)
29-
needless-lifetimes = { level = "allow", priority = 2 } # generated code
30-
unnecessary_cast = { level = "allow", priority = 2 } # Types may change
31-
identity-op = { level = "allow", priority = 2 } # One case where we do 0 +
32-
useless_conversion = { level = "allow", priority = 2 } # Types may change
33-
unit_arg = { level = "allow", priority = 2 } # stylistic
34-
option-map-unit-fn = { level = "allow", priority = 2 } # stylistic
35-
bind_instead_of_map = { level = "allow", priority = 2 } # stylistic
36-
erasing_op = { level = "allow", priority = 2 } # E.g. 0 * DOLLARS
37-
eq_op = { level = "allow", priority = 2 } # In tests we test equality.
38-
while_immutable_condition = { level = "allow", priority = 2 } # false positives
39-
needless_option_as_deref = { level = "allow", priority = 2 } # false positives
40-
derivable_impls = { level = "allow", priority = 2 } # false positives
41-
stable_sort_primitive = { level = "allow", priority = 2 } # prefer stable sort
42-
extra-unused-type-parameters = { level = "allow", priority = 2 } # stylistic
43-
default_constructed_unit_structs = { level = "allow", priority = 2 } # stylistic
44-
4516
[workspace.dependencies]
46-
polkavm = "0.9.3"
47-
polkavm-linker = "0.9.2"
48-
polkavm-derive = "0.9.1"
49-
log = { version = "0.4.21", default-features = false }
50-
quote = { version = "1.0.33" }
51-
serde = { version = "1.0.197", default-features = false }
52-
serde-big-array = { version = "0.3.2" }
53-
serde_derive = { version = "1.0.117" }
5417
serde_json = { version = "1.0.114", default-features = false }
55-
serde_yaml = { version = "0.9" }
56-
syn = { version = "2.0.53" }
57-
thiserror = { version = "1.0.48" }
58-
tracing-subscriber = { version = "0.3.18" }

Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM docker.io/paritytech/ci-unified:latest as builder
2+
3+
WORKDIR /polkadot
4+
COPY . /polkadot
5+
6+
RUN cargo fetch
7+
RUN cargo build --locked --release
8+
9+
FROM docker.io/parity/base-bin:latest
10+
11+
COPY --from=builder /polkadot/target/release/minimal-template-node /usr/local/bin
12+
13+
USER root
14+
RUN useradd -m -u 1001 -U -s /bin/sh -d /polkadot polkadot && \
15+
mkdir -p /data /polkadot/.local/share && \
16+
chown -R polkadot:polkadot /data && \
17+
ln -s /data /polkadot/.local/share/polkadot && \
18+
# unclutter and minimize the attack surface
19+
rm -rf /usr/bin /usr/sbin && \
20+
# check if executable works in this container
21+
/usr/local/bin/minimal-template-node --version
22+
23+
USER polkadot
24+
25+
EXPOSE 30333 9933 9944 9615
26+
VOLUME ["/data"]
27+
28+
ENTRYPOINT ["/usr/local/bin/minimal-template-node"]

LICENSE

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
This is free and unencumbered software released into the public domain.
2+
3+
Anyone is free to copy, modify, publish, use, compile, sell, or
4+
distribute this software, either in source code form or as a compiled
5+
binary, for any purpose, commercial or non-commercial, and by any
6+
means.
7+
8+
In jurisdictions that recognize copyright laws, the author or authors
9+
of this software dedicate any and all copyright interest in the
10+
software to the public domain. We make this dedication for the benefit
11+
of the public at large and to the detriment of our heirs and
12+
successors. We intend this dedication to be an overt act of
13+
relinquishment in perpetuity of all present and future rights to this
14+
software under copyright law.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.
23+
24+
For more information, please refer to <http://unlicense.org>

README.md

Lines changed: 94 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,100 @@
1-
# Minimal Template
1+
<div align="center">
22

3-
This is a minimal template for creating a blockchain using the Polkadot SDK.
3+
# Polkadot SDK's Minimal Template
44

5-
# Docs
5+
<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"/>
6+
<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"/>
67

7-
You can generate and view the [Rust
8-
Docs](https://doc.rust-lang.org/cargo/commands/cargo-doc.html) for this template
9-
with this command:
8+
> This is a minimal template for creating a blockchain based on Polkadot SDK.
9+
>
10+
> This template is automatically updated after releases in the main [Polkadot SDK monorepo](https://github.com/paritytech/polkadot-sdk).
11+
12+
</div>
13+
14+
🤏 This template is a minimal (in terms of complexity and the number of components) template for building a blockchain node.
15+
16+
🔧 Its runtime is configured of a single custom pallet as a starting point, and a handful of ready-made pallets
17+
such as a [Balances pallet](https://paritytech.github.io/polkadot-sdk/master/pallet_balances/index.html).
18+
19+
👤 The template has no consensus configured - it is best for experimenting with a single node network.
20+
21+
## Template Structure
22+
23+
A Polkadot SDK based project such as this one consists of:
24+
25+
* 💿 a [Node](./node/README.md) - the binary application.
26+
* 🧮 the [Runtime](./runtime/README.md) - the core logic of the blockchain.
27+
* 🎨 the [Pallets](./pallets/README.md) - from which the runtime is constructed.
28+
29+
## Getting Started
30+
31+
🦀 The template is using the Rust language.
32+
33+
👉 Check the
34+
[Rust installation instructions](https://www.rust-lang.org/tools/install) for your system.
35+
36+
🛠️ Depending on your operating system and Rust version, there might be additional
37+
packages required to compile this template - please take note of the Rust compiler output.
38+
39+
### Build
40+
41+
🔨 Use the following command to build the node without launching it:
1042

1143
```sh
12-
cargo doc -p minimal-template --open
44+
cargo build --release
1345
```
46+
47+
🐳 Alternatively, build the docker image:
48+
49+
```sh
50+
docker build . -t polkadot-sdk-minimal-template
51+
```
52+
53+
### Single-Node Development Chain
54+
55+
👤 The following command starts a single-node development chain:
56+
57+
```sh
58+
./target/release/minimal-template-node --dev
59+
60+
# docker version:
61+
docker run --rm polkadot-sdk-minimal-template --dev
62+
```
63+
64+
Development chains:
65+
66+
* 🧹 Do not persist the state.
67+
* 💰 Are preconfigured with a genesis state that includes several prefunded development accounts.
68+
* 🧑‍⚖️ Development accounts are used as `sudo` accounts.
69+
70+
### Connect with the Polkadot-JS Apps Front-End
71+
72+
🌐 You can interact with your local node using the
73+
hosted version of the [Polkadot/Substrate
74+
Portal](https://polkadot.js.org/apps/#/explorer?rpc=ws://localhost:9944).
75+
76+
🪐 A hosted version is also
77+
available on [IPFS](https://dotapps.io/).
78+
79+
🧑‍🔧 You can also find the source code and instructions for hosting your own instance in the
80+
[`polkadot-js/apps`](https://github.com/polkadot-js/apps) repository.
81+
82+
## Contributing
83+
84+
🔄 This template is automatically updated after releases in the main [Polkadot SDK monorepo](https://github.com/paritytech/polkadot-sdk).
85+
86+
➡️ Any pull requests should be directed to this [source](https://github.com/paritytech/polkadot-sdk/tree/master/templates/minimal).
87+
88+
😇 Please refer to the monorepo's
89+
[contribution guidelines](https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/CONTRIBUTING.md) and
90+
[Code of Conduct](https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/CODE_OF_CONDUCT.md).
91+
92+
## Getting Help
93+
94+
🧑‍🏫 To learn about Polkadot in general, [Polkadot.network](https://polkadot.network/) website is a good starting point.
95+
96+
🧑‍🔧 For technical introduction, [here](https://github.com/paritytech/polkadot-sdk#-documentation) are
97+
the Polkadot SDK documentation resources.
98+
99+
👥 Additionally, there are [GitHub issues](https://github.com/paritytech/polkadot-sdk/issues) and
100+
[Substrate StackExchange](https://substrate.stackexchange.com/).

node/Cargo.toml

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
[package]
22
name = "minimal-template-node"
3-
description = "A minimal Substrate-based Substrate node, ready for hacking. (polkadot v1.12.0)"
3+
description = "A minimal Substrate-based Substrate node, ready for hacking. (polkadot v1.13.0)"
44
version = "0.1.0"
5-
license = "MIT-0"
5+
license = "Unlicense"
66
authors.workspace = true
77
homepage.workspace = true
88
repository.workspace = true
99
edition.workspace = true
1010
publish = false
1111
build = "build.rs"
1212

13-
[lints]
14-
workspace = true
15-
1613
[package.metadata.docs.rs]
1714
targets = ["x86_64-unknown-linux-gnu"]
1815

@@ -22,31 +19,31 @@ futures = { version = "0.3.30", features = ["thread-pool"] }
2219
futures-timer = "3.0.1"
2320
jsonrpsee = { version = "0.22", features = ["server"] }
2421
serde_json = { workspace = true, default-features = true }
25-
sc-cli = { version = "0.42.0" }
26-
sc-executor = { version = "0.38.0" }
27-
sc-network = { version = "0.40.0" }
28-
sc-service = { version = "0.41.0" }
29-
sc-telemetry = { version = "20.0.0" }
30-
sc-transaction-pool = { version = "34.0.0" }
31-
sc-transaction-pool-api = { version = "34.0.0" }
32-
sc-consensus = { version = "0.39.1" }
33-
sc-consensus-manual-seal = { version = "0.41.0" }
34-
sc-rpc-api = { version = "0.39.0" }
35-
sc-basic-authorship = { version = "0.40.0" }
36-
sc-offchain = { version = "35.0.0" }
37-
sc-client-api = { version = "34.0.0" }
38-
sp-timestamp = { version = "32.0.0" }
39-
sp-keyring = { version = "37.0.0" }
40-
sp-api = { version = "32.0.0" }
41-
sp-blockchain = { version = "34.0.0" }
42-
sp-block-builder = { version = "32.0.0" }
43-
sp-io = { version = "36.0.0" }
44-
sp-runtime = { version = "37.0.0" }
45-
substrate-frame-rpc-system = { version = "34.0.0" }
22+
sc-cli = { version = "0.43.0" }
23+
sc-executor = { version = "0.39.0" }
24+
sc-network = { version = "0.41.0" }
25+
sc-service = { version = "0.42.0" }
26+
sc-telemetry = { version = "21.0.0" }
27+
sc-transaction-pool = { version = "35.0.0" }
28+
sc-transaction-pool-api = { version = "35.0.0" }
29+
sc-consensus = { version = "0.40.0" }
30+
sc-consensus-manual-seal = { version = "0.42.0" }
31+
sc-rpc-api = { version = "0.40.0" }
32+
sc-basic-authorship = { version = "0.41.0" }
33+
sc-offchain = { version = "36.0.0" }
34+
sc-client-api = { version = "35.0.0" }
35+
sp-timestamp = { version = "33.0.0" }
36+
sp-keyring = { version = "38.0.0" }
37+
sp-api = { version = "33.0.0" }
38+
sp-blockchain = { version = "35.0.0" }
39+
sp-block-builder = { version = "33.0.0" }
40+
sp-io = { version = "37.0.0" }
41+
sp-runtime = { version = "38.0.0" }
42+
substrate-frame-rpc-system = { version = "35.0.0" }
4643

4744
# Once the native runtime is gone, there should be little to no dependency on FRAME here, and
4845
# certainly no dependency on the runtime.
49-
frame = { version = "0.3.0", package = "polkadot-sdk-frame", features = ["experimental", "runtime"] }
46+
frame = { version = "0.4.0", package = "polkadot-sdk-frame", features = ["experimental", "runtime"] }
5047
runtime = { package = "minimal-template-runtime", path = "../runtime", version = "0.1.0" }
5148

5249
[build-dependencies]

node/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Node
2+
3+
ℹ️ A node - in Polkadot - is a binary executable, whose primary purpose is to execute the [runtime](../runtime/README.md).
4+
5+
🔗 It communicates with other nodes in the network, and aims for
6+
[consensus](https://wiki.polkadot.network/docs/learn-consensus) among them.
7+
8+
⚙️ It acts as a remote procedure call (RPC) server, allowing interaction with the blockchain.
9+
10+
👉 Learn more about the architecture, and a difference between a node and a runtime
11+
[here](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/reference_docs/wasm_meta_protocol/index.html).
12+
13+
👇 Here are the most important files in this node template:
14+
15+
- [`chain_spec.rs`](./src/chain_spec.rs): A chain specification is a source code file that defines the chain's
16+
initial (genesis) state.
17+
- [`service.rs`](./src/service.rs): This file defines the node implementation.
18+
It's a place to configure consensus-related topics. In favor of minimalism, this template has no consensus configured.

node/src/chain_spec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use serde_json::{json, Value};
2121
use sp_keyring::AccountKeyring;
2222

2323
/// This is a specialization of the general Substrate ChainSpec type.
24-
pub type ChainSpec = sc_service::GenericChainSpec<()>;
24+
pub type ChainSpec = sc_service::GenericChainSpec;
2525

2626
fn props() -> Properties {
2727
let mut properties = Properties::new();

node/src/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl std::str::FromStr for Consensus {
3232
} else if let Some(block_time) = s.strip_prefix("manual-seal-") {
3333
Consensus::ManualSeal(block_time.parse().map_err(|_| "invalid block time")?)
3434
} else {
35-
return Err("incorrect consensus identifier".into())
35+
return Err("incorrect consensus identifier".into());
3636
})
3737
}
3838
}

node/src/service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub fn new_partial(config: &Configuration) -> Result<Service, ServiceError> {
6161
})
6262
.transpose()?;
6363

64-
let executor = sc_service::new_wasm_executor(&config);
64+
let executor = sc_service::new_wasm_executor(config);
6565

6666
let (client, backend, keystore_container, task_manager) =
6767
sc_service::new_full_parts::<Block, RuntimeApi, _>(

pallets/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Pallets
2+
3+
ℹ️ A pallet is a unit of encapsulated logic, with a clearly defined responsibility. A pallet is analogous to a
4+
module in the runtime.
5+
6+
💁 In this template, there is a simple custom pallet based on the FRAME framework.
7+
8+
👉 Learn more about FRAME
9+
[here](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/polkadot_sdk/frame_runtime/index.html).
10+
11+
🧑‍🏫 Please refer to
12+
[this guide](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/guides/your_first_pallet/index.html)
13+
to learn how to write a basic pallet.

pallets/template/Cargo.toml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
11
[package]
22
name = "pallet-minimal-template"
3-
description = "A minimal pallet built with FRAME, part of Polkadot Sdk. (polkadot v1.12.0)"
3+
description = "A minimal pallet built with FRAME, part of Polkadot Sdk. (polkadot v1.13.0)"
44
version = "0.1.0"
5-
license = "MIT-0"
5+
license = "Unlicense"
66
authors.workspace = true
77
homepage.workspace = true
88
repository.workspace = true
99
edition.workspace = true
1010
publish = false
1111

12-
[lints]
13-
workspace = true
14-
1512
[package.metadata.docs.rs]
1613
targets = ["x86_64-unknown-linux-gnu"]
1714

1815
[dependencies]
19-
codec = { package = "parity-scale-codec", version = "3.0.0", features = [
16+
codec = { package = "parity-scale-codec", version = "3.6.12", features = [
2017
"derive",
2118
], default-features = false }
2219
scale-info = { version = "2.11.1", default-features = false, features = [
2320
"derive",
2421
] }
25-
frame = { version = "0.3.0", package = "polkadot-sdk-frame", default-features = false, features = ["experimental", "runtime"] }
22+
frame = { version = "0.4.0", package = "polkadot-sdk-frame", default-features = false, features = ["experimental", "runtime"] }
2623

2724

2825
[features]

0 commit comments

Comments
 (0)