@@ -198,9 +198,9 @@ fn fvm_machine_execute_message(
198
198
let mut executor = executor
199
199
. machine
200
200
. as_ref ( )
201
- . expect ( "missing executor" )
201
+ . context ( "missing executor" ) ?
202
202
. lock ( )
203
- . unwrap ( ) ;
203
+ . map_err ( |e| anyhow ! ( "executor lock poisoned: {e}" ) ) ? ;
204
204
let apply_ret = executor. execute_message ( message, apply_kind, chain_len as usize ) ?;
205
205
206
206
let exec_trace = if !apply_ret. exec_trace . is_empty ( ) {
@@ -243,11 +243,31 @@ fn fvm_machine_execute_message(
243
243
. map ( |info| info. to_string ( ) . into_boxed_str ( ) . into ( ) ) ;
244
244
245
245
// TODO: use the non-bigint token amount everywhere in the FVM
246
- let penalty: u128 = apply_ret. penalty . atto ( ) . try_into ( ) . unwrap ( ) ;
247
- let miner_tip: u128 = apply_ret. miner_tip . atto ( ) . try_into ( ) . unwrap ( ) ;
248
- let base_fee_burn: u128 = apply_ret. base_fee_burn . atto ( ) . try_into ( ) . unwrap ( ) ;
249
- let over_estimation_burn: u128 = apply_ret. over_estimation_burn . atto ( ) . try_into ( ) . unwrap ( ) ;
250
- let refund: u128 = apply_ret. refund . atto ( ) . try_into ( ) . unwrap ( ) ;
246
+ let penalty: u128 = apply_ret
247
+ . penalty
248
+ . atto ( )
249
+ . try_into ( )
250
+ . context ( "penalty exceeds u128 attoFIL" ) ?;
251
+ let miner_tip: u128 = apply_ret
252
+ . miner_tip
253
+ . atto ( )
254
+ . try_into ( )
255
+ . context ( "miner tip exceeds u128 attoFIL" ) ?;
256
+ let base_fee_burn: u128 = apply_ret
257
+ . base_fee_burn
258
+ . atto ( )
259
+ . try_into ( )
260
+ . context ( "base fee burn exceeds u128 attoFIL" ) ?;
261
+ let over_estimation_burn: u128 = apply_ret
262
+ . over_estimation_burn
263
+ . atto ( )
264
+ . try_into ( )
265
+ . context ( "overestimation burn exceeds u128 attoFIL" ) ?;
266
+ let refund: u128 = apply_ret
267
+ . refund
268
+ . atto ( )
269
+ . try_into ( )
270
+ . context ( "refund exceeds u128 attoFIL" ) ?;
251
271
let gas_refund = apply_ret. gas_refund ;
252
272
let gas_burned = apply_ret. gas_burned ;
253
273
@@ -313,9 +333,9 @@ fn fvm_machine_flush(executor: &'_ InnerFvmMachine) -> repr_c::Box<Result<c_slic
313
333
let mut executor = executor
314
334
. machine
315
335
. as_ref ( )
316
- . expect ( "missing executor" )
336
+ . context ( "missing executor" ) ?
317
337
. lock ( )
318
- . unwrap ( ) ;
338
+ . map_err ( |e| anyhow ! ( "executor lock poisoned: {e}" ) ) ? ;
319
339
let cid = executor. flush ( ) ?;
320
340
321
341
Ok ( cid. to_bytes ( ) . into_boxed_slice ( ) . into ( ) )
0 commit comments