EVMC
evmc_result Struct Reference

The EVM code execution result. More...

#include <evmc.h>

Inheritance diagram for evmc_result:
evmc::Result

Public Attributes

enum evmc_status_code status_code
 The execution status code.
 
int64_t gas_left
 The amount of gas left after the execution.
 
int64_t gas_refund
 The refunded gas accumulated from this execution and its sub-calls.
 
const uint8_t * output_data
 The reference to output data.
 
size_t output_size
 The size of the output data.
 
evmc_release_result_fn release
 The method releasing all resources associated with the result object.
 
evmc_address create_address
 The address of the possibly created contract.
 
uint8_t padding [4]
 Reserved data that MAY be used by a evmc_result object creator.
 

Detailed Description

The EVM code execution result.

Definition at line 415 of file evmc.h.

Member Data Documentation

◆ create_address

evmc_address evmc_result::create_address

The address of the possibly created contract.

The create address may be provided even though the contract creation has failed (evmc_result::status_code is not EVMC_SUCCESS). This is useful in situations when the address is observable, e.g. access to it remains warm. In all other cases the address MUST be null bytes.

Definition at line 486 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 426 of file evmc.h.

◆ gas_refund

int64_t evmc_result::gas_refund

The refunded gas accumulated from this execution and its sub-calls.

The transaction gas refund limit is not applied. If evmc_result::status_code is other than EVMC_SUCCESS the value MUST be 0.

Definition at line 434 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 pointer MAY be NULL. If evmc_result::output_size is 0 this pointer MUST NOT be dereferenced.

Definition at line 448 of file evmc.h.

◆ output_size

size_t evmc_result::output_size

The size of the output data.

If evmc_result::output_data is NULL this MUST be 0.

Definition at line 455 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 499 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);
The EVM code execution result.
Definition: evmc.h:416
evmc_release_result_fn release
The method releasing all resources associated with the result object.
Definition: evmc.h:476
Note
It works similarly to C++ virtual destructor. Attaching the release function to the result itself allows VM composition.

Definition at line 476 of file evmc.h.

◆ status_code

enum evmc_status_code evmc_result::status_code

The execution status code.

Definition at line 418 of file evmc.h.


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