1
1
use frame_election_provider_support:: { onchain, SequentialPhragmen , VoteWeight } ;
2
2
use frame_support:: {
3
3
parameter_types,
4
- traits:: { ConstU32 , FindAuthor , GenesisBuild , OneSessionHandler } ,
4
+ traits:: { ConstU32 , FindAuthor , OneSessionHandler } ,
5
5
} ;
6
6
use frame_system as system;
7
7
use pallet_session:: historical as pallet_session_historical;
8
8
use pallet_staking_extension:: ServerInfo ;
9
9
use sp_core:: H256 ;
10
10
use sp_runtime:: {
11
11
curve:: PiecewiseLinear ,
12
- testing:: { Header , TestXt , UintAuthorityId } ,
12
+ testing:: { TestXt , UintAuthorityId } ,
13
13
traits:: { BlakeTwo256 , ConvertInto , IdentityLookup } ,
14
- Perbill ,
14
+ BuildStorage , Perbill ,
15
15
} ;
16
16
use sp_staking:: { EraIndex , SessionIndex } ;
17
17
18
18
use crate as pallet_propagation;
19
19
20
20
const NULL_ARR : [ u8 ; 32 ] = [ 0 ; 32 ] ;
21
21
22
- type UncheckedExtrinsic = frame_system:: mocking:: MockUncheckedExtrinsic < Test > ;
23
22
type Block = frame_system:: mocking:: MockBlock < Test > ;
24
23
type BlockNumber = u64 ;
25
24
type AccountId = u64 ;
26
25
type Balance = u64 ;
27
26
28
27
// Configure a mock runtime to test the pallet.
29
28
frame_support:: construct_runtime!(
30
- pub enum Test where
31
- Block = Block ,
32
- NodeBlock = Block ,
33
- UncheckedExtrinsic = UncheckedExtrinsic ,
29
+ pub enum Test
34
30
{
35
- System : frame_system:: { Pallet , Call , Config , Storage , Event < T > } ,
36
- Balances : pallet_balances:: { Pallet , Call , Storage , Config < T > , Event < T > } ,
37
- Timestamp : pallet_timestamp:: { Pallet , Call , Storage , Inherent } ,
38
- Authorship : pallet_authorship:: { Pallet , Storage } ,
39
- Relayer : pallet_relayer:: { Pallet , Call , Storage , Event < T > } ,
40
- Constraints : pallet_constraints:: { Pallet , Call , Storage , Event < T > } ,
41
- Propagation : pallet_propagation:: { Pallet , Call , Storage , Event < T > } ,
42
- Staking : pallet_staking_extension:: { Pallet , Call , Storage , Event < T > , Config < T > } ,
43
- FrameStaking : pallet_staking:: { Pallet , Call , Storage , Event < T > } ,
44
- Session : pallet_session:: { Pallet , Call , Storage , Event , Config < T > } ,
45
- Historical : pallet_session_historical:: { Pallet } ,
46
- BagsList : pallet_bags_list:: { Pallet , Call , Storage , Event < T > } ,
31
+ System : frame_system,
32
+ Balances : pallet_balances,
33
+ Timestamp : pallet_timestamp,
34
+ Authorship : pallet_authorship,
35
+ Relayer : pallet_relayer,
36
+ Constraints : pallet_constraints,
37
+ Propagation : pallet_propagation,
38
+ Staking : pallet_staking_extension,
39
+ FrameStaking : pallet_staking,
40
+ Session : pallet_session,
41
+ Historical : pallet_session_historical,
42
+ BagsList : pallet_bags_list,
47
43
}
48
44
) ;
49
45
@@ -56,17 +52,16 @@ impl system::Config for Test {
56
52
type AccountData = pallet_balances:: AccountData < Balance > ;
57
53
type AccountId = u64 ;
58
54
type BaseCallFilter = frame_support:: traits:: Everything ;
55
+ type Block = Block ;
59
56
type BlockHashCount = BlockHashCount ;
60
57
type BlockLength = ( ) ;
61
- type BlockNumber = u64 ;
62
58
type BlockWeights = ( ) ;
63
59
type DbWeight = ( ) ;
64
60
type Hash = H256 ;
65
61
type Hashing = BlakeTwo256 ;
66
- type Header = Header ;
67
- type Index = u64 ;
68
62
type Lookup = IdentityLookup < Self :: AccountId > ;
69
63
type MaxConsumers = frame_support:: traits:: ConstU32 < 16 > ;
64
+ type Nonce = u64 ;
70
65
type OnKilledAccount = ( ) ;
71
66
type OnNewAccount = ( ) ;
72
67
type OnSetCode = ( ) ;
@@ -100,13 +95,13 @@ impl pallet_balances::Config for Test {
100
95
type DustRemoval = ( ) ;
101
96
type ExistentialDeposit = ExistentialDeposit ;
102
97
type FreezeIdentifier = ( ) ;
103
- type HoldIdentifier = ( ) ;
104
98
type MaxFreezes = ( ) ;
105
99
type MaxHolds = ( ) ;
106
100
type MaxLocks = MaxLocks ;
107
101
type MaxReserves = ( ) ;
108
102
type ReserveIdentifier = [ u8 ; 8 ] ;
109
103
type RuntimeEvent = RuntimeEvent ;
104
+ type RuntimeHoldReason = RuntimeHoldReason ;
110
105
type WeightInfo = ( ) ;
111
106
}
112
107
@@ -220,17 +215,17 @@ impl pallet_staking::Config for Test {
220
215
type BondingDuration = BondingDuration ;
221
216
type Currency = Balances ;
222
217
type CurrencyBalance = Balance ;
223
- type CurrencyToVote = frame_support :: traits :: SaturatingCurrencyToVote ;
218
+ type CurrencyToVote = ( ) ;
224
219
type ElectionProvider = onchain:: OnChainExecution < OnChainSeqPhragmen > ;
225
220
type EraPayout = pallet_staking:: ConvertCurve < RewardCurve > ;
221
+ type EventListeners = ( ) ;
226
222
type GenesisElectionProvider = Self :: ElectionProvider ;
227
223
type HistoryDepth = ConstU32 < 84 > ;
228
224
type MaxNominations = MaxNominations ;
229
225
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator ;
230
226
type MaxUnlockingChunks = ConstU32 < 32 > ;
231
227
type NextNewSession = Session ;
232
228
type OffendingValidatorsThreshold = OffendingValidatorsThreshold ;
233
- type OnStakerSlash = ( ) ;
234
229
type Reward = ( ) ;
235
230
type RewardRemainder = ( ) ;
236
231
type RuntimeEvent = RuntimeEvent ;
@@ -320,7 +315,7 @@ impl pallet_propagation::Config for Test {
320
315
321
316
// Build genesis storage according to the mock runtime.
322
317
pub fn new_test_ext ( ) -> sp_io:: TestExternalities {
323
- let mut t = system:: GenesisConfig :: default ( ) . build_storage :: < Test > ( ) . unwrap ( ) ;
318
+ let mut t = system:: GenesisConfig :: < Test > :: default ( ) . build_storage ( ) . unwrap ( ) ;
324
319
let pallet_staking_extension = pallet_staking_extension:: GenesisConfig :: < Test > {
325
320
threshold_servers : vec ! [
326
321
( 5 , ServerInfo { tss_account: 7 , x25519_public_key: NULL_ARR , endpoint: vec![ 20 ] } ) ,
0 commit comments