Add CREATE2 salt to evmc_message

This commit is contained in:
Andrei Maiboroda 2018-07-25 14:51:49 +02:00
parent cac4f6f9d0
commit 279f7c8b04
No known key found for this signature in database
GPG Key ID: 290E6134B4FA2A15
2 changed files with 12 additions and 5 deletions

View File

@ -40,7 +40,7 @@ extern "C" {
enum enum
{ {
/** The EVMC ABI version number of the interface declared in this file. */ /** The EVMC ABI version number of the interface declared in this file. */
EVMC_ABI_VERSION = 1 EVMC_ABI_VERSION = 2
}; };
/** /**
@ -68,10 +68,11 @@ struct evmc_address
enum evmc_call_kind enum evmc_call_kind
{ {
EVMC_CALL = 0, /**< Request CALL. */ EVMC_CALL = 0, /**< Request CALL. */
EVMC_DELEGATECALL = 1, /**< Request DELEGATECALL. The value param ignored. */ EVMC_DELEGATECALL = 1, /**< Request DELEGATECALL. Valid since Homestead.
The value param ignored. */
EVMC_CALLCODE = 2, /**< Request CALLCODE. */ EVMC_CALLCODE = 2, /**< Request CALLCODE. */
EVMC_CREATE = 3, /**< Request CREATE. Semantic of some params changes. */ EVMC_CREATE = 3, /**< Request CREATE. */
EVMC_CREATE2 = 4 /**< Request CREATE2. Semantic of some params changes. */ EVMC_CREATE2 = 4 /**< Request CREATE2. Valid since Constantinople.*/
}; };
/** The flags for ::evmc_message. */ /** The flags for ::evmc_message. */
@ -117,6 +118,13 @@ struct evmc_message
*/ */
struct evmc_uint256be code_hash; struct evmc_uint256be code_hash;
/**
* The optional value used in new contract address construction.
*
* Ignored unless kind is EVMC_CREATE2.
*/
struct evmc_uint256be create2_salt;
/** The amount of gas for message execution. */ /** The amount of gas for message execution. */
int64_t gas; int64_t gas;

View File

@ -12,7 +12,6 @@ static_assert(sizeof(evmc_uint256be) == 32, "evmc_uint256be is too big");
static_assert(sizeof(evmc_address) == 20, "evmc_address is too big"); static_assert(sizeof(evmc_address) == 20, "evmc_address is too big");
static_assert(sizeof(evmc_result) <= 64, "evmc_result does not fit cache line"); static_assert(sizeof(evmc_result) <= 64, "evmc_result does not fit cache line");
static_assert(sizeof(evmc_instance) <= 64, "evmc_instance does not fit cache line"); static_assert(sizeof(evmc_instance) <= 64, "evmc_instance does not fit cache line");
static_assert(sizeof(evmc_message) <= 18 * 8, "evmc_message not optimally packed");
static_assert(offsetof(evmc_message, code_hash) % 8 == 0, "evmc_message.code_hash not aligned"); static_assert(offsetof(evmc_message, code_hash) % 8 == 0, "evmc_message.code_hash not aligned");
// Check enums match int size. // Check enums match int size.