mirror of https://github.com/status-im/evmc.git
EVM-C: Add call kind to evm_message
This commit is contained in:
parent
6d6b2c1928
commit
27f3955f8b
|
@ -53,17 +53,12 @@ static void update(struct evm_env* env,
|
||||||
|
|
||||||
static int64_t call(
|
static int64_t call(
|
||||||
struct evm_env* _opaqueEnv,
|
struct evm_env* _opaqueEnv,
|
||||||
enum evm_call_kind _kind,
|
const struct evm_message* _msg,
|
||||||
int64_t _gas,
|
|
||||||
const struct evm_uint160be* _address,
|
|
||||||
const struct evm_uint256be* _value,
|
|
||||||
uint8_t const* _inputData,
|
|
||||||
size_t _inputSize,
|
|
||||||
uint8_t* _outputData,
|
uint8_t* _outputData,
|
||||||
size_t _outputSize
|
size_t _outputSize
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
printf("EVM-C: CALL %d\n", _kind);
|
printf("EVM-C: CALL (depth: %d)\n", _msg->depth);
|
||||||
return EVM_CALL_FAILURE;
|
return EVM_CALL_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,14 @@ struct evm_uint160be {
|
||||||
uint8_t bytes[20];
|
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_message {
|
||||||
struct evm_uint160be address;
|
struct evm_uint160be address;
|
||||||
struct evm_uint160be sender;
|
struct evm_uint160be sender;
|
||||||
|
@ -60,6 +68,7 @@ struct evm_message {
|
||||||
struct evm_uint256be code_hash;
|
struct evm_uint256be code_hash;
|
||||||
int64_t gas;
|
int64_t gas;
|
||||||
int32_t depth;
|
int32_t depth;
|
||||||
|
enum evm_call_kind kind;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct evm_tx_context {
|
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* arg1,
|
||||||
const union evm_variant* arg2);
|
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.
|
/// The flag indicating call failure in evm_call_fn() -- highest bit set.
|
||||||
static const int64_t EVM_CALL_FAILURE = 0x8000000000000000;
|
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.
|
/// There is no need to set 0 address in the output in this case.
|
||||||
typedef int64_t (*evm_call_fn)(
|
typedef int64_t (*evm_call_fn)(
|
||||||
struct evm_env* env,
|
struct evm_env* env,
|
||||||
enum evm_call_kind kind,
|
const struct evm_message* msg,
|
||||||
int64_t gas,
|
|
||||||
const struct evm_uint160be* address,
|
|
||||||
const struct evm_uint256be* value,
|
|
||||||
uint8_t const* input,
|
|
||||||
size_t input_size,
|
|
||||||
uint8_t* output,
|
uint8_t* output,
|
||||||
size_t output_size);
|
size_t output_size);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue