Skip to content
This repository was archived by the owner on Apr 8, 2026. It is now read-only.

Commit 3730cfc

Browse files
authored
Merge pull request #67 from ethereum/execute-helper
Add evmc_execute helper
2 parents 58a8d22 + f014e4f commit 3730cfc

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

bindings/go/evmc/evmc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static struct evmc_result execute_wrapper(struct evmc_instance* instance, int64_
5252
};
5353
5454
struct extended_context ctx = {{&evmc_go_fn_table}, context_index};
55-
return instance->execute(instance, &ctx.context, rev, &msg, code, code_size);
55+
return evmc_execute(instance, &ctx.context, rev, &msg, code, code_size);
5656
}
5757
*/
5858
import "C"

examples/capi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ int main()
190190
msg.gas = gas;
191191
msg.depth = 0;
192192

193-
struct evmc_result result = vm->execute(vm, &ctx, EVMC_HOMESTEAD, &msg, code, code_size);
193+
struct evmc_result result = evmc_execute(vm, &ctx, EVMC_HOMESTEAD, &msg, code, code_size);
194194

195195
printf("Execution result:\n");
196196
if (result.status_code != EVMC_SUCCESS)

include/evmc/helpers.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,21 @@ static inline int evmc_set_option(struct evmc_instance* instance,
4141
return 0;
4242
}
4343

44+
/**
45+
* Executes code in the VM instance.
46+
*
47+
* @see evmc_execute_fn.
48+
*/
49+
static inline struct evmc_result evmc_execute(struct evmc_instance* instance,
50+
struct evmc_context* context,
51+
enum evmc_revision rev,
52+
const struct evmc_message* msg,
53+
uint8_t const* code,
54+
size_t code_size)
55+
{
56+
return instance->execute(instance, context, rev, msg, code, code_size);
57+
}
58+
4459
/**
4560
* Releases the resources allocated to the execution result.
4661
*

0 commit comments

Comments
 (0)