mirror of https://github.com/status-im/evmc.git
EVM-C: include evm_result_outcome in evm_result
This commit is contained in:
parent
cead905a2e
commit
abc914afd2
|
@ -80,8 +80,8 @@ int main(int argc, char *argv[]) {
|
|||
sizeof(input), value);
|
||||
|
||||
printf("Execution result:\n");
|
||||
if (result.gas_left & EVM_EXCEPTION) {
|
||||
printf(" EVM eception\n");
|
||||
if (result.outcome == EVM_RESULT_EXCEPTION) {
|
||||
printf(" EVM exception\n");
|
||||
}
|
||||
printf(" Gas used: %ld\n", gas - result.gas_left);
|
||||
printf(" Gas left: %ld\n", result.gas_left);
|
||||
|
|
|
@ -67,6 +67,7 @@ static struct evm_result evm_execute(struct evm_instance* instance,
|
|||
|
||||
// Execute code and refer to callbacks: instance->query_fn()
|
||||
|
||||
ret.outcome = EVM_RESULT_EXCEPTION;
|
||||
ret.gas_left = 0;
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -62,9 +62,24 @@ struct evm_hash256 {
|
|||
|
||||
#define EVM_EXCEPTION INT64_MIN ///< The execution ended with an exception.
|
||||
|
||||
/// The outcome of an execution.
|
||||
enum evm_result_outcome {
|
||||
EVM_RESULT_SUCCESS = 0,
|
||||
EVM_RESULT_OUT_OF_GAS = 1,
|
||||
EVM_RESULT_BAD_INSTRUCTION = 2,
|
||||
EVM_RESULT_EXCEPTION = 3
|
||||
};
|
||||
|
||||
/// Complex struct representing execution result.
|
||||
struct evm_result {
|
||||
/// Gas left after execution or exception indicator.
|
||||
/// The outcome of the execution.
|
||||
enum evm_result_outcome outcome;
|
||||
|
||||
/// Optional reason why the execution didn't succeed.
|
||||
/// @see outcome.
|
||||
const char *outcome_reason;
|
||||
|
||||
/// Gas left after execution.
|
||||
int64_t gas_left;
|
||||
|
||||
/// Rerefence to output data. The memory containing the output data
|
||||
|
|
Loading…
Reference in New Issue