@@ -47,12 +47,6 @@ pub(crate) type Balance = u128;
47
47
48
48
thread_local ! {
49
49
static SESSION : RefCell <( Vec <AccountId >, HashSet <AccountId >) > = RefCell :: new( Default :: default ( ) ) ;
50
- static SESSION_PER_ERA : RefCell <SessionIndex > = RefCell :: new( 3 ) ;
51
- static EXISTENTIAL_DEPOSIT : RefCell <Balance > = RefCell :: new( 0 ) ;
52
- static SLASH_DEFER_DURATION : RefCell <EraIndex > = RefCell :: new( 0 ) ;
53
- static ELECTION_LOOKAHEAD : RefCell <BlockNumber > = RefCell :: new( 0 ) ;
54
- static PERIOD : RefCell <BlockNumber > = RefCell :: new( 1 ) ;
55
- static MAX_ITERATIONS : RefCell <u32 > = RefCell :: new( 0 ) ;
56
50
}
57
51
58
52
/// Another session handler struct to test on_disabled.
@@ -92,53 +86,6 @@ pub fn is_disabled(controller: AccountId) -> bool {
92
86
SESSION . with ( |d| d. borrow ( ) . 1 . contains ( & stash) )
93
87
}
94
88
95
- pub struct ExistentialDeposit ;
96
- impl Get < Balance > for ExistentialDeposit {
97
- fn get ( ) -> Balance {
98
- EXISTENTIAL_DEPOSIT . with ( |v| * v. borrow ( ) )
99
- }
100
- }
101
-
102
- pub struct SessionsPerEra ;
103
- impl Get < SessionIndex > for SessionsPerEra {
104
- fn get ( ) -> SessionIndex {
105
- SESSION_PER_ERA . with ( |v| * v. borrow ( ) )
106
- }
107
- }
108
- impl Get < BlockNumber > for SessionsPerEra {
109
- fn get ( ) -> BlockNumber {
110
- SESSION_PER_ERA . with ( |v| * v. borrow ( ) as BlockNumber )
111
- }
112
- }
113
-
114
- pub struct ElectionLookahead ;
115
- impl Get < BlockNumber > for ElectionLookahead {
116
- fn get ( ) -> BlockNumber {
117
- ELECTION_LOOKAHEAD . with ( |v| * v. borrow ( ) )
118
- }
119
- }
120
-
121
- pub struct Period ;
122
- impl Get < BlockNumber > for Period {
123
- fn get ( ) -> BlockNumber {
124
- PERIOD . with ( |v| * v. borrow ( ) )
125
- }
126
- }
127
-
128
- pub struct SlashDeferDuration ;
129
- impl Get < EraIndex > for SlashDeferDuration {
130
- fn get ( ) -> EraIndex {
131
- SLASH_DEFER_DURATION . with ( |v| * v. borrow ( ) )
132
- }
133
- }
134
-
135
- pub struct MaxIterations ;
136
- impl Get < u32 > for MaxIterations {
137
- fn get ( ) -> u32 {
138
- MAX_ITERATIONS . with ( |v| * v. borrow ( ) )
139
- }
140
- }
141
-
142
89
impl_outer_origin ! {
143
90
pub enum Origin for Test where system = frame_system { }
144
91
}
@@ -186,7 +133,14 @@ parameter_types! {
186
133
pub const MaximumBlockLength : u32 = 2 * 1024 ;
187
134
pub const AvailableBlockRatio : Perbill = Perbill :: one( ) ;
188
135
pub const MaxLocks : u32 = 1024 ;
136
+ pub static SessionsPerEra : SessionIndex = 3 ;
137
+ pub static ExistentialDeposit : Balance = 0 ;
138
+ pub static SlashDeferDuration : EraIndex = 0 ;
139
+ pub static ElectionLookahead : BlockNumber = 0 ;
140
+ pub static Period : BlockNumber = 1 ;
141
+ pub static MaxIterations : u32 = 0 ;
189
142
}
143
+
190
144
impl frame_system:: Trait for Test {
191
145
type BaseCallFilter = ( ) ;
192
146
type Origin = Origin ;
@@ -437,7 +391,7 @@ impl ExtBuilder {
437
391
pub fn set_associated_constants ( & self ) {
438
392
EXISTENTIAL_DEPOSIT . with ( |v| * v. borrow_mut ( ) = self . existential_deposit ) ;
439
393
SLASH_DEFER_DURATION . with ( |v| * v. borrow_mut ( ) = self . slash_defer_duration ) ;
440
- SESSION_PER_ERA . with ( |v| * v. borrow_mut ( ) = self . session_per_era ) ;
394
+ SESSIONS_PER_ERA . with ( |v| * v. borrow_mut ( ) = self . session_per_era ) ;
441
395
ELECTION_LOOKAHEAD . with ( |v| * v. borrow_mut ( ) = self . election_lookahead ) ;
442
396
PERIOD . with ( |v| * v. borrow_mut ( ) = self . session_length ) ;
443
397
MAX_ITERATIONS . with ( |v| * v. borrow_mut ( ) = self . max_offchain_iterations ) ;
0 commit comments