Skip to content

Commit

Permalink
EVM-C: reorder and add create_address to evm_result
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Sep 28, 2016
1 parent 46c0c51 commit 5936db8
Showing 1 changed file with 28 additions and 15 deletions.
43 changes: 28 additions & 15 deletions include/evm.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,30 +77,43 @@ struct evm_result {
/// The value is valid only if evm_result::code == ::EVM_SUCCESS.
int64_t gas_left;

/// The reference to output data. The memory containing the output data
/// is owned by EVM and is freed with evm_release_result_fn().
uint8_t const* output_data;
union
{
struct
{
/// The reference to output data. The memory containing the output
/// data is owned by EVM and is freed with evm_result::release().
uint8_t const* output_data;

/// The size of the output data.
size_t output_size;
};

/// The address of the successfully created contract.
///
/// This field has valid value only if the evm_result comes from a
/// successful CREATE opcode execution
/// (i.e. evm_call_fn(..., EVM_CREATE, ...)).
struct evm_uint160be create_address;
};

/// The size of the output data.
size_t output_size;
/// The pointer to the result release implementation.
///
/// This function pointer must be set by the VM implementation and works
/// similary to C++ virtual destructor. Attaching the releaser to the result
/// itself allows VM composition.
evm_release_result_fn release;

/// @name Optional
/// The optional information that EVM is not required to provide.
/// @{

/// The pointer to EVM-owned memory. For EVM internal use.
/// @see output_data.
void* internal_memory;

/// The error message explaining the result code.
char const* error_message;

/// The pointer to the result release implementation.
///
/// This function pointer must be set by the VM implementation and works
/// similary to C++ virtual destructor. Attaching the releaser to the result
/// itself allows VM composition.
evm_release_result_fn release;
/// The pointer to EVM-owned memory. For EVM internal use.
/// @see output_data.
void* internal_memory;

/// @}
};
Expand Down

0 comments on commit 5936db8

Please sign in to comment.