From 68752b54c16ef2705bb4edc337863ff0a35a92cc Mon Sep 17 00:00:00 2001 From: hippiestank <150185429+hippiestank@users.noreply.github.com> Date: Mon, 17 Jun 2024 13:36:16 -0600 Subject: [PATCH 1/9] Update authorize-specific-nodes.md Updated dependencies to reflect Polkadot-SDK and modern Node Template construct_runtime macro --- .../authorize-specific-nodes.md | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md b/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md index 415c63ec8..18a77ca32 100644 --- a/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md +++ b/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md @@ -131,7 +131,7 @@ To add the `node-authorization` pallet to the Substrate runtime: ```toml [dependencies] - pallet-node-authorization = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } + pallet-node-authorization = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.9.0", default-features = false } ``` This line imports the `pallet-node-authorization` crate as a dependency and specifies the following configuration details for the crate: @@ -225,16 +225,31 @@ To implement the `node-authorization` pallet in your runtime: 1. Add the pallet to the `construct_runtime` macro with the following line of code: ```rust - construct_runtime!( - pub enum Runtime where - Block = Block, - NodeBlock = opaque::Block, - UncheckedExtrinsic = UncheckedExtrinsic - { - /*** Add This Line ***/ - NodeAuthorization: pallet_node_authorization::{Pallet, Call, Storage, Event, Config}, - } - ); + #[frame_support::runtime] + mod runtime { + #[runtime::runtime] + #[runtime::derive( + RuntimeCall, + RuntimeEvent, + RuntimeError, + RuntimeOrigin, + RuntimeFreezeReason, + RuntimeHoldReason, + RuntimeSlashReason, + RuntimeLockId, + RuntimeTask + )] + pub struct Runtime; + + #[runtime::pallet_index(0)] + pub type System = frame_system; + + --snip-- + + /*** Add This Line ***/ + #[runtime::pallet_index(8)] + pub type NodeAuthorization: pallet_node_authorization; +} ``` 1. Save your changes and close the file. From b2fb4f0726f800e662fb6582ffcfb93b04e49c51 Mon Sep 17 00:00:00 2001 From: hippiestank <150185429+hippiestank@users.noreply.github.com> Date: Mon, 17 Jun 2024 13:51:35 -0600 Subject: [PATCH 2/9] Update authorize-specific-nodes.md Fixed formatting --- .../authorize-specific-nodes.md | 44 +++++++++---------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md b/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md index 18a77ca32..922565c31 100644 --- a/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md +++ b/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md @@ -225,31 +225,29 @@ To implement the `node-authorization` pallet in your runtime: 1. Add the pallet to the `construct_runtime` macro with the following line of code: ```rust - #[frame_support::runtime] - mod runtime { - #[runtime::runtime] - #[runtime::derive( - RuntimeCall, - RuntimeEvent, - RuntimeError, - RuntimeOrigin, - RuntimeFreezeReason, - RuntimeHoldReason, - RuntimeSlashReason, - RuntimeLockId, - RuntimeTask - )] - pub struct Runtime; + #[frame_support::runtime] + mod runtime { + #[runtime::runtime] + #[runtime::derive( + RuntimeCall, + RuntimeEvent, + RuntimeError, + RuntimeOrigin, + RuntimeFreezeReason, + RuntimeHoldReason, + RuntimeSlashReason, + RuntimeLockId, + RuntimeTask + )] + pub struct Runtime; - #[runtime::pallet_index(0)] - pub type System = frame_system; + #[runtime::pallet_index(0)] + pub type System = frame_system; - --snip-- - - /*** Add This Line ***/ - #[runtime::pallet_index(8)] - pub type NodeAuthorization: pallet_node_authorization; -} + //*** Add This Line ***// + #[runtime::pallet_index(8)] + pub type NodeAuthorization: pallet_node_authorization; + } ``` 1. Save your changes and close the file. From 49b1dfbaceaad1c75ce163ad89987ecd4633bc3d Mon Sep 17 00:00:00 2001 From: hippiestank <150185429+hippiestank@users.noreply.github.com> Date: Mon, 17 Jun 2024 14:15:30 -0600 Subject: [PATCH 3/9] Update upgrade-a-running-network.md Updated dependencies to reflect Polkadot-SDK and the modern Node Template construct_runtime macro. --- .../upgrade-a-running-network.md | 46 +++++++++++-------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/content/md/en/docs/tutorials/build-a-blockchain/upgrade-a-running-network.md b/content/md/en/docs/tutorials/build-a-blockchain/upgrade-a-running-network.md index 1b452c752..eba60fe16 100644 --- a/content/md/en/docs/tutorials/build-a-blockchain/upgrade-a-running-network.md +++ b/content/md/en/docs/tutorials/build-a-blockchain/upgrade-a-running-network.md @@ -146,10 +146,10 @@ To update the dependencies for the runtime to include the Utility pallet: ```text [dependencies] - codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } - scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } + codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive"] } + scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } - pallet-aura = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "polkadot-v1.0.0" } + pallet-aura = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.9.0", default-features = false } ``` 1. Add the Utility pallet as a dependency. @@ -157,11 +157,9 @@ To update the dependencies for the runtime to include the Utility pallet: For example, add a single line with the following fields: ```toml - pallet-utility = { - version = "4.0.0-dev", - default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", - branch = "polkadot-v1.0.0" + tag = "polkadot-v1.9.0", + default-features = false, } ``` @@ -280,24 +278,32 @@ To add the Utility types and configuration trait: 1. Locate the `construct_runtime!` macro. - ```text - construct_runtime!( - pub struct Runtime - where - Block = Block, - NodeBlock = opaque::Block, - UncheckedExtrinsic = UncheckedExtrinsic - { - System: frame_system, - RandomnessCollectiveFlip: pallet_randomness_collective_flip, - Timestamp: pallet_timestamp, - Aura: pallet_aura, + ```rust + #[frame_support::runtime] + mod runtime { + #[runtime::runtime] + #[runtime::derive( + RuntimeCall, + RuntimeEvent, + RuntimeError, + RuntimeOrigin, + RuntimeFreezeReason, + RuntimeHoldReason, + RuntimeSlashReason, + RuntimeLockId, + RuntimeTask + )] + pub struct Runtime; + + #[runtime::pallet_index(0)] + pub type System = frame_system; ``` 1. Add the Utility pallet inside the `construct_runtime!` macro. ```rust - Utility: pallet_utility, + #[runtime::pallet_index(//*** Choose appropriate Index ***//) + pub type Utility: pallet_utility, ``` 1. Locate the `runtime_version` macro. From ae483d2ec5c0d8e279e3b44dbf42bf52fa675e99 Mon Sep 17 00:00:00 2001 From: hippiestank <150185429+hippiestank@users.noreply.github.com> Date: Tue, 18 Jun 2024 16:39:03 -0600 Subject: [PATCH 4/9] Update authorize-specific-nodes.md --- .../build-a-blockchain/authorize-specific-nodes.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md b/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md index 922565c31..bebacefec 100644 --- a/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md +++ b/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md @@ -244,9 +244,14 @@ To implement the `node-authorization` pallet in your runtime: #[runtime::pallet_index(0)] pub type System = frame_system; + //*** snip ***// + + #[runtime::pallet_index(7)] + pub type TemplateModule = pallet_template; + //*** Add This Line ***// #[runtime::pallet_index(8)] - pub type NodeAuthorization: pallet_node_authorization; + pub type NodeAuthorization = pallet_node_authorization; } ``` From b85e9c88a960285f888cab775a87f8e9a3e2a7f5 Mon Sep 17 00:00:00 2001 From: hippiestank <150185429+hippiestank@users.noreply.github.com> Date: Tue, 18 Jun 2024 17:25:18 -0600 Subject: [PATCH 5/9] Update authorize-specific-nodes.md --- .../authorize-specific-nodes.md | 41 +++++++++---------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md b/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md index bebacefec..8d8145491 100644 --- a/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md +++ b/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md @@ -288,7 +288,6 @@ To configure genesis storage for authorized nodes: ```rust use sp_core::OpaquePeerId; // A struct wraps Vec to represent the node `PeerId`. - use node_template_runtime::NodeAuthorizationConfig; // The genesis config that serves the pallet. ``` 1. Locate the `testnet_genesis` function that configures initial storage state for FRAME modules. @@ -296,32 +295,30 @@ To configure genesis storage for authorized nodes: For example: ```rust - /// Configure initial storage state for FRAME modules. - fn testnet_genesis( - wasm_binary: &[u8], - initial_authorities: Vec<(AuraId, GrandpaId)>, - root_key: AccountId, - endowed_accounts: Vec, - _enable_println: bool, - ) -> GenesisConfig { - + /// Configure initial storage state for FRAME modules. + fn testnet_genesis( + initial_authorities: Vec<(AuraId, GrandpaId)>, + root_key: AccountId, + endowed_accounts: Vec, + _enable_println: bool, + ) -> serde_json::Value { ``` 1. Within the `GenesisConfig` declaration, add the following code block: ```rust - node_authorization: NodeAuthorizationConfig { - nodes: vec![ - ( - OpaquePeerId(bs58::decode("12D3KooWBmAwcd4PJNJvfV89HwE48nwkRmAgo8Vy3uQEyNNHBox2").into_vec().unwrap()), - endowed_accounts[0].clone() - ), - ( - OpaquePeerId(bs58::decode("12D3KooWQYV9dGMFoRzNStwpXztXaBUjtPqi6aU76ZgUriHhKust").into_vec().unwrap()), - endowed_accounts[1].clone() - ), - ], - }, + "node_authorization": { + "nodes": vec![ + ( + OpaquePeerId(bs58::decode("12D3KooWBmAwcd4PJNJvfV89HwE48nwkRmAgo8Vy3uQEyNNHBox2").into_vec().unwrap()), + endowed_accounts[0].clone() + ), + ( + OpaquePeerId(bs58::decode("12D3KooWQYV9dGMFoRzNStwpXztXaBUjtPqi6aU76ZgUriHhKust").into_vec().unwrap()), + endowed_accounts[1].clone() + ), + ], + }, ``` In this code, `NodeAuthorizationConfig` contains a `nodes` property, which is a vector with a tuple of two elements. From 7680fb7b2c3b35e4ce6a9da9308fbb833799a2a2 Mon Sep 17 00:00:00 2001 From: hippiestank Date: Fri, 21 Jun 2024 09:33:48 -0600 Subject: [PATCH 6/9] Update authorize-specific-nodes.md --- .../build-a-blockchain/authorize-specific-nodes.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md b/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md index 8d8145491..fb768b259 100644 --- a/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md +++ b/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md @@ -222,7 +222,7 @@ To implement the `node-authorization` pallet in your runtime: } ``` -1. Add the pallet to the `construct_runtime` macro with the following line of code: +1. Locate the `construct_runtime` macro: ```rust #[frame_support::runtime] @@ -243,14 +243,12 @@ To implement the `node-authorization` pallet in your runtime: #[runtime::pallet_index(0)] pub type System = frame_system; + ``` - //*** snip ***// - - #[runtime::pallet_index(7)] - pub type TemplateModule = pallet_template; +1. Add the Node Authorization pallet inside the `construct_runtime!` macro with the following code: - //*** Add This Line ***// - #[runtime::pallet_index(8)] + ```rust + #[runtime::pallet_index(x)] pub type NodeAuthorization = pallet_node_authorization; } ``` @@ -304,7 +302,7 @@ To configure genesis storage for authorized nodes: ) -> serde_json::Value { ``` -1. Within the `GenesisConfig` declaration, add the following code block: +1. Within the `serde_json::Value` declaration, add the following code block: ```rust "node_authorization": { From 042e9531ce7bf2dbc8c0dba92cd516698287ef51 Mon Sep 17 00:00:00 2001 From: hippiestank Date: Fri, 21 Jun 2024 12:23:36 -0600 Subject: [PATCH 7/9] Update authorize-specific-nodes.md --- .../tutorials/build-a-blockchain/authorize-specific-nodes.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md b/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md index fb768b259..7c36b4af4 100644 --- a/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md +++ b/content/md/en/docs/tutorials/build-a-blockchain/authorize-specific-nodes.md @@ -248,9 +248,8 @@ To implement the `node-authorization` pallet in your runtime: 1. Add the Node Authorization pallet inside the `construct_runtime!` macro with the following code: ```rust - #[runtime::pallet_index(x)] + #[runtime::pallet_index(x)] //*** Change pallet index ***// pub type NodeAuthorization = pallet_node_authorization; - } ``` 1. Save your changes and close the file. @@ -305,7 +304,7 @@ To configure genesis storage for authorized nodes: 1. Within the `serde_json::Value` declaration, add the following code block: ```rust - "node_authorization": { + "nodeAuthorization": { "nodes": vec![ ( OpaquePeerId(bs58::decode("12D3KooWBmAwcd4PJNJvfV89HwE48nwkRmAgo8Vy3uQEyNNHBox2").into_vec().unwrap()), From f6f334f6635fa923ff75b0731121788b60e64336 Mon Sep 17 00:00:00 2001 From: hippiestank Date: Fri, 21 Jun 2024 13:40:36 -0600 Subject: [PATCH 8/9] Update upgrade-a-running-network.md --- .../upgrade-a-running-network.md | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/content/md/en/docs/tutorials/build-a-blockchain/upgrade-a-running-network.md b/content/md/en/docs/tutorials/build-a-blockchain/upgrade-a-running-network.md index eba60fe16..b212ca383 100644 --- a/content/md/en/docs/tutorials/build-a-blockchain/upgrade-a-running-network.md +++ b/content/md/en/docs/tutorials/build-a-blockchain/upgrade-a-running-network.md @@ -144,7 +144,7 @@ To update the dependencies for the runtime to include the Utility pallet: For example: - ```text + ```rust [dependencies] codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive"] } scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } @@ -156,18 +156,15 @@ To update the dependencies for the runtime to include the Utility pallet: For example, add a single line with the following fields: - ```toml - git = "https://github.com/paritytech/polkadot-sdk.git", - tag = "polkadot-v1.9.0", - default-features = false, - } + ```rust + pallet-utility = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.9.0", default-features = false } ``` 1. Locate the `[features]` section and the list of the default features for the standard binary. For example: - ```text + ```rust [features] default = ["std"] std = [ @@ -180,7 +177,7 @@ To update the dependencies for the runtime to include the Utility pallet: 1. Add the Utility pallet to the list. - ```toml + ```rust "pallet-utility/std", ``` @@ -302,8 +299,8 @@ To add the Utility types and configuration trait: 1. Add the Utility pallet inside the `construct_runtime!` macro. ```rust - #[runtime::pallet_index(//*** Choose appropriate Index ***//) - pub type Utility: pallet_utility, + #[runtime::pallet_index(x)] //*** Change Pallet Index ***// + pub type Utility = pallet_utility; ``` 1. Locate the `runtime_version` macro. From a127eb70b4f8c52cbb3b627ec50a225b2565e585 Mon Sep 17 00:00:00 2001 From: hippiestank Date: Sun, 23 Jun 2024 09:55:17 -0600 Subject: [PATCH 9/9] Update upgrade-a-running-network.md --- .../tutorials/build-a-blockchain/upgrade-a-running-network.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/md/en/docs/tutorials/build-a-blockchain/upgrade-a-running-network.md b/content/md/en/docs/tutorials/build-a-blockchain/upgrade-a-running-network.md index b212ca383..be259a626 100644 --- a/content/md/en/docs/tutorials/build-a-blockchain/upgrade-a-running-network.md +++ b/content/md/en/docs/tutorials/build-a-blockchain/upgrade-a-running-network.md @@ -322,7 +322,7 @@ To add the Utility types and configuration trait: 1. Update the value for the EXISTENTIAL_DEPOSIT for the Balances pallet. ```rust - pub const EXISTENTIAL_DEPOSIT: u128 = 1000 // Update this value. + pub const EXISTENTIAL_DEPOSIT: u128 = 1000; // Update this value. ``` This change increases the minimum balance an account is required to have on deposit to be viewed as a valid active account.