Merge pull request #67 from ethereum/execute-helper

Add evmc_execute helper
This commit is contained in:
Alex Beregszaszi 2018-08-20 15:12:43 +01:00 committed by GitHub
commit 3730cfc6a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View File

@ -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"

View File

@ -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)

View File

@ -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.
*