Merge pull request #160 from ethereum/evmc

EVM-C: Renames in evm_message
This commit is contained in:
Paweł Bylica 2018-01-23 13:23:47 +00:00 committed by GitHub
commit af1cbd70ce
2 changed files with 12 additions and 13 deletions

View File

@ -78,14 +78,14 @@ static struct evm_result execute(struct evm_instance* instance,
if (code_size == strlen(return_address) &&
strncmp((const char*)code, return_address, code_size) == 0) {
static const size_t address_size = sizeof(msg->address);
static const size_t address_size = sizeof(msg->destination);
uint8_t* output_data = (uint8_t*)malloc(address_size);
if (!output_data) {
// malloc failed, report internal error.
ret.status_code = EVM_INTERNAL_ERROR;
return ret;
}
memcpy(output_data, &msg->address, address_size);
memcpy(output_data, &msg->destination, address_size);
ret.status_code = EVM_SUCCESS;
ret.output_data = output_data;
ret.output_size = address_size;
@ -96,9 +96,9 @@ static struct evm_result execute(struct evm_instance* instance,
strncmp((const char*)code, counter, code_size) == 0) {
struct evm_uint256be value;
const struct evm_uint256be index = {{0,}};
context->fn_table->get_storage(&value, context, &msg->address, &index);
context->fn_table->get_storage(&value, context, &msg->destination, &index);
value.bytes[31] += 1;
context->fn_table->set_storage(context, &msg->address, &index, &value);
context->fn_table->set_storage(context, &msg->destination, &index, &value);
ret.status_code = EVM_SUCCESS;
return ret;
}

View File

@ -69,8 +69,8 @@ enum evm_flags {
/// The message describing an EVM call,
/// including a zero-depth calls from a transaction origin.
struct evm_message {
struct evm_address address; ///< The destination of the message.
struct evm_address sender; ///< The sender of the message.
struct evm_address destination; ///< The destination of the message.
struct evm_address sender; ///< The sender of the message.
/// The amount of Ether transferred with the message.
struct evm_uint256be value;
@ -78,10 +78,11 @@ struct evm_message {
/// The message input data.
///
/// This MAY be NULL.
const uint8_t* input;
const uint8_t* input_data;
/// The size of the message input data.
///
/// If input is NULL this MUST be 0.
/// If input_data is NULL this MUST be 0.
size_t input_size;
/// The optional hash of the code of the destination account.
@ -94,8 +95,8 @@ struct evm_message {
/// The kind of the call. For zero-depth calls ::EVM_CALL SHOULD be used.
enum evm_call_kind kind;
///< Additional flags modifying the call execution behavior.
///< In the current version the only valid values are ::EVM_STATIC or 0.
/// Additional flags modifying the call execution behavior.
/// In the current version the only valid values are ::EVM_STATIC or 0.
uint32_t flags;
};
@ -200,9 +201,7 @@ struct evm_result {
/// freed with evm_result::release().
///
/// This MAY be NULL.
///
/// @todo Inconsistent name: output_data vs msg.input.
uint8_t const* output_data;
const uint8_t* output_data;
/// The size of the output data.
///