Skip to content

Commit

Permalink
feat: remove sudo (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
weichweich authored Nov 2, 2021
1 parent 1910b75 commit 2e937de
Show file tree
Hide file tree
Showing 14 changed files with 75 additions and 309 deletions.
5 changes: 2 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

119 changes: 1 addition & 118 deletions nodes/parachain/src/chain_spec/spiritnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use sp_core::{crypto::UncheckedInto, sr25519};
use sp_runtime::traits::Zero;
use spiritnet_runtime::{
BalancesConfig, CouncilConfig, CrowdloanContributorsConfig, GenesisConfig, InflationInfo, KiltLaunchConfig,
MinCollatorStake, ParachainInfoConfig, ParachainStakingConfig, SessionConfig, SudoConfig, SystemConfig,
MinCollatorStake, ParachainInfoConfig, ParachainStakingConfig, SessionConfig, SystemConfig,
TechnicalCommitteeConfig, VestingConfig, WASM_BINARY,
};

Expand Down Expand Up @@ -66,7 +66,6 @@ pub fn get_chain_spec_dev(id: ParaId) -> Result<ChainSpec, String> {
],
kilt_inflation_config(),
MAX_COLLATOR_STAKE,
get_account_id_from_seed::<sr25519::Public>("Alice"),
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
Expand Down Expand Up @@ -128,7 +127,6 @@ const WILT_COL_ACC_1: [u8; 32] = hex!["e6cf13c86a5f174acba79ca361dc429d89eb704c6
const WILT_COL_SESSION_1: [u8; 32] = hex!["e29df39b74777495ca00cd7a316ce98c5225d7088ae924b122fe0e2e6a4b5569"];
const WILT_COL_ACC_2: [u8; 32] = hex!["e8ed0c2a40fb5a0bbb24c38f5c8cd83d79498ac029ac9f87497677f5701e3d2c"];
const WILT_COL_SESSION_2: [u8; 32] = hex!["7cacfbce640321ba84a85f41dfb43c2a2ea14ed789c096ad62ee0491599b0f44"];
const WILT_SUDO_ACC: [u8; 32] = hex!["200a316b25b3683459585ec746042f6841640e3b9f111028426ff17e9090005d"];
const WILT_TRANS_ACC: [u8; 32] = hex!["aaf5308b81f962ffdaccaa22352cc95b7bef70033d9d0d5a7023ec5681f05954"];

pub fn get_chain_spec_wilt() -> Result<ChainSpec, String> {
Expand All @@ -149,15 +147,13 @@ pub fn get_chain_spec_wilt() -> Result<ChainSpec, String> {
],
kilt_inflation_config(),
MAX_COLLATOR_STAKE,
WILT_SUDO_ACC.into(),
vec![
(WILT_COL_ACC_1.into(), WILT_COL_SESSION_1.unchecked_into()),
(WILT_COL_ACC_2.into(), WILT_COL_SESSION_2.unchecked_into()),
],
vec![
(WILT_COL_ACC_1.into(), 40000 * KILT),
(WILT_COL_ACC_2.into(), 40000 * KILT),
(WILT_SUDO_ACC.into(), 10000 * KILT),
(WILT_TRANS_ACC.into(), 10000 * KILT),
],
WILT_TRANS_ACC.into(),
Expand All @@ -182,117 +178,6 @@ pub fn get_chain_spec_wilt() -> Result<ChainSpec, String> {
))
}

const SPIRIT_COL_ACC_01: [u8; 32] = hex!["643254e645e0e040e78449793fda50fba9cd0929631c3c9ea08387cfa1d2767b"];
const SPIRIT_COL_SESSION_01: [u8; 32] = hex!["709dddf36d5741239071b3537421f4ea620ddef1f20f82ca86d290fe0cb1d17e"];
const SPIRIT_COL_ACC_02: [u8; 32] = hex!["628da4055a812ca4145c75c38734138b6c62f0402ff1feae649be54d4c42c32e"];
const SPIRIT_COL_SESSION_02: [u8; 32] = hex!["1cbebf801ded95b160f683469d61c4dc85653bc14d9e2bdcd72eb985aac19943"];

const SPIRIT_COL_ACC_03: [u8; 32] = hex!["ec9b89167a547f11a13ef71c9fea326d66b067d3dfd83744c83fda31d7fd4171"];
const SPIRIT_COL_SESSION_03: [u8; 32] = hex!["30f7db5a399cb77cc55515fb8b85b3d39ac55b5fdd6b236a34248c75fbd90e60"];
const SPIRIT_COL_ACC_04: [u8; 32] = hex!["10abf8ffbb90d92395d891a798e4476ade3d28ae5f8c5c955b9199d995871a62"];
const SPIRIT_COL_SESSION_04: [u8; 32] = hex!["9433021147aae2723b197e25b0089bc2fce0f8e3f5b61178c45ef227abb4c22b"];
const SPIRIT_COL_ACC_05: [u8; 32] = hex!["1664016a5caab8f5b4b1360b1e05b4aa84c1970f30a19d49ae4f40312404a538"];
const SPIRIT_COL_SESSION_05: [u8; 32] = hex!["8a5c403f5cc5ca297b7fef06cad3a4e8bc8a0310d92adb5bbc2fbca116e0441a"];
const SPIRIT_COL_ACC_06: [u8; 32] = hex!["fa53c9aba42da8645c332d15272cae9b939de4181b8ea261e3cb9c2e79e1dd36"];
const SPIRIT_COL_SESSION_06: [u8; 32] = hex!["2ef0912b021321a65e2ab2e146796b1d5ddcd47298864be38edf5c70b869864f"];
const SPIRIT_COL_ACC_07: [u8; 32] = hex!["283073d74823d49eaaba6dc69ba145b4e28b91499ee4d314c35d5a8625477a31"];
const SPIRIT_COL_SESSION_07: [u8; 32] = hex!["4cd52e3d6742d5e090f5977cb5413d61a651b5bb643ac65b0aee61d1c0a68a0c"];
const SPIRIT_COL_ACC_08: [u8; 32] = hex!["5270ec35ba01254d8bff046a1a58f16d3ae615c235efd6e99a35f233b2d9df2c"];
const SPIRIT_COL_SESSION_08: [u8; 32] = hex!["e4acf473fa03cc55ddf05ab58d0816cc38f5a82128c90af7174080b186db2555"];
const SPIRIT_COL_ACC_09: [u8; 32] = hex!["ec4635974882ab477e60fc38ea72f42636d60f0433a5c1ce2e5f3b4c9a879fe9"];
const SPIRIT_COL_SESSION_09: [u8; 32] = hex!["64007bee2fd9d23e6cc6cf7bbb55badee773d5d99665ab0d3f3dd9415ef0585d"];
const SPIRIT_COL_ACC_10: [u8; 32] = hex!["be1dbcf4234b70c81a518378e72b67aa7cd06b122ebb7658562472167e8e231c"];
const SPIRIT_COL_SESSION_10: [u8; 32] = hex!["d08bae71b7184947656646fb5155e874632625f8227f299847d11516ca803e21"];
const SPIRIT_COL_ACC_11: [u8; 32] = hex!["4294c4ffa38dc95fb9c57fc9f82ded3d02336b78f137c08636b849f9eb9ca60f"];
const SPIRIT_COL_SESSION_11: [u8; 32] = hex!["60d1411a7316ac8aeca5750ddfb509c03adf1ac41a259be62bf57d9b9ec5bd29"];
const SPIRIT_COL_ACC_12: [u8; 32] = hex!["6c9783e922b00e288d19b9020ffce919d1ab4ab20fc62d5d0b23ac1e61b2096b"];
const SPIRIT_COL_SESSION_12: [u8; 32] = hex!["18a3abde01c55ee58633668c97c9855a6772f3d97f0b89ce8f60842a65af3212"];
const SPIRIT_COL_ACC_13: [u8; 32] = hex!["eadbf15cd28e209358f6cef3b139a71e428254c2072948782bd94e9e8fcd3608"];
const SPIRIT_COL_SESSION_13: [u8; 32] = hex!["d8e4758a39e623ef7e7841747fa788891bdd3b5f775cec05d0d2dd22fdfa2259"];
const SPIRIT_COL_ACC_14: [u8; 32] = hex!["68a7a05e316865a68968f92b09e9ec6d5d1847e71e520e68e5d306b5730c2468"];
const SPIRIT_COL_SESSION_14: [u8; 32] = hex!["3cf5f477056588cdb198e03852b1f4d1e1abe89f854a271e38e892c14f15182d"];
const SPIRIT_COL_ACC_15: [u8; 32] = hex!["66241b171bd08521a33dc807061373a092faea04252f58b70792e7c7ecfd500e"];
const SPIRIT_COL_SESSION_15: [u8; 32] = hex!["f0d87466a633cf242237b5807262e90f199704c07fc9c3d9bda861dc67ef6a32"];
const SPIRIT_COL_ACC_16: [u8; 32] = hex!["4ebcfdc6cdc35cd99a8bb93c64ea81bb30731c2f01b0464bb400bad3f0d4b61f"];
const SPIRIT_COL_SESSION_16: [u8; 32] = hex!["849769562be9e7f744754e79a74fd3479388e59d278e8fc2fd073f82f0799604"];

const SPIRIT_SUDO_ACC: [u8; 32] = hex!["427b946b2cee9bd4ed03982e6f716d4eeaa5dc8410255e7a8ecf8d0080effe24"];
const SPIRIT_TRANS_ACC: [u8; 32] = hex!["de28ef5b1691663300a2edb97202791e89bb6985ffdaa4c405d68c826b634b76"];

pub fn get_chain_spec_spiritnet() -> Result<ChainSpec, String> {
let properties = get_properties("KILT", 15, 38);
let wasm = WASM_BINARY.ok_or("No WASM")?;
let id: ParaId = 2086.into();

Ok(ChainSpec::from_genesis(
"KILT Spiritnet",
"kilt",
ChainType::Live,
move || {
testnet_genesis(
wasm,
vec![
(SPIRIT_COL_ACC_01.into(), None, MAX_COLLATOR_STAKE),
(SPIRIT_COL_ACC_02.into(), None, MAX_COLLATOR_STAKE),
(SPIRIT_COL_ACC_03.into(), None, 10_000 * KILT),
(SPIRIT_COL_ACC_04.into(), None, MAX_COLLATOR_STAKE),
(SPIRIT_COL_ACC_05.into(), None, 10_000 * KILT),
(SPIRIT_COL_ACC_06.into(), None, 12_750 * KILT),
(SPIRIT_COL_ACC_07.into(), None, 20_000 * KILT),
(SPIRIT_COL_ACC_08.into(), None, 10_000 * KILT),
(SPIRIT_COL_ACC_09.into(), None, 20_000 * KILT),
(SPIRIT_COL_ACC_10.into(), None, MAX_COLLATOR_STAKE),
(SPIRIT_COL_ACC_11.into(), None, 10_000 * KILT),
(SPIRIT_COL_ACC_12.into(), None, 50_000 * KILT),
(SPIRIT_COL_ACC_13.into(), None, 11_000 * KILT),
(SPIRIT_COL_ACC_14.into(), None, 50_000 * KILT),
(SPIRIT_COL_ACC_15.into(), None, 25_000 * KILT),
(SPIRIT_COL_ACC_16.into(), None, 50_000 * KILT),
],
kilt_inflation_config(),
MAX_COLLATOR_STAKE,
SPIRIT_SUDO_ACC.into(),
vec![
(SPIRIT_COL_ACC_01.into(), SPIRIT_COL_SESSION_01.unchecked_into()),
(SPIRIT_COL_ACC_02.into(), SPIRIT_COL_SESSION_02.unchecked_into()),
(SPIRIT_COL_ACC_03.into(), SPIRIT_COL_SESSION_03.unchecked_into()),
(SPIRIT_COL_ACC_04.into(), SPIRIT_COL_SESSION_04.unchecked_into()),
(SPIRIT_COL_ACC_05.into(), SPIRIT_COL_SESSION_05.unchecked_into()),
(SPIRIT_COL_ACC_06.into(), SPIRIT_COL_SESSION_06.unchecked_into()),
(SPIRIT_COL_ACC_07.into(), SPIRIT_COL_SESSION_07.unchecked_into()),
(SPIRIT_COL_ACC_08.into(), SPIRIT_COL_SESSION_08.unchecked_into()),
(SPIRIT_COL_ACC_09.into(), SPIRIT_COL_SESSION_09.unchecked_into()),
(SPIRIT_COL_ACC_10.into(), SPIRIT_COL_SESSION_10.unchecked_into()),
(SPIRIT_COL_ACC_11.into(), SPIRIT_COL_SESSION_11.unchecked_into()),
(SPIRIT_COL_ACC_12.into(), SPIRIT_COL_SESSION_12.unchecked_into()),
(SPIRIT_COL_ACC_13.into(), SPIRIT_COL_SESSION_13.unchecked_into()),
(SPIRIT_COL_ACC_14.into(), SPIRIT_COL_SESSION_14.unchecked_into()),
(SPIRIT_COL_ACC_15.into(), SPIRIT_COL_SESSION_15.unchecked_into()),
(SPIRIT_COL_ACC_16.into(), SPIRIT_COL_SESSION_16.unchecked_into()),
],
vec![],
SPIRIT_TRANS_ACC.into(),
id,
)
},
vec![
"/dns4/bootnode.kilt.io/tcp/30390/p2p/12D3KooWEViDAJgLbeB5hg1KBNg42Ys2V5C6FTCCv6jJXCft41g9"
.parse()
.expect("bootnode address is formatted correctly; qed"),
"/dns4/bootnode.kilt.io/tcp/30391/p2p/12D3KooWQaP87gsVDjALr85bvF3HRdt2gN3ddDMrKbUkTvtoYNmj"
.parse()
.expect("bootnode address is formatted correctly; qed"),
],
Some(TelemetryEndpoints::new(vec![(TELEMETRY_URL.to_string(), 0)]).expect("KILT telemetry url is valid; qed")),
None,
Some(properties),
Extensions {
relay_chain: "kusama".into(),
para_id: id.into(),
},
))
}

pub fn load_spiritnet_spec() -> Result<ChainSpec, String> {
ChainSpec::from_json_bytes(&include_bytes!("../../res/spiritnet.json")[..])
}
Expand All @@ -307,7 +192,6 @@ fn testnet_genesis(
stakers: Vec<(AccountId, Option<AccountId>, Balance)>,
inflation_config: InflationInfo,
max_candidate_stake: Balance,
root_key: AccountId,
initial_authorities: Vec<(AccountId, AuthorityId)>,
endowed_accounts: Vec<(AccountId, Balance)>,
transfer_account: AccountId,
Expand Down Expand Up @@ -348,7 +232,6 @@ fn testnet_genesis(
crowdloan_contributors: CrowdloanContributorsConfig {
registrar_account: transfer_account.clone(),
},
sudo: SudoConfig { key: root_key },
parachain_info: ParachainInfoConfig { parachain_id: id },
kilt_launch: KiltLaunchConfig {
vesting: claimable_accounts
Expand Down
1 change: 0 additions & 1 deletion nodes/parachain/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ fn load_spec(id: &str, runtime: &str, para_id: ParaId) -> std::result::Result<Bo
"peregrine-new" => Ok(Box::new(chain_spec::peregrine::make_new_spec(para_id)?)),
"spiritnet-dev" => Ok(Box::new(chain_spec::spiritnet::get_chain_spec_dev(para_id)?)),
"wilt-new" => Ok(Box::new(chain_spec::spiritnet::get_chain_spec_wilt()?)),
"spiritnet-new" => Ok(Box::new(chain_spec::spiritnet::get_chain_spec_spiritnet()?)),
"spiritnet" => Ok(Box::new(chain_spec::spiritnet::load_spiritnet_spec()?)),
"" => match runtime {
"spiritnet" => Ok(Box::new(chain_spec::spiritnet::get_chain_spec_dev(para_id)?)),
Expand Down
4 changes: 2 additions & 2 deletions pallets/delegation/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl DelegationStorageVersion {
// old version anymore.
impl Default for DelegationStorageVersion {
fn default() -> Self {
Self::V1
Self::V2
}
}

Expand Down Expand Up @@ -153,7 +153,7 @@ impl<T: Config> DelegationStorageMigrator<T> {
pub(crate) fn post_migrate() -> Result<(), &'static str> {
ensure!(
StorageVersion::<T>::get() == DelegationStorageVersion::latest(),
"Not updated to the latest version."
"Delegations not updated to the latest version."
);

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion pallets/did/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl<T: Config> DidStorageMigrator<T> {
pub(crate) fn post_migrate() -> Result<(), &'static str> {
ensure!(
StorageVersion::<T>::get() == DidStorageVersion::latest(),
"Not updated to the latest version."
"DID not updated to the latest version."
);

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion pallets/parachain-staking/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ impl<T: Config> StakingStorageMigrator<T> {
pub(crate) fn post_migrate() -> Result<(), &'static str> {
ensure!(
StorageVersion::<T>::get() == StakingStorageVersion::latest(),
"Not updated to the latest version."
"Staking not updated to the latest version."
);

Ok(())
Expand Down
13 changes: 2 additions & 11 deletions runtimes/peregrine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,7 @@ use sp_version::NativeVersion;
#[cfg(feature = "runtime-benchmarks")]
use {frame_system::EnsureSigned, kilt_primitives::benchmarks::DummySignature, kilt_support::signature::AlwaysVerify};

use migrations::crowdloan_contributions::CrowdloanContributionsSetup;

mod fee;
mod migrations;
#[cfg(test)]
mod tests;
mod weights;
Expand Down Expand Up @@ -828,14 +825,8 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signatu
/// Extrinsic type that has already been checked.
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;
/// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive<
Runtime,
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
CrowdloanContributionsSetup,
>;
pub type Executive =
frame_executive::Executive<Runtime, Block, frame_system::ChainContext<Runtime>, Runtime, AllPallets>;

impl_runtime_apis! {
impl sp_api::Core<Block> for Runtime {
Expand Down
19 changes: 0 additions & 19 deletions runtimes/peregrine/src/migrations.rs

This file was deleted.

70 changes: 0 additions & 70 deletions runtimes/peregrine/src/migrations/crowdloan_contributions.rs

This file was deleted.

3 changes: 0 additions & 3 deletions runtimes/spiritnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ pallet-membership = {git = "https://github.com/paritytech/substrate", default-fe
pallet-randomness-collective-flip = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.12"}
pallet-scheduler = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.12"}
pallet-session = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.12"}
pallet-sudo = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.12"}
pallet-timestamp = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.12"}
pallet-transaction-payment = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.12"}
pallet-treasury = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.12"}
Expand Down Expand Up @@ -157,7 +156,6 @@ std = [
"pallet-randomness-collective-flip/std",
"pallet-scheduler/std",
"pallet-session/std",
"pallet-sudo/std",
"pallet-timestamp/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-transaction-payment/std",
Expand Down Expand Up @@ -207,7 +205,6 @@ try-runtime = [
"pallet-randomness-collective-flip/try-runtime",
"pallet-scheduler/try-runtime",
"pallet-session/try-runtime",
"pallet-sudo/try-runtime",
"pallet-timestamp/try-runtime",
"pallet-transaction-payment/try-runtime",
"pallet-treasury/try-runtime",
Expand Down
Loading

0 comments on commit 2e937de

Please sign in to comment.