From 577946d71c32e30cdee451637128638280f49c4f Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 26 Mar 2018 16:10:54 +0100 Subject: [PATCH 1/3] EVM-C: rename EVM_BAD_INSTRUCTION to EVM_UNDEFINED_INSTRUCTION --- include/evm.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/evm.h b/include/evm.h index 32f633fe..9b384c26 100644 --- a/include/evm.h +++ b/include/evm.h @@ -146,13 +146,14 @@ enum evm_status_code { EVM_SUCCESS = 0, ///< Execution finished with success. EVM_FAILURE = 1, ///< Generic execution failure. EVM_OUT_OF_GAS = 2, - EVM_BAD_INSTRUCTION = 3, + EVM_UNDEFINED_INSTRUCTION = 3, ///< Unknown instruction encountered by the VM. EVM_BAD_JUMP_DESTINATION = 4, EVM_STACK_OVERFLOW = 5, EVM_STACK_UNDERFLOW = 6, EVM_REVERT = 7, ///< Execution terminated with REVERT opcode. - /// Tried to execute an operation which is restricted in static mode. + /// Tried to execute an operation which is restricted in static mode. + /// /// @todo Avoid _ERROR suffix that suggests fatal error. EVM_STATIC_MODE_ERROR = 8, From 690b21f9047e9f2e82ce2b96d705ad946c2fa3be Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 26 Mar 2018 16:25:11 +0100 Subject: [PATCH 2/3] EVM-C: introduce EVM_INVALID_INSTRUCTION --- include/evm.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/evm.h b/include/evm.h index 9b384c26..138bcca9 100644 --- a/include/evm.h +++ b/include/evm.h @@ -157,6 +157,9 @@ enum evm_status_code { /// @todo Avoid _ERROR suffix that suggests fatal error. EVM_STATIC_MODE_ERROR = 8, + /// The dedicated INVALID instruction was hit. + EVM_INVALID_INSTRUCTION = 9, + /// The EVM rejected the execution of the given code or message. /// /// This error SHOULD be used to signal that the EVM is not able to or From 3f081a27e1ccf1a8f7710c2aa60c2e6f158396f0 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 26 Mar 2018 16:13:00 +0100 Subject: [PATCH 3/3] EVM-C: introduce EVM_INVALID_MEMORY_ACCESS --- include/evm.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/evm.h b/include/evm.h index 138bcca9..94f17bd6 100644 --- a/include/evm.h +++ b/include/evm.h @@ -140,8 +140,6 @@ typedef void (*evm_get_block_hash_fn)(struct evm_uint256be* result, int64_t number); /// The execution status code. -/// -/// @todo: Add status code for out-of-buffer access. enum evm_status_code { EVM_SUCCESS = 0, ///< Execution finished with success. EVM_FAILURE = 1, ///< Generic execution failure. @@ -160,6 +158,11 @@ enum evm_status_code { /// The dedicated INVALID instruction was hit. EVM_INVALID_INSTRUCTION = 9, + /// Tried to read outside memory bounds. + /// + /// An example is RETURNDATACOPY reading past the available buffer. + EVM_INVALID_MEMORY_ACCESS = 10, + /// The EVM rejected the execution of the given code or message. /// /// This error SHOULD be used to signal that the EVM is not able to or