From f014e4fc774ebc324cfebf23ce856d819b6ae3b9 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 20 Aug 2018 14:41:02 +0100 Subject: [PATCH] Add evmc_execute helper --- bindings/go/evmc/evmc.go | 2 +- examples/capi.c | 2 +- include/evmc/helpers.h | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/bindings/go/evmc/evmc.go b/bindings/go/evmc/evmc.go index e6be4ab..1da8cfb 100644 --- a/bindings/go/evmc/evmc.go +++ b/bindings/go/evmc/evmc.go @@ -52,7 +52,7 @@ static struct evmc_result execute_wrapper(struct evmc_instance* instance, int64_ }; struct extended_context ctx = {{&evmc_go_fn_table}, context_index}; - return instance->execute(instance, &ctx.context, rev, &msg, code, code_size); + return evmc_execute(instance, &ctx.context, rev, &msg, code, code_size); } */ import "C" diff --git a/examples/capi.c b/examples/capi.c index 4c8a9ef..b680754 100644 --- a/examples/capi.c +++ b/examples/capi.c @@ -190,7 +190,7 @@ int main() msg.gas = gas; msg.depth = 0; - struct evmc_result result = vm->execute(vm, &ctx, EVMC_HOMESTEAD, &msg, code, code_size); + struct evmc_result result = evmc_execute(vm, &ctx, EVMC_HOMESTEAD, &msg, code, code_size); printf("Execution result:\n"); if (result.status_code != EVMC_SUCCESS) diff --git a/include/evmc/helpers.h b/include/evmc/helpers.h index 321da2c..5b3d4f6 100644 --- a/include/evmc/helpers.h +++ b/include/evmc/helpers.h @@ -41,6 +41,21 @@ static inline int evmc_set_option(struct evmc_instance* instance, return 0; } +/** + * Executes code in the VM instance. + * + * @see evmc_execute_fn. + */ +static inline struct evmc_result evmc_execute(struct evmc_instance* instance, + struct evmc_context* context, + enum evmc_revision rev, + const struct evmc_message* msg, + uint8_t const* code, + size_t code_size) +{ + return instance->execute(instance, context, rev, msg, code, code_size); +} + /** * Releases the resources allocated to the execution result. *