@@ -39,6 +39,7 @@ type BlockNumber = u64;
39
39
40
40
// example module to test behaviors.
41
41
#[ frame_support:: pallet( dev_mode) ]
42
+ #[ allow( clippy:: large_enum_variant) ]
42
43
pub mod example {
43
44
use frame_support:: { dispatch:: WithPostDispatchInfo , pallet_prelude:: * } ;
44
45
use frame_system:: pallet_prelude:: * ;
@@ -127,14 +128,14 @@ type Block = frame_system::mocking::MockBlock<Test>;
127
128
frame_support:: construct_runtime!(
128
129
pub enum Test
129
130
{
130
- System : frame_system,
131
- Timestamp : pallet_timestamp,
132
- Balances : pallet_balances,
133
- RootTesting : pallet_root_testing,
134
- Council : pallet_collective:: <Instance1 >,
135
- Utility : utility,
136
- Example : example,
137
- Democracy : mock_democracy,
131
+ System : frame_system = 1 ,
132
+ Timestamp : pallet_timestamp = 2 ,
133
+ Balances : pallet_balances = 3 ,
134
+ RootTesting : pallet_root_testing = 4 ,
135
+ Council : pallet_collective:: <Instance1 > = 5 ,
136
+ Utility : utility = 6 ,
137
+ Example : example = 7 ,
138
+ Democracy : mock_democracy = 8 ,
138
139
}
139
140
) ;
140
141
@@ -174,7 +175,7 @@ parameter_types! {
174
175
pub const MotionDuration : BlockNumber = MOTION_DURATION_IN_BLOCKS ;
175
176
pub const MaxProposals : u32 = 100 ;
176
177
pub const MaxMembers : u32 = 100 ;
177
- pub MaxProposalWeight : Weight = sp_runtime :: Perbill :: from_percent ( 50 ) * BlockWeights :: get( ) . max_block;
178
+ pub MaxProposalWeight : Weight = BlockWeights :: get( ) . max_block. saturating_div ( 2 ) ;
178
179
}
179
180
180
181
pub struct MemberProposals ;
@@ -255,19 +256,19 @@ use pallet_timestamp::Call as TimestampCall;
255
256
pub fn new_test_ext ( ) -> sp_io:: TestExternalities {
256
257
let mut t = frame_system:: GenesisConfig :: < Test > :: default ( )
257
258
. build_storage ( )
258
- . unwrap ( ) ;
259
+ . expect ( "Failed to build storage for test" ) ;
259
260
pallet_balances:: GenesisConfig :: < Test > {
260
261
balances : vec ! [ ( 1 , 10 ) , ( 2 , 10 ) , ( 3 , 10 ) , ( 4 , 10 ) , ( 5 , 2 ) ] ,
261
262
}
262
263
. assimilate_storage ( & mut t)
263
- . unwrap ( ) ;
264
+ . expect ( "Failed to build storage for test" ) ;
264
265
265
266
pallet_collective:: GenesisConfig :: < Test , Instance1 > {
266
267
members : vec ! [ 1 , 2 , 3 ] ,
267
268
phantom : Default :: default ( ) ,
268
269
}
269
270
. assimilate_storage ( & mut t)
270
- . unwrap ( ) ;
271
+ . expect ( "Failed to build storage for test" ) ;
271
272
272
273
let mut ext = sp_io:: TestExternalities :: new ( t) ;
273
274
ext. execute_with ( || System :: set_block_number ( 1 ) ) ;
@@ -688,7 +689,7 @@ fn batch_all_handles_weight_refund() {
688
689
assert_err_ignore_postinfo ! ( result, "The cake is a lie." ) ;
689
690
assert_eq ! (
690
691
extract_actual_weight( & result, & info) ,
691
- info. weight - diff * batch_len
692
+ info. weight. saturating_sub ( diff. saturating_mul ( batch_len) )
692
693
) ;
693
694
694
695
// Partial batch completion
@@ -702,7 +703,7 @@ fn batch_all_handles_weight_refund() {
702
703
assert_eq ! (
703
704
extract_actual_weight( & result, & info) ,
704
705
// Real weight is 2 calls at end_weight
705
- <Test as Config >:: WeightInfo :: batch_all( 2 ) + end_weight * 2 ,
706
+ <Test as Config >:: WeightInfo :: batch_all( 2 ) . saturating_add ( end_weight. saturating_mul ( 2 ) ) ,
706
707
) ;
707
708
} ) ;
708
709
}
0 commit comments