Commit cc53599f authored by Bastian Köcher's avatar Bastian Köcher Committed by Gavin Wood
Browse files

Add sudo module to `polkadot-runtime` (#735)

parent 3143e2c2
Pipeline #73737 passed with stages
in 17 minutes and 54 seconds
......@@ -3293,6 +3293,20 @@ dependencies = [
"syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "pallet-sudo"
version = "2.0.0"
source = "git+https://github.com/paritytech/substrate?branch=polkadot-master#c9ca968bcfcb7947c96543c4455a1966cd2c20b1"
dependencies = [
"frame-support 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"frame-system 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",
"sp-io 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-runtime 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-std 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
]
[[package]]
name = "pallet-timestamp"
version = "2.0.0"
......@@ -3870,6 +3884,7 @@ dependencies = [
"pallet-session 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-staking 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-staking-reward-curve 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-sudo 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-timestamp 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-transaction-payment 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-transaction-payment-rpc-runtime-api 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
......@@ -7526,6 +7541,7 @@ dependencies = [
"checksum pallet-session 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)" = "<none>"
"checksum pallet-staking 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)" = "<none>"
"checksum pallet-staking-reward-curve 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)" = "<none>"
"checksum pallet-sudo 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)" = "<none>"
"checksum pallet-timestamp 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)" = "<none>"
"checksum pallet-transaction-payment 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)" = "<none>"
"checksum pallet-transaction-payment-rpc 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)" = "<none>"
......
......@@ -55,6 +55,7 @@ system = { package = "frame-system", git = "https://github.com/paritytech/substr
system_rpc_runtime_api = { package = "frame-system-rpc-runtime-api", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
timestamp = { package = "pallet-timestamp", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
treasury = { package = "pallet-treasury", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
sudo = { package = "pallet-sudo", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
runtime-common = { package = "polkadot-runtime-common", path = "../common", default-features = false }
primitives = { package = "polkadot-primitives", path = "../../primitives", default-features = false }
......@@ -126,4 +127,5 @@ std = [
"sp-session/std",
"randomness-collective-flip/std",
"runtime-common/std",
"sudo/std",
]
......@@ -506,6 +506,11 @@ impl claims::Trait for Runtime {
type Prefix = Prefix;
}
impl sudo::Trait for Runtime {
type Event = Event;
type Proposal = Call;
}
construct_runtime! {
pub enum Runtime where
Block = Block,
......@@ -534,6 +539,9 @@ construct_runtime! {
ImOnline: im_online::{Module, Call, Storage, Event<T>, ValidateUnsigned, Config<T>},
AuthorityDiscovery: authority_discovery::{Module, Call, Config},
// Sudo. Usable initially.
Sudo: sudo,
// Governance stuff; uncallable initially.
Democracy: democracy::{Module, Call, Storage, Config, Event<T>},
Council: collective::<Instance1>::{Module, Call, Storage, Origin<T>, Event<T>, Config<T>},
......
......@@ -217,6 +217,9 @@ fn staging_testnet_config_genesis() -> polkadot::GenesisConfig {
claims: Some(polkadot::ClaimsConfig {
claims: vec![],
vesting: vec![],
}),
sudo: Some(polkadot::SudoConfig {
key: endowed_accounts[0].clone(),
})
}
}
......@@ -275,7 +278,7 @@ pub fn get_authority_keys_from_seed(seed: &str) -> (
/// Helper function to create GenesisConfig for testing
pub fn testnet_genesis(
initial_authorities: Vec<(AccountId, AccountId, BabeId, GrandpaId, ImOnlineId, ValidatorId, AuthorityDiscoveryId)>,
_root_key: AccountId,
root_key: AccountId,
endowed_accounts: Option<Vec<AccountId>>,
) -> polkadot::GenesisConfig {
let endowed_accounts: Vec<AccountId> = endowed_accounts.unwrap_or_else(|| {
......@@ -354,7 +357,10 @@ pub fn testnet_genesis(
claims: Some(polkadot::ClaimsConfig {
claims: vec![],
vesting: vec![],
})
}),
sudo: Some(polkadot::SudoConfig {
key: root_key,
}),
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment