Go: support create2_salt

This commit is contained in:
Alex Beregszaszi 2018-09-04 23:47:32 +01:00
parent 62ed4a14d3
commit 9490c1a16f
1 changed files with 5 additions and 5 deletions

View File

@ -36,9 +36,8 @@ static struct evmc_result execute_wrapper(struct evmc_instance* instance,
enum evmc_call_kind kind, uint32_t flags, int32_t depth, int64_t gas,
const struct evmc_address* destination, const struct evmc_address* sender,
const uint8_t* input_data, size_t input_size, const struct evmc_uint256be* value,
const uint8_t* code, size_t code_size)
const uint8_t* code, size_t code_size, const struct evmc_uint256be* create2_salt)
{
struct evmc_uint256be create2_salt = {};
struct evmc_message msg = {
kind,
flags,
@ -49,7 +48,7 @@ static struct evmc_result execute_wrapper(struct evmc_instance* instance,
input_data,
input_size,
*value,
create2_salt,
*create2_salt,
};
struct extended_context ctx = {{&evmc_go_host}, context_index};
@ -198,7 +197,7 @@ func (instance *Instance) SetOption(name string, value string) (err error) {
func (instance *Instance) Execute(ctx HostContext, rev Revision,
kind CallKind, static bool, depth int, gas int64,
destination common.Address, sender common.Address, input []byte, value common.Hash,
code []byte) (output []byte, gasLeft int64, err error) {
code []byte, create2Salt common.Hash) (output []byte, gasLeft int64, err error) {
flags := C.uint32_t(0)
if static {
@ -210,10 +209,11 @@ func (instance *Instance) Execute(ctx HostContext, rev Revision,
evmcDestination := evmcAddress(destination)
evmcSender := evmcAddress(sender)
evmcValue := evmcUint256be(value)
evmcCreate2Salt := evmcUint256be(create2Salt)
result := C.execute_wrapper(instance.handle, C.int64_t(ctxId), uint32(rev),
C.enum_evmc_call_kind(kind), flags, C.int32_t(depth), C.int64_t(gas),
&evmcDestination, &evmcSender, bytesPtr(input), C.size_t(len(input)), &evmcValue,
bytesPtr(code), C.size_t(len(code)))
bytesPtr(code), C.size_t(len(code)), &evmcCreate2Salt)
removeHostContext(ctxId)
output = C.GoBytes(unsafe.Pointer(result.output_data), C.int(result.output_size))