1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
use frame_election_provider_support::{onchain, SequentialPhragmen};
use pallet_election_provider_multi_phase::{BenchmarkingConfig, Config, SolutionAccuracyOf};
use sp_runtime::{transaction_validity::TransactionPriority, PerU16, Perbill};
use crate::*;
sp_npos_elections::generate_solution_type!(
#[compact]
pub struct NposCompactSolution24::<
VoterIndex = u32,
TargetIndex = u16,
Accuracy = PerU16,
>(24)
);
frame_support::parameter_types! {
pub const SignedPhase: u32 = 0;
pub const UnsignedPhase: u32 = PANGOLIN_BLOCKS_PER_SESSION / 4;
pub const SignedMaxSubmissions: u32 = 10;
pub const SignedRewardBase: Balance = MILLI;
pub const SignedDepositBase: Balance = MILLI;
pub const SignedDepositByte: Balance = MICRO;
pub SolutionImprovementThreshold: Perbill = Perbill::from_rational(5u32, 10_000);
pub NposSolutionPriority: TransactionPriority = Perbill::from_percent(90) * TransactionPriority::max_value();
pub const OffchainRepeat: BlockNumber = 5;
pub const VoterSnapshotPerBlock: u32 = 22_500;
}
impl Config for Runtime {
type BenchmarkingConfig = ElectionProviderBenchmarkConfig;
type Currency = Ring;
type DataProvider = Staking;
type EstimateCallFee = TransactionPayment;
type Event = Event;
type Fallback = GenesisElectionOf<Self>;
type ForceOrigin = RootOrAtLeastHalf<CouncilCollective>;
type MinerMaxLength = OffchainSolutionLengthLimit;
type MinerMaxWeight = OffchainSolutionWeightLimit;
type MinerTxPriority = NposSolutionPriority;
type OffchainRepeat = OffchainRepeat;
type RewardHandler = ();
type SignedDepositBase = SignedDepositBase;
type SignedDepositByte = SignedDepositByte;
type SignedDepositWeight = ();
type SignedMaxSubmissions = SignedMaxSubmissions;
type SignedMaxWeight = Self::MinerMaxWeight;
type SignedPhase = SignedPhase;
type SignedRewardBase = SignedRewardBase;
type SlashHandler = ();
type Solution = NposCompactSolution24;
type SolutionImprovementThreshold = SolutionImprovementThreshold;
type Solver = SequentialPhragmen<AccountId, SolutionAccuracyOf<Self>, OffchainRandomBalancing>;
type UnsignedPhase = UnsignedPhase;
type VoterSnapshotPerBlock = VoterSnapshotPerBlock;
type WeightInfo = ();
}
impl onchain::Config for Runtime {
type Accuracy = Perbill;
type DataProvider = Staking;
}
pub struct ElectionProviderBenchmarkConfig;
impl BenchmarkingConfig for ElectionProviderBenchmarkConfig {
const ACTIVE_VOTERS: [u32; 2] = [500, 800];
const DESIRED_TARGETS: [u32; 2] = [200, 400];
const MAXIMUM_TARGETS: u32 = 300;
const MINER_MAXIMUM_VOTERS: u32 = 1000;
const SNAPSHOT_MAXIMUM_VOTERS: u32 = 1000;
const TARGETS: [u32; 2] = [500, 1000];
const VOTERS: [u32; 2] = [1000, 2000];
}