#[non_exhaustive]pub enum ExitCode {
Halted(u32),
Paused(u32),
SystemSplit,
SessionLimit,
}
Expand description
Exit condition indicated by the zkVM at the end of the guest execution.
Exit codes have a “system” part and a “user” part. Semantically, the system part is set to indicate the type of exit (e.g. halt, pause, or system split) and is directly controlled by the zkVM. The user part is an exit code, similar to exit codes used in Linux, chosen by the guest program to indicate additional information (e.g. 0 to indicate success or 1 to indicate an error).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Halted(u32)
This indicates normal termination of a program with an interior exit code returned from the guest program. A halted program cannot be resumed.
Paused(u32)
This indicates the execution ended in a paused state with an interior exit code set by the guest program. A paused program can be resumed such that execution picks up where it left of, with the same memory state.
SystemSplit
This indicates the execution ended on a host-initiated system split.
System split is mechanism by which the host can temporarily stop execution of the guest. Execution ended in a system split has no output and no conclusions can be drawn about whether the program will eventually halt. System split is used in continuations to split execution into individually provable segments.
SessionLimit
This indicates that the guest exited upon reaching the session limit set by the host.
NOTE: The current version of the RISC Zero zkVM will never exit with an exit code of SessionLimit. This is because the system cannot currently prove that the session limit as been reached.
Implementations§
Source§impl ExitCode
impl ExitCode
Sourcepub fn into_pair(self) -> (u32, u32)
pub fn into_pair(self) -> (u32, u32)
Convert this ExitCode into a pair representation, where the first number is the “system” part, and the second is the “user” part. E.g. Halted(255) -> (0, 255)
Sourcepub fn from_pair(
sys_exit: u32,
user_exit: u32,
) -> Result<ExitCode, InvalidExitCodeError>
pub fn from_pair( sys_exit: u32, user_exit: u32, ) -> Result<ExitCode, InvalidExitCodeError>
Convert this ExitCode from its pair representation, where the first number is the “system” part, and the second is the “user” part. E.g. (0, 255) -> Halted(255)
Sourcepub fn expects_output(&self) -> bool
pub fn expects_output(&self) -> bool
Whether the verifier should expect a non-empty output field. Exit codes Halted and Paused produce can produce a non-empty outputs, whereas system initiated exits like SystemSplit do not.