Skip to content

Commit

Permalink
vm: removed invalid opcode checks for BEGINSUB, JUMPSUB, RETURNSUB (o…
Browse files Browse the repository at this point in the history
…pcodes are now preselected on a HF basis in opcodes.ts)
  • Loading branch information
holgerd77 committed Aug 14, 2020
1 parent 2a77e2a commit ba7d36b
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions packages/vm/lib/evm/opFns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,17 +547,10 @@ export const handlers: { [k: string]: OpHandler } = {
},
JUMPDEST: function (runState: RunState) {},
BEGINSUB: function (runState: RunState) {
if (!runState._common.gteHardfork('berlin')) {
trap(ERROR.INVALID_OPCODE)
}

trap(ERROR.INVALID_BEGINSUB + ' at ' + describeLocation(runState))
},
JUMPSUB: function (runState: RunState) {
const dest = runState.stack.pop()
if (!runState._common.gteHardfork('berlin')) {
trap(ERROR.INVALID_OPCODE)
}

if (dest.gt(runState.eei.getCodeSize())) {
trap(ERROR.INVALID_JUMPSUB + ' at ' + describeLocation(runState))
Expand All @@ -573,10 +566,6 @@ export const handlers: { [k: string]: OpHandler } = {
runState.programCounter = destNum + 1
},
RETURNSUB: function (runState: RunState) {
if (!runState._common.gteHardfork('berlin')) {
trap(ERROR.INVALID_OPCODE)
}

if (runState.returnStack.length < 1) {
trap(ERROR.INVALID_RETURNSUB)
}
Expand Down

0 comments on commit ba7d36b

Please sign in to comment.