@@ -170,7 +170,9 @@ impl AggregateMetrics {
170
170
if stats. is_none ( ) {
171
171
continue ;
172
172
}
173
- let stats = stats. unwrap ( ) ;
173
+ let stats = stats. unwrap_or_else ( || {
174
+ panic ! ( "Missing proof time statistics for group '{}'" , group_name)
175
+ } ) ;
174
176
let mut sum = stats. sum ;
175
177
let mut max = stats. max ;
176
178
// convert ms to s
@@ -185,9 +187,17 @@ impl AggregateMetrics {
185
187
if !group_name. contains ( "keygen" ) {
186
188
// Proving time in keygen group is dummy and not part of total.
187
189
total_proof_time. val += sum. val ;
188
- * total_proof_time. diff . as_mut ( ) . unwrap ( ) += sum. diff . unwrap_or ( 0.0 ) ;
190
+ * total_proof_time
191
+ . diff
192
+ . as_mut ( )
193
+ . expect ( "total_proof_time.diff should be initialized" ) +=
194
+ sum. diff . unwrap_or ( 0.0 ) ;
189
195
total_par_proof_time. val += max. val ;
190
- * total_par_proof_time. diff . as_mut ( ) . unwrap ( ) += max. diff . unwrap_or ( 0.0 ) ;
196
+ * total_par_proof_time
197
+ . diff
198
+ . as_mut ( )
199
+ . expect ( "total_par_proof_time.diff should be initialized" ) +=
200
+ max. diff . unwrap_or ( 0.0 ) ;
191
201
192
202
// Account for the serial execute_metered and execute_e1 for app outside of segments
193
203
if group_name != "leaf"
@@ -203,17 +213,33 @@ impl AggregateMetrics {
203
213
total_proof_time. val += execute_metered_stats. avg . val / 1000.0 ;
204
214
total_par_proof_time. val += execute_metered_stats. avg . val / 1000.0 ;
205
215
if let Some ( diff) = execute_metered_stats. avg . diff {
206
- * total_proof_time. diff . as_mut ( ) . unwrap ( ) += diff / 1000.0 ;
207
- * total_par_proof_time. diff . as_mut ( ) . unwrap ( ) += diff / 1000.0 ;
216
+ * total_proof_time
217
+ . diff
218
+ . as_mut ( )
219
+ . expect ( "total_proof_time.diff should be initialized" ) +=
220
+ diff / 1000.0 ;
221
+ * total_par_proof_time
222
+ . diff
223
+ . as_mut ( )
224
+ . expect ( "total_par_proof_time.diff should be initialized" ) +=
225
+ diff / 1000.0 ;
208
226
}
209
227
}
210
228
211
229
if let Some ( execute_e1_stats) = execute_e1_stats {
212
230
total_proof_time. val += execute_e1_stats. avg . val / 1000.0 ;
213
231
total_par_proof_time. val += execute_e1_stats. avg . val / 1000.0 ;
214
232
if let Some ( diff) = execute_e1_stats. avg . diff {
215
- * total_proof_time. diff . as_mut ( ) . unwrap ( ) += diff / 1000.0 ;
216
- * total_par_proof_time. diff . as_mut ( ) . unwrap ( ) += diff / 1000.0 ;
233
+ * total_proof_time
234
+ . diff
235
+ . as_mut ( )
236
+ . expect ( "total_proof_time.diff should be initialized" ) +=
237
+ diff / 1000.0 ;
238
+ * total_par_proof_time
239
+ . diff
240
+ . as_mut ( )
241
+ . expect ( "total_par_proof_time.diff should be initialized" ) +=
242
+ diff / 1000.0 ;
217
243
}
218
244
}
219
245
}
@@ -251,7 +277,13 @@ impl AggregateMetrics {
251
277
. into_iter ( )
252
278
. map ( |group_name| {
253
279
let key = group_name. clone ( ) ;
254
- let value = self . by_group . get ( group_name) . unwrap ( ) . clone ( ) ;
280
+ let value = self
281
+ . by_group
282
+ . get ( group_name)
283
+ . unwrap_or_else ( || {
284
+ panic ! ( "Group '{}' should exist in by_group map" , group_name)
285
+ } )
286
+ . clone ( ) ;
255
287
( key, value)
256
288
} )
257
289
. collect ( )
@@ -363,7 +395,9 @@ impl AggregateMetrics {
363
395
if stats. is_none ( ) {
364
396
continue ;
365
397
}
366
- let stats = stats. unwrap ( ) ;
398
+ let stats = stats. unwrap_or_else ( || {
399
+ panic ! ( "Missing proof time statistics for group '{}'" , group_name)
400
+ } ) ;
367
401
let mut sum = stats. sum ;
368
402
let mut max = stats. max ;
369
403
// convert ms to s
@@ -394,7 +428,12 @@ impl AggregateMetrics {
394
428
self . by_group
395
429
. keys ( )
396
430
. find ( |k| group_weight ( k) == 0 )
397
- . unwrap_or_else ( || self . by_group . keys ( ) . next ( ) . unwrap ( ) )
431
+ . unwrap_or_else ( || {
432
+ self . by_group
433
+ . keys ( )
434
+ . next ( )
435
+ . expect ( "by_group should contain at least one group" )
436
+ } )
398
437
. clone ( )
399
438
}
400
439
}
0 commit comments