Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5,039 changes: 2,671 additions & 2,368 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ docify = { version = "0.2.9" }
futures = { version = "0.3.31" }
futures-timer = { version = "3.0.2" }
jsonrpsee = { version = "0.24.3" }
polkadot-sdk = { version = "0.12.2", default-features = false }
polkadot-sdk = { version = "2503.0.1", default-features = false }
codec = { version = "3.7.4", 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 }
codec = { version = "3.6.12", default-features = false, package = "parity-scale-codec" }
scale-info = { version = "2.11.1", default-features = false }
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ such as a [Balances pallet](https://paritytech.github.io/polkadot-sdk/master/pal

- 👤 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:
Expand All @@ -61,7 +62,7 @@ compiled unless building the entire workspace).
- 🛠️ 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:
Fetch minimal template code.

```sh
git clone https://github.com/paritytech/polkadot-sdk-minimal-template.git minimal-template
Expand Down Expand Up @@ -147,11 +148,13 @@ docker run --rm polkadot-sdk-minimal-template
We can install `zombienet` as described [here](https://paritytech.github.io/zombienet/install.html#installation),
and `zombienet-omni-node.toml` contains the network specification we want to start.


#### Update `zombienet-omni-node.toml` with a valid chain spec path

Before starting the network with zombienet we must update the network specification
with a valid chain spec path. If we need to generate one, we can look up at the previous
section for chain spec creation [here](#use-chain-spec-builder-to-generate-the-chain_specjson-file).
To simplify the process of starting the minimal template with ZombieNet and Omni Node, we've included a
pre-configured development chain spec (dev_chain_spec.json) in the minimal template. The zombienet-omni-node.toml
file in this template points to it, but you can update it to a new path for the chain spec generated on your machine.
To generate a chain spec refer to [staging-chain-spec-builder](https://crates.io/crates/staging-chain-spec-builder)

Then make the changes in the network specification like so:

Expand Down Expand Up @@ -210,10 +213,12 @@ Previously minimal template's development chains:

## Getting Help

- 🧑‍🏫 To learn about Polkadot in general, [Polkadot.network](https://polkadot.network/) website is a good starting point.
- 🧑‍🏫 To learn about Polkadot in general, [docs.Polkadot.com](https://docs.polkadot.com/) 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/).
- 👥You can also reach out on the [Official Polkdot discord server](https://polkadot-discord.w3f.tools/)
- 🧑Reach out on [Telegram](https://t.me/substratedevs) for more questions and discussions
85 changes: 85 additions & 0 deletions dev_chain_spec.json

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ build = "build.rs"
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
docify = { workspace = true }
clap = { features = ["derive"], workspace = true }
docify = { workspace = true }
futures = { features = ["thread-pool"], workspace = true }
futures-timer = { workspace = true }
jsonrpsee = { features = ["server"], workspace = true }
serde_json = { workspace = true, default-features = true }
polkadot-sdk = { workspace = true, features = ["experimental", "node"] }
minimal-template-runtime.workspace = true
polkadot-sdk = { workspace = true, features = ["experimental", "node"] }

[build-dependencies]
polkadot-sdk = { workspace = true, features = ["substrate-build-script-utils"] }
Expand Down
5 changes: 0 additions & 5 deletions node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,3 @@
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.


## Release

Polkadot SDK Stable 2412
3 changes: 1 addition & 2 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
config.prometheus_config.as_ref().map(|cfg| &cfg.registry),
);

let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) =
let (network, system_rpc_tx, tx_handler_controller, sync_service) =
sc_service::build_network(sc_service::BuildNetworkParams {
config: &config,
net_config,
Expand Down Expand Up @@ -264,6 +264,5 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
_ => {},
}

network_starter.start_network();
Ok(task_manager)
}
2 changes: 1 addition & 1 deletion pallets/template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
codec = { features = ["derive"], workspace = true }
scale-info = { features = ["derive"], workspace = true }
polkadot-sdk = { workspace = true, features = ["experimental", "runtime"], default-features = false }
scale-info = { features = ["derive"], workspace = true }


[features]
Expand Down
5 changes: 0 additions & 5 deletions pallets/template/README.md

This file was deleted.

4 changes: 2 additions & 2 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ publish = false

[dependencies]
codec = { workspace = true }
scale-info = { workspace = true }
pallet-minimal-template.workspace = true
polkadot-sdk = { workspace = true, features = ["pallet-balances", "pallet-sudo", "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "runtime"] }
scale-info = { workspace = true }
serde_json = { workspace = true, default-features = false, features = ["alloc"] }
pallet-minimal-template.workspace = true

[build-dependencies]
polkadot-sdk = { optional = true, workspace = true, features = ["substrate-wasm-builder"] }
Expand Down
5 changes: 0 additions & 5 deletions runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,3 @@ responsible for validating blocks and executing the state changes they define.

👉 Learn more about FRAME
[here](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/polkadot_sdk/frame_runtime/index.html).


## Release

Polkadot SDK Stable 2412
20 changes: 11 additions & 9 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub mod genesis_config_presets {
use super::*;
use crate::{
interface::{Balance, MinimumBalance},
sp_keyring::AccountKeyring,
sp_keyring::Sr25519Keyring,
BalancesConfig, RuntimeGenesisConfig, SudoConfig,
};

Expand All @@ -51,17 +51,14 @@ pub mod genesis_config_presets {
/// Returns a development genesis config preset.
pub fn development_config_genesis() -> Value {
let endowment = <MinimumBalance as Get<Balance>>::get().max(1) * 1000;
let config = RuntimeGenesisConfig {
frame_support::build_struct_json_patch!(RuntimeGenesisConfig {
balances: BalancesConfig {
balances: AccountKeyring::iter()
balances: Sr25519Keyring::iter()
.map(|a| (a.to_account_id(), endowment))
.collect::<Vec<_>>(),
},
sudo: SudoConfig { key: Some(AccountKeyring::Alice.to_account_id()) },
..Default::default()
};

serde_json::to_value(config).expect("Could not build genesis config.")
sudo: SudoConfig { key: Some(Sr25519Keyring::Alice.to_account_id()) },
})
}

/// Get the set of the available genesis config presets.
Expand Down Expand Up @@ -121,6 +118,10 @@ type TxExtension = (
// 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>,
// Reclaim the unused weight from the block using post dispatch information.
// It must be last in the pipeline in order to catch the refund in previous transaction
// extensions
frame_system::WeightReclaim<Runtime>,
);

// Composes the runtime by adding all the used pallets and deriving necessary types.
Expand All @@ -137,7 +138,8 @@ mod runtime {
RuntimeHoldReason,
RuntimeSlashReason,
RuntimeLockId,
RuntimeTask
RuntimeTask,
RuntimeViewFunction
)]
pub struct Runtime;

Expand Down
4 changes: 2 additions & 2 deletions zombienet-omni-node.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[relaychain]
default_command = "polkadot-omni-node"
chain = "dev"
chain_spec_path = "<path/to/chain_spec.json>"
default_args = ["--dev"]
chain_spec_path = "./dev_chain_spec.json"
default_args = ["--dev-block-time 3000"]

[[relaychain.nodes]]
name = "alice"
Expand Down