From 9259ed4689bfb26d90095c9e47a0e0e20272bb60 Mon Sep 17 00:00:00 2001 From: Liu-Cheng Xu Date: Tue, 1 Jun 2021 17:27:26 +0800 Subject: [PATCH 1/2] Force the validators in waiting list to run an authority node --- cli/src/chain_spec.rs | 4 ++-- runtime/chainx/src/lib.rs | 3 +-- runtime/dev/src/constants.rs | 2 +- runtime/dev/src/lib.rs | 3 +-- runtime/malan/src/lib.rs | 3 +-- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/cli/src/chain_spec.rs b/cli/src/chain_spec.rs index 3d18fccb0..93821b351 100644 --- a/cli/src/chain_spec.rs +++ b/cli/src/chain_spec.rs @@ -417,8 +417,8 @@ fn build_genesis( }, xpallet_mining_staking: dev::XStakingConfig { validators, - validator_count: 50, - sessions_per_era: 12, + validator_count: 1, + sessions_per_era: 2, vesting_account, glob_dist_ratio: (12, 88), // (Treasury, X-type Asset and Staking) = (12, 88) mining_ratio: (10, 90), // (Asset Mining, Staking) = (10, 90) diff --git a/runtime/chainx/src/lib.rs b/runtime/chainx/src/lib.rs index 138a7edef..1b0c24241 100644 --- a/runtime/chainx/src/lib.rs +++ b/runtime/chainx/src/lib.rs @@ -420,8 +420,7 @@ impl frame_support::traits::ValidatorSet for Runtime { } fn validators() -> Vec { - // TODO: return the active validator set in Staking. - Session::validators() + XStaking::active_validator_set().collect() } } diff --git a/runtime/dev/src/constants.rs b/runtime/dev/src/constants.rs index 322239a1f..fc93ded27 100644 --- a/runtime/dev/src/constants.rs +++ b/runtime/dev/src/constants.rs @@ -22,7 +22,7 @@ pub mod time { pub const MILLISECS_PER_BLOCK: Moment = 6000; pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK; - pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 5 * MINUTES; + pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 1 * MINUTES; // These time units are defined in number of blocks. pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); diff --git a/runtime/dev/src/lib.rs b/runtime/dev/src/lib.rs index 4f10d87a8..7993b043d 100644 --- a/runtime/dev/src/lib.rs +++ b/runtime/dev/src/lib.rs @@ -424,8 +424,7 @@ impl frame_support::traits::ValidatorSet for Runtime { } fn validators() -> Vec { - // TODO: return the active validator set in Staking. - Session::validators() + XStaking::active_validator_set().collect() } } diff --git a/runtime/malan/src/lib.rs b/runtime/malan/src/lib.rs index a85da2ec3..ed46193ba 100644 --- a/runtime/malan/src/lib.rs +++ b/runtime/malan/src/lib.rs @@ -419,8 +419,7 @@ impl frame_support::traits::ValidatorSet for Runtime { } fn validators() -> Vec { - // TODO: return the active validator set in Staking. - Session::validators() + XStaking::active_validator_set().collect() } } From be1241c3cd9efd9379b1672dcacc8dc63ea2221a Mon Sep 17 00:00:00 2001 From: Liu-Cheng Xu Date: Tue, 1 Jun 2021 17:46:00 +0800 Subject: [PATCH 2/2] . --- cli/src/chain_spec.rs | 4 ++-- runtime/dev/src/constants.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/src/chain_spec.rs b/cli/src/chain_spec.rs index 93821b351..3d18fccb0 100644 --- a/cli/src/chain_spec.rs +++ b/cli/src/chain_spec.rs @@ -417,8 +417,8 @@ fn build_genesis( }, xpallet_mining_staking: dev::XStakingConfig { validators, - validator_count: 1, - sessions_per_era: 2, + validator_count: 50, + sessions_per_era: 12, vesting_account, glob_dist_ratio: (12, 88), // (Treasury, X-type Asset and Staking) = (12, 88) mining_ratio: (10, 90), // (Asset Mining, Staking) = (10, 90) diff --git a/runtime/dev/src/constants.rs b/runtime/dev/src/constants.rs index fc93ded27..322239a1f 100644 --- a/runtime/dev/src/constants.rs +++ b/runtime/dev/src/constants.rs @@ -22,7 +22,7 @@ pub mod time { pub const MILLISECS_PER_BLOCK: Moment = 6000; pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK; - pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 1 * MINUTES; + pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 5 * MINUTES; // These time units are defined in number of blocks. pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);