From 279f7c8b04bc8ff0a1ddbc8a2d5c5350ce652ae9 Mon Sep 17 00:00:00 2001 From: Andrei Maiboroda Date: Wed, 25 Jul 2018 14:51:49 +0200 Subject: [PATCH] Add CREATE2 salt to evmc_message --- include/evmc/evmc.h | 16 ++++++++++++---- test/vmtester/tests.cpp | 1 - 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/include/evmc/evmc.h b/include/evmc/evmc.h index 064d3f8..22b064b 100644 --- a/include/evmc/evmc.h +++ b/include/evmc/evmc.h @@ -40,7 +40,7 @@ extern "C" { enum { /** 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 { 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_CREATE = 3, /**< Request CREATE. Semantic of some params changes. */ - EVMC_CREATE2 = 4 /**< Request CREATE2. Semantic of some params changes. */ + EVMC_CREATE = 3, /**< Request CREATE. */ + EVMC_CREATE2 = 4 /**< Request CREATE2. Valid since Constantinople.*/ }; /** The flags for ::evmc_message. */ @@ -117,6 +118,13 @@ struct evmc_message */ 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. */ int64_t gas; diff --git a/test/vmtester/tests.cpp b/test/vmtester/tests.cpp index a284412..744c97b 100644 --- a/test/vmtester/tests.cpp +++ b/test/vmtester/tests.cpp @@ -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_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_message) <= 18 * 8, "evmc_message not optimally packed"); static_assert(offsetof(evmc_message, code_hash) % 8 == 0, "evmc_message.code_hash not aligned"); // Check enums match int size.