Halting¶
How an execution frame ends (Yellow Paper §9.4.2). A frame either halts
normally — one of HaltKind: STOP, RETURN, REVERT, or
SELFDESTRUCT — or enters the exceptional halting state, one of
ExceptionKind. An exceptional halt consumes all
remaining gas and reverts the frame's state changes. REVERT (EIP-140) is
the sole failure mode that instead refunds the remaining gas while still
rolling state back.
FrameStatus is the running/halted/exceptional tag.
RETURN and REVERT carry the frame output directly; interpret returns
that value.
type HaltKind¶
Ordinary frame stops. Only RETURN and REVERT produce output bytes.
union HaltKind = {
/* STOP: success, empty return data */
HaltStop : unit,
/* RETURN: success with output data */
HaltReturn : OutputSlice,
/* REVERT: state unwound, output kept (EIP-140) */
HaltRevert : OutputSlice,
/* SELFDESTRUCT: success, empty return data */
HaltSelfDestruct : unit
}A frame-output range with its coordinate and length packed existentially.
type OutputSlice = {
'off 'len,
output_region_valid_range('off, 'len).
OutputSliceFields('off, 'len)
}type FrameStatus¶
Per-frame execution status: running, halted normally, or exceptionally halted.
union FrameStatus = {
/* mid-execution */
Running : unit,
/* halted normally (YP §9.4.4) */
Halted : HaltKind,
/* halted exceptionally: all frame gas consumed, effects void */
Exceptional : ExceptionKind
}Exceptional halts (YP §9.4.2): each consumes all remaining gas and reverts the frame's state changes.
enum ExceptionKind = {
/* an opcode pops more items than the stack holds */
StackUnderflow,
/* a push would exceed the 1024-item stack limit */
StackOverflow,
/* the operation's cost exceeds the remaining gas */
OutOfGas,
/* an unassigned or fork-inactive opcode, or INVALID (0xfe) */
InvalidOpcode,
/* a jump target that is not a valid JUMPDEST */
InvalidJump,
/* EIP-214: state-changing op inside a STATICCALL */
StaticViolation,
/* a call or create beyond depth 1024 */
CallDepthExceeded,
/* a value transfer exceeding the sender's balance */
InsufficientBalance,
/* EIP-214 write protection */
WriteProtection,
/* EIP-3860 */
InitCodeTooLarge,
/* a nonce at its maximum cannot be bumped (EIP-2681) */
NonceOverflow,
/* EIP-684: CREATE into an occupied account */
AddressCollision,
}Ordinary frame stops. Only RETURN and REVERT produce output bytes.
union HaltKind = {
/* STOP: success, empty return data */
HaltStop : unit,
/* RETURN: success with output data */
HaltReturn : OutputSlice,
/* REVERT: state unwound, output kept (EIP-140) */
HaltRevert : OutputSlice,
/* SELFDESTRUCT: success, empty return data */
HaltSelfDestruct : unit
}