File tree 2 files changed +12
-13
lines changed
2 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ benchmarks_instance_pallet! {
146
146
) ;
147
147
}
148
148
149
- // Worst case when curator is inactive and any sender unassigns the curator,
149
+ // Worst case when curator is inactive and any sender unassigns the curator,
150
150
// or if `BountyUpdatePeriod` is large enough and `RejectOrigin` executes the call.
151
151
unassign_curator {
152
152
setup_pot_account:: <T , I >( ) ;
@@ -156,13 +156,14 @@ benchmarks_instance_pallet! {
156
156
let bounty_update_period = T :: BountyUpdatePeriod :: get( ) ;
157
157
let inactivity_timeout = T :: SpendPeriod :: get( ) . saturating_add( bounty_update_period) ;
158
158
set_block_number:: <T , I >( inactivity_timeout. saturating_add( 2u32 . into( ) ) ) ;
159
+ let caller: T :: AccountId = whitelisted_caller( ) ;
160
+ let signed_caller: T :: RuntimeOrigin = RawOrigin :: Signed ( caller. clone( ) ) . into( ) ;
159
161
160
162
// If `BountyUpdatePeriod` overflows the inactivity timeout the benchmark still executes the slash
161
163
let origin = if Pallet :: <T , I >:: treasury_block_number( ) <= inactivity_timeout {
162
- T :: RejectOrigin :: try_successful_origin( ) . map_err ( |_| BenchmarkError :: Weightless ) ?
164
+ T :: RejectOrigin :: try_successful_origin( ) . unwrap_or_else ( |_| signed_caller )
163
165
} else {
164
- let caller: T :: AccountId = whitelisted_caller( ) ;
165
- RawOrigin :: Signed ( caller. clone( ) ) . into( )
166
+ signed_caller
166
167
} ;
167
168
} : _<T :: RuntimeOrigin >( origin, bounty_id)
168
169
Original file line number Diff line number Diff line change @@ -277,21 +277,19 @@ mod benchmarks {
277
277
let bounty_update_period = T :: BountyUpdatePeriod :: get ( ) ;
278
278
let inactivity_timeout = T :: SpendPeriod :: get ( ) . saturating_add ( bounty_update_period) ;
279
279
set_block_number :: < T > ( inactivity_timeout. saturating_add ( 1u32 . into ( ) ) ) ;
280
+ let caller: T :: AccountId = whitelisted_caller ( ) ;
281
+ let signed_caller: T :: RuntimeOrigin = RawOrigin :: Signed ( caller. clone ( ) ) . into ( ) ;
280
282
281
- // If `BountyUpdatePeriod` overflows the inactivity timeout the benchmark still executes the slash
283
+ // If `BountyUpdatePeriod` overflows the inactivity timeout the benchmark still
284
+ // executes the slash
282
285
let origin = if Pallet :: < T > :: treasury_block_number ( ) <= inactivity_timeout {
283
- T :: RejectOrigin :: try_successful_origin ( ) . map_err ( |_| BenchmarkError :: Weightless ) ?
286
+ T :: RejectOrigin :: try_successful_origin ( ) . unwrap_or_else ( |_| signed_caller )
284
287
} else {
285
- let caller: T :: AccountId = whitelisted_caller ( ) ;
286
- RawOrigin :: Signed ( caller. clone ( ) ) . into ( )
288
+ signed_caller
287
289
} ;
288
290
289
291
#[ extrinsic_call]
290
- _ (
291
- origin as T :: RuntimeOrigin ,
292
- bounty_setup. bounty_id ,
293
- bounty_setup. child_bounty_id ,
294
- ) ;
292
+ _ ( origin as T :: RuntimeOrigin , bounty_setup. bounty_id , bounty_setup. child_bounty_id ) ;
295
293
296
294
Ok ( ( ) )
297
295
}
You can’t perform that action at this time.
0 commit comments