diff --git a/examples/capi.c b/examples/capi.c index aa286aa..32b3f4e 100644 --- a/examples/capi.c +++ b/examples/capi.c @@ -88,7 +88,7 @@ static void call(struct evm_result* result, const struct evm_message* msg) { printf("EVM-C: CALL (depth: %d)\n", msg->depth); - result->code = EVM_FAILURE; + result->status_code = EVM_FAILURE; } static void get_tx_context(struct evm_tx_context* result, struct evm_context* context) @@ -148,8 +148,8 @@ int main(int argc, char *argv[]) { jit->execute(jit, &ctx, EVM_HOMESTEAD, &msg, code, code_size); printf("Execution result:\n"); - if (result.code != EVM_SUCCESS) { - printf(" EVM execution failure: %d\n", result.code); + if (result.status_code != EVM_SUCCESS) { + printf(" EVM execution failure: %d\n", result.status_code); } else { printf(" Gas used: %ld\n", gas - result.gas_left); printf(" Gas left: %ld\n", result.gas_left); diff --git a/examples/examplevm.c b/examples/examplevm.c index 27a5e3c..17db5d9 100644 --- a/examples/examplevm.c +++ b/examples/examplevm.c @@ -60,7 +60,7 @@ static struct evm_result execute(struct evm_instance* instance, "Welcome to Byzantium!" : "Hello Ethereum!"; ret.output_data = (const uint8_t*)error; ret.output_size = strlen(error); - ret.code = EVM_FAILURE; + ret.status_code = EVM_FAILURE; ret.release = NULL; // We don't need to release the constant messages. return ret; } @@ -82,11 +82,11 @@ static struct evm_result execute(struct evm_instance* instance, uint8_t* output_data = (uint8_t*)malloc(address_size); if (!output_data) { // malloc failed, report internal error. - ret.code = EVM_INTERNAL_ERROR; + ret.status_code = EVM_INTERNAL_ERROR; return ret; } memcpy(output_data, &msg->address, address_size); - ret.code = EVM_SUCCESS; + ret.status_code = EVM_SUCCESS; ret.output_data = output_data; ret.output_size = address_size; ret.release = &free_result_output_data; @@ -99,12 +99,12 @@ static struct evm_result execute(struct evm_instance* instance, context->fn_table->get_storage(&value, context, &msg->address, &index); value.bytes[31] += 1; context->fn_table->set_storage(context, &msg->address, &index, &value); - ret.code = EVM_SUCCESS; + ret.status_code = EVM_SUCCESS; return ret; } ret.release = evm_release_result; - ret.code = EVM_FAILURE; + ret.status_code = EVM_FAILURE; ret.gas_left = 0; if (vm->verbose) diff --git a/include/evm.h b/include/evm.h index 57af669..24d30ad 100644 --- a/include/evm.h +++ b/include/evm.h @@ -111,8 +111,8 @@ enum evm_status_code { /// EVM implementation internal error. /// - /// FIXME: We should rethink reporting internal errors. One of the options - /// it to allow using any negative value to represent internal errors. + /// @todo We should rethink reporting internal errors. One of the options + /// it to allow using any negative value to represent internal errors. EVM_INTERNAL_ERROR = -1, }; @@ -130,9 +130,8 @@ typedef void (*evm_release_result_fn)(struct evm_result const* result); /// The EVM code execution result. struct evm_result { - /// The execution result code. - /// FIXME: Rename to 'status' or 'status_code'. - enum evm_status_code code; + /// The execution status code. + enum evm_status_code status_code; /// The amount of gas left after the execution. ///