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..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 @@ -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: @@ -222,19 +222,34 @@ 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 - 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; + ``` + +1. Add the Node Authorization pallet inside the `construct_runtime!` macro with the following code: + + ```rust + #[runtime::pallet_index(x)] //*** Change pallet index ***// + pub type NodeAuthorization = pallet_node_authorization; ``` 1. Save your changes and close the file. @@ -270,7 +285,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. @@ -278,32 +292,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: +1. Within the `serde_json::Value` 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() - ), - ], - }, + "nodeAuthorization": { + "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. 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..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 @@ -144,32 +144,27 @@ To update the dependencies for the runtime to include the Utility pallet: For example: - ```text + ```rust [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. 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" - } + ```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 = [ @@ -182,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", ``` @@ -280,24 +275,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(x)] //*** Change Pallet Index ***// + pub type Utility = pallet_utility; ``` 1. Locate the `runtime_version` macro. @@ -319,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.