From 115919aaf7db504155180f0bc908fa428644ef06 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 6 May 2020 12:58:58 +0300 Subject: [PATCH] vm: process OLDPUSH1 at the context level The only usecase for this opcode is single-byte verification scripts. --- pkg/vm/context.go | 6 ++++++ pkg/vm/vm.go | 4 ---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/vm/context.go b/pkg/vm/context.go index 3a799b13c..b20dbb088 100644 --- a/pkg/vm/context.go +++ b/pkg/vm/context.go @@ -74,6 +74,12 @@ func (c *Context) Next() (opcode.Opcode, []byte, error) { var numtoread int switch instr { + case opcode.OLDPUSH1: + // OLDPUSH1 is used during transition to NEO3 in verification scripts. + // FIXME remove #927 + if len(c.prog) == 1 { + return opcode.PUSH1, nil, nil + } case opcode.PUSHDATA1: if c.nextip >= len(c.prog) { err = errNoInstParam diff --git a/pkg/vm/vm.go b/pkg/vm/vm.go index 573d28159..32c6fe708 100644 --- a/pkg/vm/vm.go +++ b/pkg/vm/vm.go @@ -553,10 +553,6 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro val := int(op) - int(opcode.PUSH1) + 1 v.estack.PushVal(val) - case opcode.OLDPUSH1: - // FIXME remove this after Issue transactions will be removed - v.estack.PushVal(1) - case opcode.PUSH0: v.estack.PushVal([]byte{})