From 318b3ee12e485b0d46eb4a84a397a0c4d5562ffc 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 | 14 +++++++++++--- test/vmtester/tests.cpp | 1 - 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/include/evmc/evmc.h b/include/evmc/evmc.h index 064d3f867..f72246b31 100644 --- a/include/evmc/evmc.h +++ b/include/evmc/evmc.h @@ -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 a284412b1..744c97bd9 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.