EVM-C: Add call kind to evm_message

This commit is contained in:
Paweł Bylica 2017-01-27 17:49:24 +01:00 committed by Alex Beregszaszi
parent 6d6b2c1928
commit 27f3955f8b
2 changed files with 12 additions and 21 deletions

View File

@ -53,17 +53,12 @@ static void update(struct evm_env* env,
static int64_t call(
struct evm_env* _opaqueEnv,
enum evm_call_kind _kind,
int64_t _gas,
const struct evm_uint160be* _address,
const struct evm_uint256be* _value,
uint8_t const* _inputData,
size_t _inputSize,
const struct evm_message* _msg,
uint8_t* _outputData,
size_t _outputSize
)
{
printf("EVM-C: CALL %d\n", _kind);
printf("EVM-C: CALL (depth: %d)\n", _msg->depth);
return EVM_CALL_FAILURE;
}

View File

@ -51,6 +51,14 @@ struct evm_uint160be {
uint8_t bytes[20];
};
/// The kind of call-like instruction.
enum evm_call_kind {
EVM_CALL = 0, ///< Request CALL.
EVM_DELEGATECALL = 1, ///< Request DELEGATECALL. The value param ignored.
EVM_CALLCODE = 2, ///< Request CALLCODE.
EVM_CREATE = 3 ///< Request CREATE. Semantic of some params changes.
};
struct evm_message {
struct evm_uint160be address;
struct evm_uint160be sender;
@ -60,6 +68,7 @@ struct evm_message {
struct evm_uint256be code_hash;
int64_t gas;
int32_t depth;
enum evm_call_kind kind;
};
struct evm_tx_context {
@ -323,14 +332,6 @@ typedef void (*evm_update_state_fn)(struct evm_env* env,
const union evm_variant* arg1,
const union evm_variant* arg2);
/// The kind of call-like instruction.
enum evm_call_kind {
EVM_CALL = 0, ///< Request CALL.
EVM_DELEGATECALL = 1, ///< Request DELEGATECALL. The value param ignored.
EVM_CALLCODE = 2, ///< Request CALLCODE.
EVM_CREATE = 3 ///< Request CREATE. Semantic of some params changes.
};
/// The flag indicating call failure in evm_call_fn() -- highest bit set.
static const int64_t EVM_CALL_FAILURE = 0x8000000000000000;
@ -357,12 +358,7 @@ static const int64_t EVM_CALL_FAILURE = 0x8000000000000000;
/// There is no need to set 0 address in the output in this case.
typedef int64_t (*evm_call_fn)(
struct evm_env* env,
enum evm_call_kind kind,
int64_t gas,
const struct evm_uint160be* address,
const struct evm_uint256be* value,
uint8_t const* input,
size_t input_size,
const struct evm_message* msg,
uint8_t* output,
size_t output_size);