Add sudo to template node (#2748)

* Add sudo to template node

* Fix

* Change as suggest

* Update parachain-template/runtime/src/lib.rs

Co-authored-by: Squirrel <giles@parity.io>

* Change as suggest

---------

Co-authored-by: Squirrel <giles@parity.io>
This commit is contained in:
Xavier Lau
2023-06-20 00:53:57 +08:00
committed by GitHub
parent 1e417710f5
commit 5838ab681d
3 changed files with 16 additions and 1 deletions
@@ -101,6 +101,7 @@ pub fn development_config() -> ChainSpec {
get_account_id_from_seed::<sr25519::Public>("Eve//stash"), get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"), get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
], ],
get_account_id_from_seed::<sr25519::Public>("Alice"),
1000.into(), 1000.into(),
) )
}, },
@@ -156,6 +157,7 @@ pub fn local_testnet_config() -> ChainSpec {
get_account_id_from_seed::<sr25519::Public>("Eve//stash"), get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"), get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
], ],
get_account_id_from_seed::<sr25519::Public>("Alice"),
1000.into(), 1000.into(),
) )
}, },
@@ -180,6 +182,7 @@ pub fn local_testnet_config() -> ChainSpec {
fn testnet_genesis( fn testnet_genesis(
invulnerables: Vec<(AccountId, AuraId)>, invulnerables: Vec<(AccountId, AuraId)>,
endowed_accounts: Vec<AccountId>, endowed_accounts: Vec<AccountId>,
root: AccountId,
id: ParaId, id: ParaId,
) -> parachain_template_runtime::RuntimeGenesisConfig { ) -> parachain_template_runtime::RuntimeGenesisConfig {
parachain_template_runtime::RuntimeGenesisConfig { parachain_template_runtime::RuntimeGenesisConfig {
@@ -218,5 +221,6 @@ fn testnet_genesis(
safe_xcm_version: Some(SAFE_XCM_VERSION), safe_xcm_version: Some(SAFE_XCM_VERSION),
}, },
transaction_payment: Default::default(), transaction_payment: Default::default(),
sudo: parachain_template_runtime::SudoConfig { key: Some(root) },
} }
} }
@@ -134,6 +134,7 @@ runtime-benchmarks = [
"pallet-collator-selection/runtime-benchmarks", "pallet-collator-selection/runtime-benchmarks",
"pallet-parachain-template/runtime-benchmarks", "pallet-parachain-template/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks",
"pallet-sudo/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks", "pallet-xcm/runtime-benchmarks",
"sp-runtime/runtime-benchmarks", "sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks", "xcm-builder/runtime-benchmarks",
+11 -1
View File
@@ -360,6 +360,12 @@ impl pallet_transaction_payment::Config for Runtime {
type OperationalFeeMultiplier = ConstU8<5>; type OperationalFeeMultiplier = ConstU8<5>;
} }
impl pallet_sudo::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type WeightInfo = ();
}
parameter_types! { parameter_types! {
pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4); pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);
pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4); pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);
@@ -479,6 +485,9 @@ construct_runtime!(
Balances: pallet_balances = 10, Balances: pallet_balances = 10,
TransactionPayment: pallet_transaction_payment = 11, TransactionPayment: pallet_transaction_payment = 11,
// Governance
Sudo: pallet_sudo = 15,
// Collator support. The order of these 4 are important and shall not change. // Collator support. The order of these 4 are important and shall not change.
Authorship: pallet_authorship = 20, Authorship: pallet_authorship = 20,
CollatorSelection: pallet_collator_selection = 21, CollatorSelection: pallet_collator_selection = 21,
@@ -493,7 +502,7 @@ construct_runtime!(
DmpQueue: cumulus_pallet_dmp_queue = 33, DmpQueue: cumulus_pallet_dmp_queue = 33,
// Template // Template
TemplatePallet: pallet_parachain_template = 40, TemplatePallet: pallet_parachain_template = 50,
} }
); );
@@ -504,6 +513,7 @@ mod benches {
[pallet_balances, Balances] [pallet_balances, Balances]
[pallet_session, SessionBench::<Runtime>] [pallet_session, SessionBench::<Runtime>]
[pallet_timestamp, Timestamp] [pallet_timestamp, Timestamp]
[pallet_sudo, Sudo]
[pallet_collator_selection, CollatorSelection] [pallet_collator_selection, CollatorSelection]
[cumulus_pallet_xcmp_queue, XcmpQueue] [cumulus_pallet_xcmp_queue, XcmpQueue]
); );