diff --git a/examples/examplevm/examplevm.c b/examples/examplevm/examplevm.c index 78b1018..4629ee5 100644 --- a/examples/examplevm/examplevm.c +++ b/examples/examplevm/examplevm.c @@ -113,6 +113,8 @@ struct evmc_instance* examplevm_create() { struct evmc_instance init = { .abi_version = EVMC_ABI_VERSION, + .name = "examplevm", + .version = "0.0.0", .destroy = evmc_destroy, .execute = execute, .set_option = evmc_set_option, diff --git a/include/evmc.h b/include/evmc.h index 712dbc6..b4789a6 100644 --- a/include/evmc.h +++ b/include/evmc.h @@ -549,6 +549,16 @@ struct evmc_instance /// represented by this file is in ::EVMC_ABI_VERSION. const int abi_version; + /// The name of the EVMC VM implementation. + /// + /// It MUST be a NULL-terminated not empty string. + const char* name; + + /// The version of the EVMC VM implementation, e.g. "1.2.3b4". + /// + /// It MUST be a NULL-terminated not empty string. + const char* version; + /// Pointer to function destroying the EVM instance. evmc_destroy_fn destroy; diff --git a/test/vmtester/tests.cpp b/test/vmtester/tests.cpp index a316395..0fa5141 100644 --- a/test/vmtester/tests.cpp +++ b/test/vmtester/tests.cpp @@ -4,6 +4,8 @@ #include "vmtester.hpp" +#include + TEST_F(evmc_vm_test, abi_version_match) { ASSERT_EQ(vm->abi_version, EVMC_ABI_VERSION); @@ -27,4 +29,16 @@ TEST_F(evmc_vm_test, set_option_empty_value) int r = vm->set_option(vm, "unknown_option_csk9twq", nullptr); EXPECT_EQ(r, 0); } +} + +TEST_F(evmc_vm_test, name) +{ + ASSERT_NE(vm->name, nullptr); + EXPECT_GT(std::strlen(vm->name), 0) << "VM name cannot be empty"; +} + +TEST_F(evmc_vm_test, version) +{ + ASSERT_NE(vm->version, nullptr); + EXPECT_GT(std::strlen(vm->version), 0) << "VM name cannot be empty"; } \ No newline at end of file