Skip to content

Commit 10f4186

Browse files
committed
vm: removed invalid opcode checks for BEGINSUB, JUMPSUB, RETURNSUB (opcodes are now preselected on a HF basis in opcodes.ts)
1 parent 59d338c commit 10f4186

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

packages/vm/lib/evm/opFns.ts

-11
Original file line numberDiff line numberDiff line change
@@ -547,17 +547,10 @@ export const handlers: { [k: string]: OpHandler } = {
547547
},
548548
JUMPDEST: function (runState: RunState) {},
549549
BEGINSUB: function (runState: RunState) {
550-
if (!runState._common.gteHardfork('berlin')) {
551-
trap(ERROR.INVALID_OPCODE)
552-
}
553-
554550
trap(ERROR.INVALID_BEGINSUB + ' at ' + describeLocation(runState))
555551
},
556552
JUMPSUB: function (runState: RunState) {
557553
const dest = runState.stack.pop()
558-
if (!runState._common.gteHardfork('berlin')) {
559-
trap(ERROR.INVALID_OPCODE)
560-
}
561554

562555
if (dest.gt(runState.eei.getCodeSize())) {
563556
trap(ERROR.INVALID_JUMPSUB + ' at ' + describeLocation(runState))
@@ -573,10 +566,6 @@ export const handlers: { [k: string]: OpHandler } = {
573566
runState.programCounter = destNum + 1
574567
},
575568
RETURNSUB: function (runState: RunState) {
576-
if (!runState._common.gteHardfork('berlin')) {
577-
trap(ERROR.INVALID_OPCODE)
578-
}
579-
580569
if (runState.returnStack.length < 1) {
581570
trap(ERROR.INVALID_RETURNSUB)
582571
}

0 commit comments

Comments
 (0)