zksync_os_evm_errors/lib.rs
1#![cfg_attr(not(feature = "std"), no_std)]
2
3extern crate alloc;
4
5/// Internal reasons of possible EVM failures. Declared in a separate module for reuse in tracers.
6/// Copied from Geth and modified: https://github.com/ethereum/go-ethereum/blob/3ff99ae52c420477020ae957a61c5c216ac7e7f5/core/vm/errors.go
7///
8/// Note: errors marked as *Call-specific* can be returned during call (call/constructor) before any opcode execution.
9/// Technically, internal VM frame doesn't exist in that moment (see `on_call_error` in Tracer trait)
10#[repr(u8)]
11#[derive(Debug, Clone, PartialEq, Eq)]
12pub enum EvmError {
13 /// Revert caused by REVERT opcode
14 Revert,
15 OutOfGas,
16 /// Invalid JUMP opcode destination
17 InvalidJump,
18 /// Attempt to access returndata with invalid index (out of bounds)
19 ReturnDataOutOfBounds,
20 /// Unknown opcode
21 InvalidOpcode(u8),
22 StackUnderflow,
23 StackOverflow,
24 CallNotAllowedInsideStatic,
25 StateChangeDuringStaticCall,
26 /// Hit memory limit (offset > u32::MAX - 31), out of gas as result
27 MemoryLimitOOG,
28 /// Invalid operand (e.g. failed to cast), out of gas as result
29 InvalidOperandOOG,
30 /// Failed to pay gas for code deployment
31 CodeStoreOutOfGas,
32 /// *Call-specific*, callstack height exceeds allowed limit
33 CallTooDeep,
34 /// *Call-specific*, insufficient balance for transfer
35 InsufficientBalance,
36 /// *Call-specific*, attempt to deploy contract on already occupied address
37 CreateCollision,
38 /// *Call-specific*, caller nonce overflowed during deployment
39 NonceOverflow,
40 CreateContractSizeLimit,
41 CreateInitcodeSizeLimit,
42 CreateContractStartingWithEF,
43}