@@ -107,25 +107,6 @@ fn create_identity_info<T: Config>(num_fields: u32) -> IdentityInfo {
107
107
}
108
108
109
109
benchmarks ! {
110
- // These are the common parameters along with their instancing.
111
- _ {
112
- let r in 1 .. T :: MaxRegistrars :: get( ) => add_registrars:: <T >( r) ?;
113
- // extra parameter for the set_subs bench for previous sub accounts
114
- let p in 1 .. T :: MaxSubAccounts :: get( ) => ( ) ;
115
- let s in 1 .. T :: MaxSubAccounts :: get( ) => {
116
- // Give them s many sub accounts
117
- let caller: T :: AccountId = whitelisted_caller( ) ;
118
- let _ = add_sub_accounts:: <T >( & caller, s) ?;
119
- } ;
120
- let x in 1 .. T :: MaxAdditionalFields :: get( ) => {
121
- // Create their main identity with x additional fields
122
- let info = create_identity_info:: <T >( x) ;
123
- let caller: T :: AccountId = whitelisted_caller( ) ;
124
- let caller_origin = <T as frame_system:: Config >:: Origin :: from( RawOrigin :: Signed ( caller) ) ;
125
- Identity :: <T >:: set_identity( caller_origin, info) ?;
126
- } ;
127
- }
128
-
129
110
add_registrar {
130
111
let r in 1 .. T :: MaxRegistrars :: get( ) - 1 => add_registrars:: <T >( r) ?;
131
112
ensure!( Registrars :: <T >:: get( ) . len( ) as u32 == r, "Registrars not set up correctly." ) ;
@@ -135,10 +116,8 @@ benchmarks! {
135
116
}
136
117
137
118
set_identity {
138
- let r in ...;
139
- // This X doesn't affect the caller ID up front like with the others, so we don't use the
140
- // standard preparation.
141
- let x in _ .. _ => ( ) ;
119
+ let r in 1 .. T :: MaxRegistrars :: get( ) => add_registrars:: <T >( r) ?;
120
+ let x in 1 .. T :: MaxAdditionalFields :: get( ) ;
142
121
let caller = {
143
122
// The target user
144
123
let caller: T :: AccountId = whitelisted_caller( ) ;
@@ -204,9 +183,19 @@ benchmarks! {
204
183
let caller_lookup = <T :: Lookup as StaticLookup >:: unlookup( caller. clone( ) ) ;
205
184
let _ = T :: Currency :: make_free_balance_be( & caller, BalanceOf :: <T >:: max_value( ) ) ;
206
185
207
- let r in ...;
208
- let s in ...;
209
- let x in ...;
186
+ let r in 1 .. T :: MaxRegistrars :: get( ) => add_registrars:: <T >( r) ?;
187
+ let s in 1 .. T :: MaxSubAccounts :: get( ) => {
188
+ // Give them s many sub accounts
189
+ let caller: T :: AccountId = whitelisted_caller( ) ;
190
+ let _ = add_sub_accounts:: <T >( & caller, s) ?;
191
+ } ;
192
+ let x in 1 .. T :: MaxAdditionalFields :: get( ) => {
193
+ // Create their main identity with x additional fields
194
+ let info = create_identity_info:: <T >( x) ;
195
+ let caller: T :: AccountId = whitelisted_caller( ) ;
196
+ let caller_origin = <T as frame_system:: Config >:: Origin :: from( RawOrigin :: Signed ( caller) ) ;
197
+ Identity :: <T >:: set_identity( caller_origin, info) ?;
198
+ } ;
210
199
211
200
// User requests judgement from all the registrars, and they approve
212
201
for i in 0 ..r {
@@ -228,8 +217,14 @@ benchmarks! {
228
217
let caller: T :: AccountId = whitelisted_caller( ) ;
229
218
let _ = T :: Currency :: make_free_balance_be( & caller, BalanceOf :: <T >:: max_value( ) ) ;
230
219
231
- let r in ...;
232
- let x in ...;
220
+ let r in 1 .. T :: MaxRegistrars :: get( ) => add_registrars:: <T >( r) ?;
221
+ let x in 1 .. T :: MaxAdditionalFields :: get( ) => {
222
+ // Create their main identity with x additional fields
223
+ let info = create_identity_info:: <T >( x) ;
224
+ let caller: T :: AccountId = whitelisted_caller( ) ;
225
+ let caller_origin = <T as frame_system:: Config >:: Origin :: from( RawOrigin :: Signed ( caller) ) ;
226
+ Identity :: <T >:: set_identity( caller_origin, info) ?;
227
+ } ;
233
228
} : _( RawOrigin :: Signed ( caller. clone( ) ) , r - 1 , 10u32 . into( ) )
234
229
verify {
235
230
assert_last_event:: <T >( Event :: <T >:: JudgementRequested ( caller, r-1 ) . into( ) ) ;
@@ -240,8 +235,14 @@ benchmarks! {
240
235
let caller_origin = <T as frame_system:: Config >:: Origin :: from( RawOrigin :: Signed ( caller. clone( ) ) ) ;
241
236
let _ = T :: Currency :: make_free_balance_be( & caller, BalanceOf :: <T >:: max_value( ) ) ;
242
237
243
- let r in ...;
244
- let x in ...;
238
+ let r in 1 .. T :: MaxRegistrars :: get( ) => add_registrars:: <T >( r) ?;
239
+ let x in 1 .. T :: MaxAdditionalFields :: get( ) => {
240
+ // Create their main identity with x additional fields
241
+ let info = create_identity_info:: <T >( x) ;
242
+ let caller: T :: AccountId = whitelisted_caller( ) ;
243
+ let caller_origin = <T as frame_system:: Config >:: Origin :: from( RawOrigin :: Signed ( caller) ) ;
244
+ Identity :: <T >:: set_identity( caller_origin, info) ?;
245
+ } ;
245
246
246
247
Identity :: <T >:: request_judgement( caller_origin, r - 1 , 10u32 . into( ) ) ?;
247
248
} : _( RawOrigin :: Signed ( caller. clone( ) ) , r - 1 )
@@ -308,8 +309,7 @@ benchmarks! {
308
309
let _ = T :: Currency :: make_free_balance_be( & caller, BalanceOf :: <T >:: max_value( ) ) ;
309
310
310
311
let r in 1 .. T :: MaxRegistrars :: get( ) - 1 => add_registrars:: <T >( r) ?;
311
- // For this x, it's the user identity that gts the fields, not the caller.
312
- let x in _ .. _ => {
312
+ let x in 1 .. T :: MaxAdditionalFields :: get( ) => {
313
313
let info = create_identity_info:: <T >( x) ;
314
314
Identity :: <T >:: set_identity( user_origin. clone( ) , info) ?;
315
315
} ;
@@ -322,10 +322,9 @@ benchmarks! {
322
322
}
323
323
324
324
kill_identity {
325
- let r in ...;
326
- // Setting up our own account below.
327
- let s in _ .. _ => { } ;
328
- let x in _ .. _ => { } ;
325
+ let r in 1 .. T :: MaxRegistrars :: get( ) => add_registrars:: <T >( r) ?;
326
+ let s in 1 .. T :: MaxSubAccounts :: get( ) ;
327
+ let x in 1 .. T :: MaxAdditionalFields :: get( ) ;
329
328
330
329
let target: T :: AccountId = account( "target" , 0 , SEED ) ;
331
330
let target_origin: <T as frame_system:: Config >:: Origin = RawOrigin :: Signed ( target. clone( ) ) . into( ) ;
0 commit comments