diff --git a/bindings/go/evmc/evmc.go b/bindings/go/evmc/evmc.go index 6379c15..d2411c2 100644 --- a/bindings/go/evmc/evmc.go +++ b/bindings/go/evmc/evmc.go @@ -29,7 +29,7 @@ struct extended_context int64_t index; }; -extern const struct evmc_context_fn_table evmc_go_fn_table; +extern const struct evmc_host_interface evmc_go_host; static struct evmc_result execute_wrapper(struct evmc_instance* instance, int64_t context_index, enum evmc_revision rev, const struct evmc_address* destination, const struct evmc_address* sender, const struct evmc_uint256be* value, @@ -51,7 +51,7 @@ static struct evmc_result execute_wrapper(struct evmc_instance* instance, int64_ flags, }; - struct extended_context ctx = {{&evmc_go_fn_table}, context_index}; + struct extended_context ctx = {{&evmc_go_host}, context_index}; return evmc_execute(instance, &ctx.context, rev, &msg, code, code_size); } */ diff --git a/bindings/go/evmc/host.c b/bindings/go/evmc/host.c index 5cb35a7..d9975c8 100644 --- a/bindings/go/evmc/host.c +++ b/bindings/go/evmc/host.c @@ -20,7 +20,7 @@ void evmc_go_free_result_output(const struct evmc_result* result) * problem the go_exported_functions_type_checks() function simulates usage * of Go exported functions with expected types to check them during compilation. */ -const struct evmc_context_fn_table evmc_go_fn_table = { +const struct evmc_host_interface evmc_go_host = { (evmc_account_exists_fn)accountExists, (evmc_get_storage_fn)getStorage, (evmc_set_storage_fn)setStorage, diff --git a/examples/example_host.cpp b/examples/example_host.cpp index ee8a833..a24a174 100644 --- a/examples/example_host.cpp +++ b/examples/example_host.cpp @@ -129,14 +129,14 @@ static void emit_log(evmc_context* context, (void)topics_count; } -static const evmc_context_fn_table methods = { +static const evmc_host_interface interface = { account_exists, get_storage, set_storage, get_balance, get_code_size, get_code_hash, copy_code, selfdestruct, call, get_tx_context, get_block_hash, emit_log, }; struct example_host_context : evmc_context { - example_host_context() : evmc_context{&methods} {} + example_host_context() : evmc_context{&interface} {} }; extern "C" { diff --git a/examples/example_vm.c b/examples/example_vm.c index b04a95e..39fd568 100644 --- a/examples/example_vm.c +++ b/examples/example_vm.c @@ -108,9 +108,9 @@ static struct evmc_result execute(struct evmc_instance* instance, { struct evmc_uint256be value; const struct evmc_uint256be index = {{0}}; - context->fn_table->get_storage(&value, context, &msg->destination, &index); + context->host->get_storage(&value, context, &msg->destination, &index); value.bytes[31]++; - context->fn_table->set_storage(context, &msg->destination, &index, &value); + context->host->set_storage(context, &msg->destination, &index, &value); ret.status_code = EVMC_SUCCESS; return ret; } diff --git a/include/evmc/evmc.h b/include/evmc/evmc.h index c3d716d..d1dfba1 100644 --- a/include/evmc/evmc.h +++ b/include/evmc/evmc.h @@ -579,14 +579,14 @@ typedef struct evmc_result (*evmc_call_fn)(struct evmc_context* context, const struct evmc_message* msg); /** - * The context interface. + * The Host interface. * - * The set of all callback functions expected by EVM instances. This is C - * realisation of vtable for OOP interface (only virtual methods, no data). - * Host implementations SHOULD create constant singletons of this (similarly - * to vtables) to lower the maintenance and memory management cost. + * The set of all callback functions expected by VM instances. This is C + * realisation of vtable for OOP interface (only virtual methods, no data). + * Host implementations SHOULD create constant singletons of this (similarly + * to vtables) to lower the maintenance and memory management cost. */ -struct evmc_context_fn_table +struct evmc_host_interface { /** Check account existence callback function. */ evmc_account_exists_fn account_exists; @@ -638,8 +638,8 @@ struct evmc_context_fn_table */ struct evmc_context { - /** Function table defining the context interface (vtable). */ - const struct evmc_context_fn_table* fn_table; + /** The Host interface. */ + const struct evmc_host_interface* host; };