mirror of https://github.com/status-im/evmc.git
EVM-C: create address in evm_result
This commit is contained in:
parent
33721bd71f
commit
7350b129b8
|
@ -171,21 +171,58 @@ struct evm_result {
|
||||||
/// function to the result itself allows EVM composition.
|
/// function to the result itself allows EVM composition.
|
||||||
evm_release_result_fn release;
|
evm_release_result_fn release;
|
||||||
|
|
||||||
|
/// The address of the contract created by CREATE opcode.
|
||||||
|
///
|
||||||
|
/// This field has valid value only if the result describes successful
|
||||||
|
/// CREATE (evm_result::status_code is ::EVM_SUCCESS).
|
||||||
|
struct evm_address create_address;
|
||||||
|
|
||||||
/// Reserved data that MAY be used by a evm_result object creator.
|
/// Reserved data that MAY be used by a evm_result object creator.
|
||||||
///
|
///
|
||||||
/// This reserved 24 bytes extends the size of the evm_result to 64 bytes
|
/// This reserved 4 bytes together with 20 bytes from create_address form
|
||||||
/// (full cache line).
|
/// 24 bytes of memory called "optional data" within evm_result struct
|
||||||
|
/// to be optionally used by the evm_result object creator.
|
||||||
|
///
|
||||||
|
/// @see evm_result_optional_data, evm_get_optional_data().
|
||||||
|
///
|
||||||
|
/// Also extends the size of the evm_result to 64 bytes (full cache line).
|
||||||
|
uint8_t padding[4];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/// The union representing evm_result "optional data".
|
||||||
|
///
|
||||||
|
/// The evm_result struct contains 24 bytes of optional data that can be
|
||||||
|
/// reused by the obejct creator if the object does not contain
|
||||||
|
/// evm_result::create_address.
|
||||||
|
///
|
||||||
/// An EVM implementation MAY use this memory to keep additional data
|
/// An EVM implementation MAY use this memory to keep additional data
|
||||||
/// when returning result from ::evm_execute_fn.
|
/// when returning result from ::evm_execute_fn.
|
||||||
/// The host application MAY use this memory to keep additional data
|
/// The host application MAY use this memory to keep additional data
|
||||||
/// when returning result of performed calls from ::evm_call_fn.
|
/// when returning result of performed calls from ::evm_call_fn.
|
||||||
union
|
///
|
||||||
|
/// @see evm_get_optional_data(), evm_get_const_optional_data().
|
||||||
|
union evm_result_optional_data
|
||||||
{
|
{
|
||||||
void* context; ///< A pointer for storing external objects.
|
uint8_t bytes[24];
|
||||||
uint8_t data[24]; ///< 24 bytes of reserved data.
|
void* pointer;
|
||||||
} reserved;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Provides read-write access to evm_result "optional data".
|
||||||
|
static inline union evm_result_optional_data* evm_get_optional_data(
|
||||||
|
struct evm_result* result)
|
||||||
|
{
|
||||||
|
return (union evm_result_optional_data*) &result->create_address;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Provides read-only access to evm_result "optional data".
|
||||||
|
static inline const union evm_result_optional_data* evm_get_const_optional_data(
|
||||||
|
const struct evm_result* result)
|
||||||
|
{
|
||||||
|
return (const union evm_result_optional_data*) &result->create_address;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Check account existence callback function
|
/// Check account existence callback function
|
||||||
///
|
///
|
||||||
/// This callback function is used by the EVM to check if
|
/// This callback function is used by the EVM to check if
|
||||||
|
|
Loading…
Reference in New Issue