EVMC
evmc_result Struct Reference

The EVM code execution result. More...

#include <evmc.h>

Inherited by evmc::result [private].

Public Attributes

enum evmc_status_code status_code
 The execution status code. More...
 
int64_t gas_left
 The amount of gas left after the execution. More...
 
const uint8_t * output_data
 The reference to output data. More...
 
size_t output_size
 The size of the output data. More...
 
evmc_release_result_fn release
 The method releasing all resources associated with the result object. More...
 
evmc_address create_address
 The address of the contract created by create instructions. More...
 
uint8_t padding [4]
 Reserved data that MAY be used by a evmc_result object creator. More...
 

Detailed Description

The EVM code execution result.

Definition at line 340 of file evmc.h.

Member Data Documentation

◆ create_address

evmc_address evmc_result::create_address

The address of the contract created by create instructions.

This field has valid value only if:

Definition at line 403 of file evmc.h.

◆ gas_left

int64_t evmc_result::gas_left

The amount of gas left after the execution.

If evmc_result::status_code is neither EVMC_SUCCESS nor EVMC_REVERT the value MUST be 0.

Definition at line 351 of file evmc.h.

◆ output_data

const uint8_t* evmc_result::output_data

The reference to output data.

The output contains data coming from RETURN opcode (iff evmc_result::code field is EVMC_SUCCESS) or from REVERT opcode.

The memory containing the output data is owned by EVM and has to be freed with evmc_result::release().

This MAY be NULL.

Definition at line 364 of file evmc.h.

◆ output_size

size_t evmc_result::output_size

The size of the output data.

If output_data is NULL this MUST be 0.

Definition at line 371 of file evmc.h.

◆ padding

uint8_t evmc_result::padding[4]

Reserved data that MAY be used by a evmc_result object creator.

This reserved 4 bytes together with 20 bytes from create_address form 24 bytes of memory called "optional data" within evmc_result struct to be optionally used by the evmc_result object creator.

See also
evmc_result_optional_data, evmc_get_optional_data().

Also extends the size of the evmc_result to 64 bytes (full cache line).

Definition at line 416 of file evmc.h.

◆ release

evmc_release_result_fn evmc_result::release

The method releasing all resources associated with the result object.

This method (function pointer) is optional (MAY be NULL) and MAY be set by the VM implementation. If set it MUST be called by the user once to release memory and other resources associated with the result object. Once the resources are released the result object MUST NOT be used again.

The suggested code pattern for releasing execution results:

struct evmc_result result = ...;
if (result.release)
result.release(&result);
Note
It works similarly to C++ virtual destructor. Attaching the release function to the result itself allows VM composition.

Definition at line 392 of file evmc.h.

◆ status_code

enum evmc_status_code evmc_result::status_code

The execution status code.

Definition at line 343 of file evmc.h.


The documentation for this struct was generated from the following file: