From 1436903f1e2d92e7e23b668bb6d2373063095352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20W=C3=BCstholz?= Date: Sun, 21 May 2017 12:01:07 +0200 Subject: [PATCH] core/vm: improve error message for invalid opcodes --- core/vm/instructions.go | 2 +- core/vm/interpreter.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/vm/instructions.go b/core/vm/instructions.go index bfc0a668e4..b4e1812493 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -640,7 +640,7 @@ func opDelegateCall(pc *uint64, evm *EVM, contract *Contract, memory *Memory, st // if not homestead return an error. DELEGATECALL is not supported // during pre-homestead. if !evm.ChainConfig().IsHomestead(evm.BlockNumber) { - return nil, fmt.Errorf("invalid opcode %x", DELEGATECALL) + return nil, fmt.Errorf("invalid opcode 0x%x", int(DELEGATECALL)) } gas, to, inOffset, inSize, outOffset, outSize := stack.pop().Uint64(), stack.pop(), stack.pop(), stack.pop(), stack.pop(), stack.pop() diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index 8ee9d3ca79..349d93e2be 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -137,7 +137,7 @@ func (evm *Interpreter) Run(contract *Contract, input []byte) (ret []byte, err e // if the op is invalid abort the process and return an error if !operation.valid { - return nil, fmt.Errorf("invalid opcode %x", op) + return nil, fmt.Errorf("invalid opcode 0x%x", int(op)) } // validate the stack and make sure there enough stack items available