@@ -295,21 +295,24 @@ where
295295 // Some of these errors are from operations in the Runtime or SDK layer
296296 // before or after the underlying VM send syscall.
297297 ErrorNumber :: NotFound => {
298- // How do we know the receiver is what triggered this?
299- // An error number doesn't carry enough information at this level
300- // above the raw syscall (and even then).
301- actor_error ! ( not_found; "receiver not found" )
298+ // This means that the receiving actor doesn't exist.
299+ // TODO: we can't reasonably determine the correct "exit code" here.
300+ actor_error ! ( unspecified; "receiver not found" )
302301 }
303302 ErrorNumber :: InsufficientFunds => {
304- // Actually this is more like an illegal argument where the caller attempted
305- // to transfer an amount larger than that representable by the VM's
306- // token amount type. Yes, the caller doesn't have that amount, but if they'd
307- // attempted to transfer a representable amount it would fail with
308- // SYS_INSUFFICIENT_FUNDS instead, so this difference is wierd.
303+ // This means that the send failed because we have insufficient funds. We will
304+ // get a _syscall error_, not an exit code, because the target actor will not
305+ // run (and therefore will not exit).
309306 actor_error ! ( insufficient_funds; "not enough funds" )
310307 }
308+ ErrorNumber :: LimitExceeded => {
309+ // This means we've exceeded the recursion limit.
310+ // TODO: Define a better exit code.
311+ actor_error ! ( user_assertion_failed; "recursion limit exceeded" )
312+ }
311313 err => {
312- actor_error ! ( unspecified; "unexpected error: {}" , err)
314+ // We don't expect any other syscall exit codes.
315+ actor_error ! ( user_assertion_failed; "unexpected error: {}" , err)
313316 }
314317 } ) ,
315318 }
@@ -456,7 +459,7 @@ pub fn trampoline<C: ActorCode>(params: u32) -> u32 {
456459 let ret = C :: invoke_method ( & mut rt, method, & params)
457460 . unwrap_or_else ( |err| fvm:: vm:: abort ( err. exit_code ( ) . value ( ) , Some ( err. msg ( ) ) ) ) ;
458461
459- // Abort with "unspecified " if the actor failed to validate the caller somewhere.
462+ // Abort with "assertion failed " if the actor failed to validate the caller somewhere.
460463 // We do this after handling the error, because the actor may have encountered an error before
461464 // it even could validate the caller.
462465 if !rt. caller_validated {
0 commit comments