Skip to content

Commit fde84c5

Browse files
committed
fix: propagate non-system exit codes in send
The real fix is discussed in #144, but this version is strictly "more correct" than the previous code.
1 parent 6e42079 commit fde84c5

File tree

1 file changed

+14
-3
lines changed
  • actors/runtime/src/runtime

1 file changed

+14
-3
lines changed

actors/runtime/src/runtime/fvm.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,23 @@ where
271271
// The returned code can't be simply propagated as it may be a system exit code.
272272
// TODO: improve propagation once we return a RuntimeError.
273273
// Ref https://github.com/filecoin-project/builtin-actors/issues/144
274-
Err(actor_error!(
275-
user_assertion_failed,
274+
let exit_code = match ret.exit_code {
275+
// This means the called actor did something wrong. We can't "make up" a
276+
// reasonable exit code.
277+
ExitCode::SYS_MISSING_RETURN
278+
| ExitCode::SYS_ILLEGAL_INSTRUCTION
279+
| ExitCode::SYS_ILLEGAL_EXIT_CODE => ExitCode::USR_UNSPECIFIED,
280+
// We don't expect any other system errors.
281+
code if code.is_system_error() => ExitCode::USR_ASSERTION_FAILED,
282+
// Otherwise, pass it through.
283+
code => code,
284+
};
285+
Err(ActorError::unchecked(
286+
exit_code,
276287
format!(
277288
"send to {} method {} aborted with code {}",
278289
to, method, ret.exit_code
279-
)
290+
),
280291
))
281292
}
282293
}

0 commit comments

Comments
 (0)