diff --git a/libevm/FeeStructure.cpp b/libevm/FeeStructure.cpp index 661f7af6f..aeeb19e27 100644 --- a/libevm/FeeStructure.cpp +++ b/libevm/FeeStructure.cpp @@ -24,18 +24,22 @@ #include +#include "VM.h" + namespace dev { namespace eth { -uint32_t FeeStructure::getInstructionFee(Instruction _inst) BOOST_NOEXCEPT_OR_NOTHROW +uint32_t FeeStructure::getInstructionFee(Instruction _inst) { switch (_inst) { + default: + BOOST_THROW_EXCEPTION(BadInstruction()); + case Instruction::STOP: case Instruction::SUICIDE: - default: // In case of bad instruction return 0 return 0; case Instruction::SSTORE: diff --git a/libevm/FeeStructure.h b/libevm/FeeStructure.h index 73ea48156..8591afa14 100644 --- a/libevm/FeeStructure.h +++ b/libevm/FeeStructure.h @@ -45,8 +45,8 @@ struct FeeStructure static uint32_t const c_txGas = 500; ///< Per transaction. NOTE: Not payable on data of calls between transactions. /// Returns step fee of the instruction. - /// In case of bad instruction code, returns 0. - static uint32_t getInstructionFee(Instruction _inst) BOOST_NOEXCEPT_OR_NOTHROW; + /// In case of bad instruction code, throws BadInstruction exception. + static uint32_t getInstructionFee(Instruction _inst); }; }