pub const true_: u32 = 1;
pub const false_: u32 = 0;
pub const __bool_true_false_are_defined: u32 = 1;
pub const _STDINT_H: u32 = 1;
pub const _FEATURES_H: u32 = 1;
pub const _DEFAULT_SOURCE: u32 = 1;
pub const __GLIBC_USE_ISOC2X: u32 = 0;
pub const __USE_ISOC11: u32 = 1;
pub const __USE_ISOC99: u32 = 1;
pub const __USE_ISOC95: u32 = 1;
pub const __USE_POSIX_IMPLICITLY: u32 = 1;
pub const _POSIX_SOURCE: u32 = 1;
pub const _POSIX_C_SOURCE: u32 = 200809;
pub const __USE_POSIX: u32 = 1;
pub const __USE_POSIX2: u32 = 1;
pub const __USE_POSIX199309: u32 = 1;
pub const __USE_POSIX199506: u32 = 1;
pub const __USE_XOPEN2K: u32 = 1;
pub const __USE_XOPEN2K8: u32 = 1;
pub const _ATFILE_SOURCE: u32 = 1;
pub const __USE_MISC: u32 = 1;
pub const __USE_ATFILE: u32 = 1;
pub const __USE_FORTIFY_LEVEL: u32 = 0;
pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0;
pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0;
pub const _STDC_PREDEF_H: u32 = 1;
pub const __STDC_IEC_559__: u32 = 1;
pub const __STDC_IEC_559_COMPLEX__: u32 = 1;
pub const __STDC_ISO_10646__: u32 = 201706;
pub const __GNU_LIBRARY__: u32 = 6;
pub const __GLIBC__: u32 = 2;
pub const __GLIBC_MINOR__: u32 = 31;
pub const _SYS_CDEFS_H: u32 = 1;
pub const __glibc_c99_flexarr_available: u32 = 1;
pub const __WORDSIZE: u32 = 64;
pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1;
pub const __SYSCALL_WORDSIZE: u32 = 64;
pub const __LONG_DOUBLE_USES_FLOAT128: u32 = 0;
pub const __HAVE_GENERIC_SELECTION: u32 = 1;
pub const __GLIBC_USE_LIB_EXT2: u32 = 0;
pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0;
pub const __GLIBC_USE_IEC_60559_BFP_EXT_C2X: u32 = 0;
pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0;
pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X: u32 = 0;
pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0;
pub const _BITS_TYPES_H: u32 = 1;
pub const __TIMESIZE: u32 = 64;
pub const _BITS_TYPESIZES_H: u32 = 1;
pub const __OFF_T_MATCHES_OFF64_T: u32 = 1;
pub const __INO_T_MATCHES_INO64_T: u32 = 1;
pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1;
pub const __STATFS_MATCHES_STATFS64: u32 = 1;
pub const __FD_SETSIZE: u32 = 1024;
pub const _BITS_TIME64_H: u32 = 1;
pub const _BITS_WCHAR_H: u32 = 1;
pub const _BITS_STDINT_INTN_H: u32 = 1;
pub const _BITS_STDINT_UINTN_H: u32 = 1;
pub const INT8_MIN: i32 = -128;
pub const INT16_MIN: i32 = -32768;
pub const INT32_MIN: i32 = -2147483648;
pub const INT8_MAX: u32 = 127;
pub const INT16_MAX: u32 = 32767;
pub const INT32_MAX: u32 = 2147483647;
pub const UINT8_MAX: u32 = 255;
pub const UINT16_MAX: u32 = 65535;
pub const UINT32_MAX: u32 = 4294967295;
pub const INT_LEAST8_MIN: i32 = -128;
pub const INT_LEAST16_MIN: i32 = -32768;
pub const INT_LEAST32_MIN: i32 = -2147483648;
pub const INT_LEAST8_MAX: u32 = 127;
pub const INT_LEAST16_MAX: u32 = 32767;
pub const INT_LEAST32_MAX: u32 = 2147483647;
pub const UINT_LEAST8_MAX: u32 = 255;
pub const UINT_LEAST16_MAX: u32 = 65535;
pub const UINT_LEAST32_MAX: u32 = 4294967295;
pub const INT_FAST8_MIN: i32 = -128;
pub const INT_FAST16_MIN: i64 = -9223372036854775808;
pub const INT_FAST32_MIN: i64 = -9223372036854775808;
pub const INT_FAST8_MAX: u32 = 127;
pub const INT_FAST16_MAX: u64 = 9223372036854775807;
pub const INT_FAST32_MAX: u64 = 9223372036854775807;
pub const UINT_FAST8_MAX: u32 = 255;
pub const UINT_FAST16_MAX: i32 = -1;
pub const UINT_FAST32_MAX: i32 = -1;
pub const INTPTR_MIN: i64 = -9223372036854775808;
pub const INTPTR_MAX: u64 = 9223372036854775807;
pub const UINTPTR_MAX: i32 = -1;
pub const PTRDIFF_MIN: i64 = -9223372036854775808;
pub const PTRDIFF_MAX: u64 = 9223372036854775807;
pub const SIG_ATOMIC_MIN: i32 = -2147483648;
pub const SIG_ATOMIC_MAX: u32 = 2147483647;
pub const SIZE_MAX: i32 = -1;
pub const WINT_MIN: u32 = 0;
pub const WINT_MAX: u32 = 4294967295;
pub type wchar_t = ::std::os::raw::c_int;
#[repr(C)]
#[repr(align(16))]
#[derive(Debug, Copy, Clone)]
pub struct max_align_t {
pub __clang_max_align_nonce1: ::std::os::raw::c_longlong,
pub __bindgen_padding_0: u64,
pub __clang_max_align_nonce2: u128,
}
pub type __u_char = ::std::os::raw::c_uchar;
pub type __u_short = ::std::os::raw::c_ushort;
pub type __u_int = ::std::os::raw::c_uint;
pub type __u_long = ::std::os::raw::c_ulong;
pub type __int8_t = ::std::os::raw::c_schar;
pub type __uint8_t = ::std::os::raw::c_uchar;
pub type __int16_t = ::std::os::raw::c_short;
pub type __uint16_t = ::std::os::raw::c_ushort;
pub type __int32_t = ::std::os::raw::c_int;
pub type __uint32_t = ::std::os::raw::c_uint;
pub type __int64_t = ::std::os::raw::c_long;
pub type __uint64_t = ::std::os::raw::c_ulong;
pub type __int_least8_t = __int8_t;
pub type __uint_least8_t = __uint8_t;
pub type __int_least16_t = __int16_t;
pub type __uint_least16_t = __uint16_t;
pub type __int_least32_t = __int32_t;
pub type __uint_least32_t = __uint32_t;
pub type __int_least64_t = __int64_t;
pub type __uint_least64_t = __uint64_t;
pub type __quad_t = ::std::os::raw::c_long;
pub type __u_quad_t = ::std::os::raw::c_ulong;
pub type __intmax_t = ::std::os::raw::c_long;
pub type __uintmax_t = ::std::os::raw::c_ulong;
pub type __dev_t = ::std::os::raw::c_ulong;
pub type __uid_t = ::std::os::raw::c_uint;
pub type __gid_t = ::std::os::raw::c_uint;
pub type __ino_t = ::std::os::raw::c_ulong;
pub type __ino64_t = ::std::os::raw::c_ulong;
pub type __mode_t = ::std::os::raw::c_uint;
pub type __nlink_t = ::std::os::raw::c_ulong;
pub type __off_t = ::std::os::raw::c_long;
pub type __off64_t = ::std::os::raw::c_long;
pub type __pid_t = ::std::os::raw::c_int;
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash)]
pub struct __fsid_t {
pub __val: [::std::os::raw::c_int; 2usize],
}
pub type __clock_t = ::std::os::raw::c_long;
pub type __rlim_t = ::std::os::raw::c_ulong;
pub type __rlim64_t = ::std::os::raw::c_ulong;
pub type __id_t = ::std::os::raw::c_uint;
pub type __time_t = ::std::os::raw::c_long;
pub type __useconds_t = ::std::os::raw::c_uint;
pub type __suseconds_t = ::std::os::raw::c_long;
pub type __daddr_t = ::std::os::raw::c_int;
pub type __key_t = ::std::os::raw::c_int;
pub type __clockid_t = ::std::os::raw::c_int;
pub type __timer_t = *mut ::std::os::raw::c_void;
pub type __blksize_t = ::std::os::raw::c_long;
pub type __blkcnt_t = ::std::os::raw::c_long;
pub type __blkcnt64_t = ::std::os::raw::c_long;
pub type __fsblkcnt_t = ::std::os::raw::c_ulong;
pub type __fsblkcnt64_t = ::std::os::raw::c_ulong;
pub type __fsfilcnt_t = ::std::os::raw::c_ulong;
pub type __fsfilcnt64_t = ::std::os::raw::c_ulong;
pub type __fsword_t = ::std::os::raw::c_long;
pub type __ssize_t = ::std::os::raw::c_long;
pub type __syscall_slong_t = ::std::os::raw::c_long;
pub type __syscall_ulong_t = ::std::os::raw::c_ulong;
pub type __loff_t = __off64_t;
pub type __caddr_t = *mut ::std::os::raw::c_char;
pub type __intptr_t = ::std::os::raw::c_long;
pub type __socklen_t = ::std::os::raw::c_uint;
pub type __sig_atomic_t = ::std::os::raw::c_int;
pub type int_least8_t = __int_least8_t;
pub type int_least16_t = __int_least16_t;
pub type int_least32_t = __int_least32_t;
pub type int_least64_t = __int_least64_t;
pub type uint_least8_t = __uint_least8_t;
pub type uint_least16_t = __uint_least16_t;
pub type uint_least32_t = __uint_least32_t;
pub type uint_least64_t = __uint_least64_t;
pub type int_fast8_t = ::std::os::raw::c_schar;
pub type int_fast16_t = ::std::os::raw::c_long;
pub type int_fast32_t = ::std::os::raw::c_long;
pub type int_fast64_t = ::std::os::raw::c_long;
pub type uint_fast8_t = ::std::os::raw::c_uchar;
pub type uint_fast16_t = ::std::os::raw::c_ulong;
pub type uint_fast32_t = ::std::os::raw::c_ulong;
pub type uint_fast64_t = ::std::os::raw::c_ulong;
pub type intmax_t = __intmax_t;
pub type uintmax_t = __uintmax_t;
pub const EVMC_ABI_VERSION: _bindgen_ty_1 = _bindgen_ty_1::EVMC_ABI_VERSION;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum _bindgen_ty_1 {
#[doc = " The EVMC ABI version number of the interface declared in this file."]
#[doc = ""]
#[doc = " The EVMC ABI version always equals the major version number of the EVMC project."]
#[doc = " The Host SHOULD check if the ABI versions match when dynamically loading VMs."]
#[doc = ""]
#[doc = " @see @ref versioning"]
EVMC_ABI_VERSION = 6,
}
#[doc = " The fixed size array of 32 bytes."]
#[doc = ""]
#[doc = " 32 bytes of data capable of storing e.g. 256-bit hashes."]
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash)]
pub struct evmc_bytes32 {
#[doc = " The 32 bytes."]
pub bytes: [u8; 32usize],
}
#[doc = " The alias for evmc_bytes32 to represent a big-endian 256-bit integer."]
pub type evmc_uint256be = evmc_bytes32;
#[doc = " Big-endian 160-bit hash suitable for keeping an Ethereum address."]
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash)]
pub struct evmc_address {
#[doc = " The 20 bytes of the hash."]
pub bytes: [u8; 20usize],
}
#[repr(u32)]
#[doc = " The kind of call-like instruction."]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum evmc_call_kind {
#[doc = "< Request CALL."]
EVMC_CALL = 0,
#[doc = "< Request DELEGATECALL. Valid since Homestead."]
#[doc = "The value param ignored."]
EVMC_DELEGATECALL = 1,
#[doc = "< Request CALLCODE."]
EVMC_CALLCODE = 2,
#[doc = "< Request CREATE."]
EVMC_CREATE = 3,
#[doc = "< Request CREATE2. Valid since Constantinople."]
EVMC_CREATE2 = 4,
}
#[repr(u32)]
#[doc = " The flags for ::evmc_message."]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum evmc_flags {
#[doc = "< Static call mode."]
EVMC_STATIC = 1,
}
#[doc = " The message describing an EVM call,"]
#[doc = " including a zero-depth calls from a transaction origin."]
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash)]
pub struct evmc_message {
#[doc = " The kind of the call. For zero-depth calls ::EVMC_CALL SHOULD be used."]
pub kind: evmc_call_kind,
#[doc = " Additional flags modifying the call execution behavior."]
#[doc = " In the current version the only valid values are ::EVMC_STATIC or 0."]
pub flags: u32,
#[doc = " The call depth."]
pub depth: i32,
#[doc = " The amount of gas for message execution."]
pub gas: i64,
#[doc = " The destination of the message."]
pub destination: evmc_address,
#[doc = " The sender of the message."]
pub sender: evmc_address,
#[doc = " The message input data."]
#[doc = ""]
#[doc = " This MAY be NULL."]
pub input_data: *const u8,
#[doc = " The size of the message input data."]
#[doc = ""]
#[doc = " If input_data is NULL this MUST be 0."]
pub input_size: usize,
#[doc = " The amount of Ether transferred with the message."]
pub value: evmc_uint256be,
#[doc = " The optional value used in new contract address construction."]
#[doc = ""]
#[doc = " Ignored unless kind is EVMC_CREATE2."]
pub create2_salt: evmc_bytes32,
}
#[doc = " The transaction and block data for execution."]
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash)]
pub struct evmc_tx_context {
#[doc = "< The transaction gas price."]
pub tx_gas_price: evmc_uint256be,
#[doc = "< The transaction origin account."]
pub tx_origin: evmc_address,
#[doc = "< The miner of the block."]
pub block_coinbase: evmc_address,
#[doc = "< The block number."]
pub block_number: i64,
#[doc = "< The block timestamp."]
pub block_timestamp: i64,
#[doc = "< The block gas limit."]
pub block_gas_limit: i64,
#[doc = "< The block difficulty."]
pub block_difficulty: evmc_uint256be,
}
#[doc = " Get transaction context callback function."]
#[doc = ""]
#[doc = " This callback function is used by an EVM to retrieve the transaction and"]
#[doc = " block context."]
#[doc = ""]
#[doc = " @param context The pointer to the Host execution context."]
#[doc = " @return The transaction context."]
pub type evmc_get_tx_context_fn =
::std::option::Option<unsafe extern "C" fn(context: *mut evmc_context) -> evmc_tx_context>;
#[doc = " Get block hash callback function."]
#[doc = ""]
#[doc = " This callback function is used by a VM to query the hash of the header of the given block."]
#[doc = " If the information about the requested block is not available, then this is signalled by"]
#[doc = " returning null bytes."]
#[doc = ""]
#[doc = " @param context The pointer to the Host execution context."]
#[doc = " @param number The block number."]
#[doc = " @return The block hash or null bytes"]
#[doc = " if the information about the block is not available."]
pub type evmc_get_block_hash_fn = ::std::option::Option<
unsafe extern "C" fn(context: *mut evmc_context, number: i64) -> evmc_bytes32,
>;
#[repr(i32)]
#[doc = " The execution status code."]
#[doc = ""]
#[doc = " Successful execution is represented by ::EVMC_SUCCESS having value 0."]
#[doc = ""]
#[doc = " Positive values represent failures defined by VM specifications with generic"]
#[doc = " ::EVMC_FAILURE code of value 1."]
#[doc = ""]
#[doc = " Status codes with negative values represent VM internal errors"]
#[doc = " not provided by EVM specifications. These errors MUST not be passed back"]
#[doc = " to the caller. They MAY be handled by the Client in predefined manner"]
#[doc = " (see e.g. ::EVMC_REJECTED), otherwise internal errors are not recoverable."]
#[doc = " The generic representant of errors is ::EVMC_INTERNAL_ERROR but"]
#[doc = " an EVM implementation MAY return negative status codes that are not defined"]
#[doc = " in the EVMC documentation."]
#[doc = ""]
#[doc = " @note"]
#[doc = " In case new status codes are needed, please create an issue or pull request"]
#[doc = " in the EVMC repository (https://github.com/ethereum/evmc)."]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum evmc_status_code {
#[doc = " Execution finished with success."]
EVMC_SUCCESS = 0,
#[doc = " Generic execution failure."]
EVMC_FAILURE = 1,
#[doc = " Execution terminated with REVERT opcode."]
#[doc = ""]
#[doc = " In this case the amount of gas left MAY be non-zero and additional output"]
#[doc = " data MAY be provided in ::evmc_result."]
EVMC_REVERT = 2,
#[doc = " The execution has run out of gas."]
EVMC_OUT_OF_GAS = 3,
#[doc = " The designated INVALID instruction has been hit during execution."]
#[doc = ""]
#[doc = " The EIP-141 (https://github.com/ethereum/EIPs/blob/master/EIPS/eip-141.md)"]
#[doc = " defines the instruction 0xfe as INVALID instruction to indicate execution"]
#[doc = " abortion coming from high-level languages. This status code is reported"]
#[doc = " in case this INVALID instruction has been encountered."]
EVMC_INVALID_INSTRUCTION = 4,
#[doc = " An undefined instruction has been encountered."]
EVMC_UNDEFINED_INSTRUCTION = 5,
#[doc = " The execution has attempted to put more items on the EVM stack"]
#[doc = " than the specified limit."]
EVMC_STACK_OVERFLOW = 6,
#[doc = " Execution of an opcode has required more items on the EVM stack."]
EVMC_STACK_UNDERFLOW = 7,
#[doc = " Execution has violated the jump destination restrictions."]
EVMC_BAD_JUMP_DESTINATION = 8,
#[doc = " Tried to read outside memory bounds."]
#[doc = ""]
#[doc = " An example is RETURNDATACOPY reading past the available buffer."]
EVMC_INVALID_MEMORY_ACCESS = 9,
#[doc = " Call depth has exceeded the limit (if any)"]
EVMC_CALL_DEPTH_EXCEEDED = 10,
#[doc = " Tried to execute an operation which is restricted in static mode."]
EVMC_STATIC_MODE_VIOLATION = 11,
#[doc = " A call to a precompiled or system contract has ended with a failure."]
#[doc = ""]
#[doc = " An example: elliptic curve functions handed invalid EC points."]
EVMC_PRECOMPILE_FAILURE = 12,
#[doc = " Contract validation has failed (e.g. due to EVM 1.5 jump validity,"]
#[doc = " Casper's purity checker or ewasm contract rules)."]
EVMC_CONTRACT_VALIDATION_FAILURE = 13,
#[doc = " An argument to a state accessing method has a value outside of the"]
#[doc = " accepted range of values."]
EVMC_ARGUMENT_OUT_OF_RANGE = 14,
#[doc = " A WebAssembly `unreachable` instruction has been hit during execution."]
EVMC_WASM_UNREACHABLE_INSTRUCTION = 15,
#[doc = " A WebAssembly trap has been hit during execution. This can be for many"]
#[doc = " reasons, including division by zero, validation errors, etc."]
EVMC_WASM_TRAP = 16,
#[doc = " EVM implementation generic internal error."]
EVMC_INTERNAL_ERROR = -1,
#[doc = " The execution of the given code and/or message has been rejected"]
#[doc = " by the EVM implementation."]
#[doc = ""]
#[doc = " This error SHOULD be used to signal that the EVM is not able to or"]
#[doc = " willing to execute the given code type or message."]
#[doc = " If an EVM returns the ::EVMC_REJECTED status code,"]
#[doc = " the Client MAY try to execute it in other EVM implementation."]
#[doc = " For example, the Client tries running a code in the EVM 1.5. If the"]
#[doc = " code is not supported there, the execution falls back to the EVM 1.0."]
EVMC_REJECTED = -2,
#[doc = " The VM failed to allocate the amount of memory needed for execution."]
EVMC_OUT_OF_MEMORY = -3,
}
#[doc = " Releases resources assigned to an execution result."]
#[doc = ""]
#[doc = " This function releases memory (and other resources, if any) assigned to the"]
#[doc = " specified execution result making the result object invalid."]
#[doc = ""]
#[doc = " @param result The execution result which resources are to be released. The"]
#[doc = " result itself it not modified by this function, but becomes"]
#[doc = " invalid and user MUST discard it as well."]
#[doc = " This MUST NOT be NULL."]
#[doc = ""]
#[doc = " @note"]
#[doc = " The result is passed by pointer to avoid (shallow) copy of the ::evmc_result"]
#[doc = " struct. Think of this as the best possible C language approximation to"]
#[doc = " passing objects by reference."]
pub type evmc_release_result_fn =
::std::option::Option<unsafe extern "C" fn(result: *const evmc_result)>;
#[doc = " The EVM code execution result."]
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash)]
pub struct evmc_result {
#[doc = " The execution status code."]
pub status_code: evmc_status_code,
#[doc = " The amount of gas left after the execution."]
#[doc = ""]
#[doc = " If evmc_result::code is not ::EVMC_SUCCESS nor ::EVMC_REVERT"]
#[doc = " the value MUST be 0."]
pub gas_left: i64,
#[doc = " The reference to output data."]
#[doc = ""]
#[doc = " The output contains data coming from RETURN opcode (iff evmc_result::code"]
#[doc = " field is ::EVMC_SUCCESS) or from REVERT opcode."]
#[doc = ""]
#[doc = " The memory containing the output data is owned by EVM and has to be"]
#[doc = " freed with evmc_result::release()."]
#[doc = ""]
#[doc = " This MAY be NULL."]
pub output_data: *const u8,
#[doc = " The size of the output data."]
#[doc = ""]
#[doc = " If output_data is NULL this MUST be 0."]
pub output_size: usize,
#[doc = " The method releasing all resources associated with the result object."]
#[doc = ""]
#[doc = " This method (function pointer) is optional (MAY be NULL) and MAY be set"]
#[doc = " by the VM implementation. If set it MUST be called by the user once to"]
#[doc = " release memory and other resources associated with the result object."]
#[doc = " Once the resources are released the result object MUST NOT be used again."]
#[doc = ""]
#[doc = " The suggested code pattern for releasing execution results:"]
#[doc = " @code"]
#[doc = " struct evmc_result result = ...;"]
#[doc = " if (result.release)"]
#[doc = " result.release(&result);"]
#[doc = " @endcode"]
#[doc = ""]
#[doc = " @note"]
#[doc = " It works similarly to C++ virtual destructor. Attaching the release"]
#[doc = " function to the result itself allows VM composition."]
pub release: evmc_release_result_fn,
#[doc = " The address of the contract created by create instructions."]
#[doc = ""]
#[doc = " This field has valid value only if:"]
#[doc = " - it is a result of the Host method evmc_host_interface::call"]
#[doc = " - and the result describes successful contract creation"]
#[doc = " (evmc_result::status_code is ::EVMC_SUCCESS)."]
#[doc = " In all other cases the address MUST be null bytes."]
pub create_address: evmc_address,
#[doc = " Reserved data that MAY be used by a evmc_result object creator."]
#[doc = ""]
#[doc = " This reserved 4 bytes together with 20 bytes from create_address form"]
#[doc = " 24 bytes of memory called \"optional data\" within evmc_result struct"]
#[doc = " to be optionally used by the evmc_result object creator."]
#[doc = ""]
#[doc = " @see evmc_result_optional_data, evmc_get_optional_data()."]
#[doc = ""]
#[doc = " Also extends the size of the evmc_result to 64 bytes (full cache line)."]
pub padding: [u8; 4usize],
}
#[doc = " Check account existence callback function."]
#[doc = ""]
#[doc = " This callback function is used by the VM to check if"]
#[doc = " there exists an account at given address."]
#[doc = " @param context The pointer to the Host execution context."]
#[doc = " @param address The address of the account the query is about."]
#[doc = " @return true if exists, false otherwise."]
pub type evmc_account_exists_fn = ::std::option::Option<
unsafe extern "C" fn(context: *mut evmc_context, address: *const evmc_address) -> bool,
>;
#[doc = " Get storage callback function."]
#[doc = ""]
#[doc = " This callback function is used by a VM to query the given account storage entry."]
#[doc = ""]
#[doc = " @param context The Host execution context."]
#[doc = " @param address The address of the account."]
#[doc = " @param key The index of the account's storage entry."]
#[doc = " @return The storage value at the given storage key or null bytes"]
#[doc = " if the account does not exist."]
pub type evmc_get_storage_fn = ::std::option::Option<
unsafe extern "C" fn(
context: *mut evmc_context,
address: *const evmc_address,
key: *const evmc_bytes32,
) -> evmc_bytes32,
>;
#[repr(u32)]
#[doc = " The effect of an attempt to modify a contract storage item."]
#[doc = ""]
#[doc = " For the purpose of explaining the meaning of each element, the following"]
#[doc = " notation is used:"]
#[doc = " - 0 is zero value,"]
#[doc = " - X != 0 (X is any value other than 0),"]
#[doc = " - Y != X, Y != 0 (Y is any value other than X and 0),"]
#[doc = " - Z != Y (Z is any value other than Y),"]
#[doc = " - the \"->\" means the change from one value to another."]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum evmc_storage_status {
#[doc = " The value of a storage item has been left unchanged: 0 -> 0 and X -> X."]
EVMC_STORAGE_UNCHANGED = 0,
#[doc = " The value of a storage item has been modified: X -> Y."]
EVMC_STORAGE_MODIFIED = 1,
#[doc = " A storage item has been modified after being modified before: X -> Y -> Z."]
EVMC_STORAGE_MODIFIED_AGAIN = 2,
#[doc = " A new storage item has been added: 0 -> X."]
EVMC_STORAGE_ADDED = 3,
#[doc = " A storage item has been deleted: X -> 0."]
EVMC_STORAGE_DELETED = 4,
}
#[doc = " Set storage callback function."]
#[doc = ""]
#[doc = " This callback function is used by a VM to update the given account storage entry."]
#[doc = " The VM MUST make sure that the account exists. This requirement is only a formality because"]
#[doc = " VM implementations only modify storage of the account of the current execution context"]
#[doc = " (i.e. referenced by evmc_message::destination)."]
#[doc = ""]
#[doc = " @param context The pointer to the Host execution context."]
#[doc = " @param address The address of the account."]
#[doc = " @param key The index of the storage entry."]
#[doc = " @param value The value to be stored."]
#[doc = " @return The effect on the storage item."]
pub type evmc_set_storage_fn = ::std::option::Option<
unsafe extern "C" fn(
context: *mut evmc_context,
address: *const evmc_address,
key: *const evmc_bytes32,
value: *const evmc_bytes32,
) -> evmc_storage_status,
>;
#[doc = " Get balance callback function."]
#[doc = ""]
#[doc = " This callback function is used by a VM to query the balance of the given account."]
#[doc = ""]
#[doc = " @param context The pointer to the Host execution context."]
#[doc = " @param address The address of the account."]
#[doc = " @return The balance of the given account or 0 if the account does not exist."]
pub type evmc_get_balance_fn = ::std::option::Option<
unsafe extern "C" fn(
context: *mut evmc_context,
address: *const evmc_address,
) -> evmc_uint256be,
>;
#[doc = " Get code size callback function."]
#[doc = ""]
#[doc = " This callback function is used by a VM to get the size of the code stored"]
#[doc = " in the account at the given address."]
#[doc = ""]
#[doc = " @param context The pointer to the Host execution context."]
#[doc = " @param address The address of the account."]
#[doc = " @return The size of the code in the account or 0 if the account does not exist."]
pub type evmc_get_code_size_fn = ::std::option::Option<
unsafe extern "C" fn(context: *mut evmc_context, address: *const evmc_address) -> usize,
>;
#[doc = " Get code size callback function."]
#[doc = ""]
#[doc = " This callback function is used by a VM to get the keccak256 hash of the code stored"]
#[doc = " in the account at the given address. For existing accounts not having a code, this"]
#[doc = " function returns keccak256 hash of empty data."]
#[doc = ""]
#[doc = " @param context The pointer to the Host execution context."]
#[doc = " @param address The address of the account."]
#[doc = " @return The hash of the code in the account or null bytes if the account does not exist."]
pub type evmc_get_code_hash_fn = ::std::option::Option<
unsafe extern "C" fn(context: *mut evmc_context, address: *const evmc_address) -> evmc_bytes32,
>;
#[doc = " Copy code callback function."]
#[doc = ""]
#[doc = " This callback function is used by an EVM to request a copy of the code"]
#[doc = " of the given account to the memory buffer provided by the EVM."]
#[doc = " The Client MUST copy the requested code, starting with the given offset,"]
#[doc = " to the provided memory buffer up to the size of the buffer or the size of"]
#[doc = " the code, whichever is smaller."]
#[doc = ""]
#[doc = " @param context The pointer to the Client execution context."]
#[doc = " @see ::evmc_context."]
#[doc = " @param address The address of the account."]
#[doc = " @param code_offset The offset of the code to copy."]
#[doc = " @param buffer_data The pointer to the memory buffer allocated by the EVM"]
#[doc = " to store a copy of the requested code."]
#[doc = " @param buffer_size The size of the memory buffer."]
#[doc = " @return The number of bytes copied to the buffer by the Client."]
pub type evmc_copy_code_fn = ::std::option::Option<
unsafe extern "C" fn(
context: *mut evmc_context,
address: *const evmc_address,
code_offset: usize,
buffer_data: *mut u8,
buffer_size: usize,
) -> usize,
>;
#[doc = " Selfdestruct callback function."]
#[doc = ""]
#[doc = " This callback function is used by an EVM to SELFDESTRUCT given contract."]
#[doc = " The execution of the contract will not be stopped, that is up to the EVM."]
#[doc = ""]
#[doc = " @param context The pointer to the Host execution context."]
#[doc = " @see ::evmc_context."]
#[doc = " @param address The address of the contract to be selfdestructed."]
#[doc = " @param beneficiary The address where the remaining ETH is going to be"]
#[doc = " transferred."]
pub type evmc_selfdestruct_fn = ::std::option::Option<
unsafe extern "C" fn(
context: *mut evmc_context,
address: *const evmc_address,
beneficiary: *const evmc_address,
),
>;
#[doc = " Log callback function."]
#[doc = ""]
#[doc = " This callback function is used by an EVM to inform about a LOG that happened"]
#[doc = " during an EVM bytecode execution."]
#[doc = " @param context The pointer to the Host execution context."]
#[doc = " @see ::evmc_context."]
#[doc = " @param address The address of the contract that generated the log."]
#[doc = " @param data The pointer to unindexed data attached to the log."]
#[doc = " @param data_size The length of the data."]
#[doc = " @param topics The pointer to the array of topics attached to the log."]
#[doc = " @param topics_count The number of the topics. Valid values are between"]
#[doc = " 0 and 4 inclusively."]
pub type evmc_emit_log_fn = ::std::option::Option<
unsafe extern "C" fn(
context: *mut evmc_context,
address: *const evmc_address,
data: *const u8,
data_size: usize,
topics: *const evmc_bytes32,
topics_count: usize,
),
>;
#[doc = " Pointer to the callback function supporting EVM calls."]
#[doc = ""]
#[doc = " @param context The pointer to the Host execution context."]
#[doc = " @param msg The call parameters."]
#[doc = " @return The result of the call."]
pub type evmc_call_fn = ::std::option::Option<
unsafe extern "C" fn(context: *mut evmc_context, msg: *const evmc_message) -> evmc_result,
>;
#[doc = " The Host interface."]
#[doc = ""]
#[doc = " The set of all callback functions expected by VM instances. This is C"]
#[doc = " realisation of vtable for OOP interface (only virtual methods, no data)."]
#[doc = " Host implementations SHOULD create constant singletons of this (similarly"]
#[doc = " to vtables) to lower the maintenance and memory management cost."]
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash)]
pub struct evmc_host_interface {
#[doc = " Check account existence callback function."]
pub account_exists: evmc_account_exists_fn,
#[doc = " Get storage callback function."]
pub get_storage: evmc_get_storage_fn,
#[doc = " Set storage callback function."]
pub set_storage: evmc_set_storage_fn,
#[doc = " Get balance callback function."]
pub get_balance: evmc_get_balance_fn,
#[doc = " Get code size callback function."]
pub get_code_size: evmc_get_code_size_fn,
#[doc = " Get code hash callback function."]
pub get_code_hash: evmc_get_code_hash_fn,
#[doc = " Copy code callback function."]
pub copy_code: evmc_copy_code_fn,
#[doc = " Selfdestruct callback function."]
pub selfdestruct: evmc_selfdestruct_fn,
#[doc = " Call callback function."]
pub call: evmc_call_fn,
#[doc = " Get transaction context callback function."]
pub get_tx_context: evmc_get_tx_context_fn,
#[doc = " Get block hash callback function."]
pub get_block_hash: evmc_get_block_hash_fn,
#[doc = " Emit log callback function."]
pub emit_log: evmc_emit_log_fn,
}
#[doc = " Execution context managed by the Host."]
#[doc = ""]
#[doc = " The Host MUST pass the pointer to the execution context to ::evmc_execute_fn."]
#[doc = " The VM MUST pass the same pointer back to the Host in every callback function."]
#[doc = " The context MUST contain at least the function table defining"]
#[doc = " the context callback interface."]
#[doc = " Optionally, the Host MAY include in the context additional data."]
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash)]
pub struct evmc_context {
#[doc = " The Host interface."]
pub host: *const evmc_host_interface,
}
#[doc = " Destroys the EVM instance."]
#[doc = ""]
#[doc = " @param evm The EVM instance to be destroyed."]
pub type evmc_destroy_fn = ::std::option::Option<unsafe extern "C" fn(evm: *mut evmc_instance)>;
#[repr(u32)]
#[doc = " Possible outcomes of evmc_set_option."]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum evmc_set_option_result {
EVMC_SET_OPTION_SUCCESS = 0,
EVMC_SET_OPTION_INVALID_NAME = 1,
EVMC_SET_OPTION_INVALID_VALUE = 2,
}
#[doc = " Configures the EVM instance."]
#[doc = ""]
#[doc = " Allows modifying options of the EVM instance."]
#[doc = " Options:"]
#[doc = " - code cache behavior: on, off, read-only, ..."]
#[doc = " - optimizations,"]
#[doc = ""]
#[doc = " @param evm The EVM instance to be configured."]
#[doc = " @param name The option name. NULL-terminated string. Cannot be NULL."]
#[doc = " @param value The new option value. NULL-terminated string. Cannot be NULL."]
#[doc = " @return The outcome of the operation."]
pub type evmc_set_option_fn = ::std::option::Option<
unsafe extern "C" fn(
evm: *mut evmc_instance,
name: *const ::std::os::raw::c_char,
value: *const ::std::os::raw::c_char,
) -> evmc_set_option_result,
>;
impl evmc_revision {
pub const EVMC_MAX_REVISION: evmc_revision = evmc_revision::EVMC_ISTANBUL;
}
impl evmc_revision {
pub const EVMC_CONSTANTINOPLE2: evmc_revision = evmc_revision::EVMC_PETERSBURG;
}
impl evmc_revision {
pub const EVMC_LATEST_REVISION: evmc_revision = evmc_revision::EVMC_ISTANBUL;
}
#[repr(u32)]
#[doc = " EVM revision."]
#[doc = ""]
#[doc = " The revision of the EVM specification based on the Ethereum"]
#[doc = " upgrade / hard fork codenames."]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum evmc_revision {
#[doc = " The Frontier revision."]
#[doc = ""]
#[doc = " The one Ethereum launched with."]
EVMC_FRONTIER = 0,
#[doc = " The Homestead revision."]
#[doc = ""]
#[doc = " https://eips.ethereum.org/EIPS/eip-606"]
EVMC_HOMESTEAD = 1,
#[doc = " The Tangerine Whistle revision."]
#[doc = ""]
#[doc = " https://eips.ethereum.org/EIPS/eip-608"]
EVMC_TANGERINE_WHISTLE = 2,
#[doc = " The Spurious Dragon revision."]
#[doc = ""]
#[doc = " https://eips.ethereum.org/EIPS/eip-607"]
EVMC_SPURIOUS_DRAGON = 3,
#[doc = " The Byzantium revision."]
#[doc = ""]
#[doc = " https://eips.ethereum.org/EIPS/eip-609"]
EVMC_BYZANTIUM = 4,
#[doc = " The Constantinople revision."]
#[doc = ""]
#[doc = " https://eips.ethereum.org/EIPS/eip-1013"]
EVMC_CONSTANTINOPLE = 5,
#[doc = " The Petersburg revision."]
#[doc = ""]
#[doc = " Other names: Constantinople2, ConstantinopleFix."]
#[doc = " https://eips.ethereum.org/EIPS/eip-1716"]
EVMC_PETERSBURG = 6,
#[doc = " The Istanbul revision."]
#[doc = ""]
#[doc = " The spec draft: https://eips.ethereum.org/EIPS/eip-1679."]
EVMC_ISTANBUL = 7,
}
#[doc = " Executes the given code using the input from the message."]
#[doc = ""]
#[doc = " This function MAY be invoked multiple times for a single VM instance."]
#[doc = ""]
#[doc = " @param instance The VM instance. This argument MUST NOT be NULL."]
#[doc = " @param context The pointer to the Host execution context to be passed"]
#[doc = " to the Host interface methods (::evmc_host_interface)."]
#[doc = " This argument MUST NOT be NULL unless"]
#[doc = " the @p instance has the ::EVMC_CAPABILITY_PRECOMPILES capability."]
#[doc = " @param rev The requested EVM specification revision."]
#[doc = " @param msg The call parameters. See ::evmc_message. This argument MUST NOT be NULL."]
#[doc = " @param code The reference to the code to be executed. This argument MAY be NULL."]
#[doc = " @param code_size The length of the code. If @p code is NULL this argument MUST be 0."]
#[doc = " @return The execution result."]
pub type evmc_execute_fn = ::std::option::Option<
unsafe extern "C" fn(
instance: *mut evmc_instance,
context: *mut evmc_context,
rev: evmc_revision,
msg: *const evmc_message,
code: *const u8,
code_size: usize,
) -> evmc_result,
>;
#[repr(u32)]
#[doc = " Possible capabilities of a VM."]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum evmc_capabilities {
#[doc = " The VM is capable of executing EVM1 bytecode."]
EVMC_CAPABILITY_EVM1 = 1,
#[doc = " The VM is capable of executing ewasm bytecode."]
EVMC_CAPABILITY_EWASM = 2,
#[doc = " The VM is capable of executing the precompiled contracts"]
#[doc = " defined for the range of destination addresses."]
#[doc = ""]
#[doc = " The EIP-1352 (https://eips.ethereum.org/EIPS/eip-1352) specifies"]
#[doc = " the range 0x000...0000 - 0x000...ffff of addresses"]
#[doc = " reserved for precompiled and system contracts."]
#[doc = ""]
#[doc = " This capability is **experimental** and MAY be removed without notice."]
EVMC_CAPABILITY_PRECOMPILES = 4,
}
#[doc = " Alias for unsigned integer representing a set of bit flags of EVMC capabilities."]
#[doc = ""]
#[doc = " @see evmc_capabilities"]
pub type evmc_capabilities_flagset = u32;
#[doc = " Return the supported capabilities of the VM instance."]
#[doc = ""]
#[doc = " This function MAY be invoked multiple times for a single VM instance,"]
#[doc = " and its value MAY be influenced by calls to evmc_instance::set_option."]
#[doc = ""]
#[doc = " @param instance The EVM instance."]
#[doc = " @return The supported capabilities of the VM. @see evmc_capabilities."]
pub type evmc_get_capabilities_fn = ::std::option::Option<
unsafe extern "C" fn(instance: *mut evmc_instance) -> evmc_capabilities_flagset,
>;
#[doc = " The opaque type representing a Client-side tracer object."]
#[doc = ""]
#[doc = " @deprecated Deprecated since EVMC 6.3, see evmc_instance::set_tracer()."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct evmc_tracer_context {
_unused: [u8; 0],
}
#[doc = " The callback to trace instructions execution in an EVM."]
#[doc = ""]
#[doc = " This function informs the Client what instruction has been executed in the EVM implementation"]
#[doc = " and what are the results of executing this particular instruction."]
#[doc = " The message level information (like call depth, destination address, etc.) are not provided here."]
#[doc = " This piece of information can be acquired by inspecting messages being sent to the EVM in"]
#[doc = " ::evmc_execute_fn and the results of the messages execution."]
#[doc = ""]
#[doc = " @deprecated Deprecated since EVMC 6.3, see evmc_instance::set_tracer()."]
#[doc = ""]
#[doc = " @param context The pointer to the Client-side tracing context. This allows to"]
#[doc = " implement the tracer in OOP manner."]
#[doc = " @param code_offset The current instruction position in the code."]
#[doc = " @param status_code The status code of the instruction execution."]
#[doc = " @param gas_left The amount of the gas left after the instruction execution."]
#[doc = " @param stack_num_items The current EVM stack height after the instruction execution."]
#[doc = " @param pushed_stack_item The top EVM stack item pushed as the result of the instruction"]
#[doc = " execution. This value is null when the instruction does not push"]
#[doc = " anything to the stack."]
#[doc = " @param memory_size The size of the EVM memory after the instruction execution."]
#[doc = " @param changed_memory_offset The offset in number of bytes of the beginning of the memory area"]
#[doc = " modified as the result of the instruction execution."]
#[doc = " The Client MAY use this information together with"]
#[doc = " @p changed_memory_size and @p changed_memory to incrementally"]
#[doc = " update the copy of the full VM's memory."]
#[doc = " @param changed_memory_size The size of the memory area modified as the result of"]
#[doc = " the instruction execution."]
#[doc = " @param changed_memory The pointer to the memory area modified as the result of"]
#[doc = " the instruction execution."]
#[doc = " The Client MAY access the pointed memory area"]
#[doc = " (limited by the @p changed_memory_size) only during the current"]
#[doc = " execution of the evmc_trace_callback()."]
#[doc = " The pointer MUST NOT be stored by the Client."]
#[doc = " The Client MUST NOT assume that"]
#[doc = " `changed_memory - changed_memory_offset` is a valid base pointer"]
#[doc = " of the VM memory."]
pub type evmc_trace_callback = ::std::option::Option<
unsafe extern "C" fn(
context: *mut evmc_tracer_context,
code_offset: usize,
status_code: evmc_status_code,
gas_left: i64,
stack_num_items: usize,
pushed_stack_item: *const evmc_uint256be,
memory_size: usize,
changed_memory_offset: usize,
changed_memory_size: usize,
changed_memory: *const u8,
),
>;
#[doc = " Sets the EVM instruction tracer."]
#[doc = ""]
#[doc = " When the tracer is set in the EVM instance, the EVM SHOULD call back the tracer with information"]
#[doc = " about instructions execution in the EVM."]
#[doc = " @see ::evmc_trace_callback."]
#[doc = ""]
#[doc = " This will overwrite the previous settings (the callback and the context)."]
#[doc = ""]
#[doc = " @deprecated Deprecated since EVMC 6.3, see evmc_instance::set_tracer()."]
#[doc = ""]
#[doc = " @param instance The EVM instance."]
#[doc = " @param callback The tracer callback function. This argument MAY be NULL to disable previously"]
#[doc = " set tracer."]
#[doc = " @param context The Client-side tracer context. This argument MAY be NULL in case the tracer"]
#[doc = " does not require any context. This argument MUST be NULL if the callback"]
#[doc = " argument is NULL."]
pub type evmc_set_tracer_fn = ::std::option::Option<
unsafe extern "C" fn(
instance: *mut evmc_instance,
callback: evmc_trace_callback,
context: *mut evmc_tracer_context,
),
>;
#[doc = " The EVM instance."]
#[doc = ""]
#[doc = " Defines the base struct of the VM implementation."]
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash)]
pub struct evmc_instance {
#[doc = " EVMC ABI version implemented by the VM instance."]
#[doc = ""]
#[doc = " Can be used to detect ABI incompatibilities."]
#[doc = " The EVMC ABI version represented by this file is in ::EVMC_ABI_VERSION."]
pub abi_version: ::std::os::raw::c_int,
#[doc = " The name of the EVMC VM implementation."]
#[doc = ""]
#[doc = " It MUST be a NULL-terminated not empty string."]
#[doc = " The content MUST be UTF-8 encoded (this implies ASCII encoding is also allowed)."]
pub name: *const ::std::os::raw::c_char,
#[doc = " The version of the EVMC VM implementation, e.g. \"1.2.3b4\"."]
#[doc = ""]
#[doc = " It MUST be a NULL-terminated not empty string."]
#[doc = " The content MUST be UTF-8 encoded (this implies ASCII encoding is also allowed)."]
pub version: *const ::std::os::raw::c_char,
#[doc = " Pointer to function destroying the EVM instance."]
#[doc = ""]
#[doc = " This is a mandatory method and MUST NOT be set to NULL."]
pub destroy: evmc_destroy_fn,
#[doc = " Pointer to function executing a code by the EVM instance."]
#[doc = ""]
#[doc = " This is a mandatory method and MUST NOT be set to NULL."]
pub execute: evmc_execute_fn,
#[doc = " A method returning capabilities supported by the VM instance."]
#[doc = ""]
#[doc = " The value returned MAY change when different options are set via the set_option() method."]
#[doc = ""]
#[doc = " A Client SHOULD only rely on the value returned if it has queried it after"]
#[doc = " it has called the set_option()."]
#[doc = ""]
#[doc = " This is a mandatory method and MUST NOT be set to NULL."]
pub get_capabilities: evmc_get_capabilities_fn,
#[doc = " Optional pointer to function setting the EVM instruction tracer."]
#[doc = ""]
#[doc = " If the EVM does not support this feature the pointer can be NULL."]
#[doc = ""]
#[doc = " @deprecated"]
#[doc = " Since EVMC 6.3, the tracing API has been deprecated as there have been some"]
#[doc = " design flaws discovered. New API is expected to be introduced in future."]
pub set_tracer: evmc_set_tracer_fn,
#[doc = " Optional pointer to function modifying VM's options."]
#[doc = ""]
#[doc = " If the VM does not support this feature the pointer can be NULL."]
pub set_option: evmc_set_option_fn,
}