vm: implement new PUSH opcodes

This commit is contained in:
Evgenii Stratonikov 2020-04-21 16:45:48 +03:00
parent 2c39e6fcec
commit 008e6eb233
37 changed files with 453 additions and 596 deletions

View file

@ -14,6 +14,7 @@ import (
"github.com/nspcc-dev/neo-go/pkg/crypto/hash"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
"github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neo-go/pkg/vm/emit"
"github.com/nspcc-dev/neo-go/pkg/vm/opcode"
"github.com/pkg/errors"
)
@ -535,8 +536,8 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro
}
}
if op >= opcode.PUSHBYTES1 && op <= opcode.PUSHBYTES75 {
v.estack.PushVal(parameter)
if op <= opcode.PUSHINT256 {
v.estack.PushVal(emit.BytesToInt(parameter))
return
}
@ -549,6 +550,10 @@ 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{})