forked from TrueCloudLab/neoneo-go
Merge pull request #2770 from nspcc-dev/push-bool
vm: add PUSHT and PUSHF opcodes
This commit is contained in:
commit
f6a9969fa8
13 changed files with 222 additions and 220 deletions
|
@ -99,7 +99,7 @@ func TestNEP17Balance(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
e.CheckNextLine(t, "^\\s*$")
|
e.CheckNextLine(t, "^\\s*$")
|
||||||
addr4, err := address.StringToUint160("NfWu6j9KPLQMsWLfHz9iZRy5sNw2bUZWQL") // deployed verify.go contract
|
addr4, err := address.StringToUint160("NiFxRcC5Anz9pmqQyMHh5vamBUZDbRRRzA") // deployed verify.go contract
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
e.CheckNextLine(t, "^Account "+address.Uint160ToString(addr4))
|
e.CheckNextLine(t, "^Account "+address.Uint160ToString(addr4))
|
||||||
e.CheckEOF(t)
|
e.CheckEOF(t)
|
||||||
|
|
2
cli/testdata/wallet1_solo.json
vendored
2
cli/testdata/wallet1_solo.json
vendored
|
@ -61,7 +61,7 @@
|
||||||
"isDefault": false
|
"isDefault": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "NfWu6j9KPLQMsWLfHz9iZRy5sNw2bUZWQL",
|
"address": "NiFxRcC5Anz9pmqQyMHh5vamBUZDbRRRzA",
|
||||||
"key": "6PYSATFztBa3CHjSR6sLAKungUEAbQUCVE16KzmaQQ38gLeYGZ9Knd5mGv",
|
"key": "6PYSATFztBa3CHjSR6sLAKungUEAbQUCVE16KzmaQQ38gLeYGZ9Knd5mGv",
|
||||||
"label": "verify",
|
"label": "verify",
|
||||||
"contract": {
|
"contract": {
|
||||||
|
|
|
@ -924,7 +924,7 @@ func TestRunWithHistoricState(t *testing.T) {
|
||||||
e.checkNextLine(t, "READY: loaded 36 instructions")
|
e.checkNextLine(t, "READY: loaded 36 instructions")
|
||||||
e.checkStack(t, []byte{1})
|
e.checkStack(t, []byte{1})
|
||||||
e.checkNextLine(t, "READY: loaded 36 instructions")
|
e.checkNextLine(t, "READY: loaded 36 instructions")
|
||||||
e.checkNextLineExact(t, "Error: at instruction 31 (SYSCALL): System.Contract.Call failed: called contract cd583ac7a1a4faef70d6e9f513bc988dde22f672 not found: key not found\n")
|
e.checkNextLineExact(t, "Error: at instruction 31 (SYSCALL): System.Contract.Call failed: called contract 73a23e915b66ae406866787f4a6c1c517dc981e2 not found: key not found\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEvents(t *testing.T) {
|
func TestEvents(t *testing.T) {
|
||||||
|
@ -949,7 +949,7 @@ func TestEvents(t *testing.T) {
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
e.checkNextLine(t, "READY: loaded 43 instructions")
|
e.checkNextLine(t, "READY: loaded 42 instructions")
|
||||||
e.checkStack(t, stackitem.Null{})
|
e.checkStack(t, stackitem.Null{})
|
||||||
e.checkEvents(t, true, expectedEvent) // automatically printed after `run` command
|
e.checkEvents(t, true, expectedEvent) // automatically printed after `run` command
|
||||||
e.checkEvents(t, false, expectedEvent) // printed after `events` command
|
e.checkEvents(t, false, expectedEvent) // printed after `events` command
|
||||||
|
|
|
@ -20,6 +20,8 @@ var coefficients = [256]uint16{
|
||||||
opcode.PUSHINT64: 1 << 0,
|
opcode.PUSHINT64: 1 << 0,
|
||||||
opcode.PUSHINT128: 1 << 2,
|
opcode.PUSHINT128: 1 << 2,
|
||||||
opcode.PUSHINT256: 1 << 2,
|
opcode.PUSHINT256: 1 << 2,
|
||||||
|
opcode.PUSHT: 1 << 0,
|
||||||
|
opcode.PUSHF: 1 << 0,
|
||||||
opcode.PUSHA: 1 << 2,
|
opcode.PUSHA: 1 << 2,
|
||||||
opcode.PUSHNULL: 1 << 0,
|
opcode.PUSHNULL: 1 << 0,
|
||||||
opcode.PUSHDATA1: 1 << 3,
|
opcode.PUSHDATA1: 1 << 3,
|
||||||
|
|
|
@ -73,11 +73,7 @@ func ExpandArrayIntoScript(script *io.BinWriter, slice []Param) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("not a bool")
|
return errors.New("not a bool")
|
||||||
}
|
}
|
||||||
if val {
|
emit.Bool(script, val)
|
||||||
emit.Int(script, 1)
|
|
||||||
} else {
|
|
||||||
emit.Int(script, 0)
|
|
||||||
}
|
|
||||||
case smartcontract.ArrayType:
|
case smartcontract.ArrayType:
|
||||||
val, err := fp.Value.GetArray()
|
val, err := fp.Value.GetArray()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -62,13 +62,13 @@ func TestInvocationScriptCreationGood(t *testing.T) {
|
||||||
script: "ERHAHwwBYQwUb0WRYs7rJIsHHsFX2eT2/Sb9vlBBYn1bUg==",
|
script: "ERHAHwwBYQwUb0WRYs7rJIsHHsFX2eT2/Sb9vlBBYn1bUg==",
|
||||||
}, {
|
}, {
|
||||||
ps: Params{{RawMessage: []byte(`"a"`)}, {RawMessage: []byte(`[{"type": "Boolean", "value": true}]`)}},
|
ps: Params{{RawMessage: []byte(`"a"`)}, {RawMessage: []byte(`[{"type": "Boolean", "value": true}]`)}},
|
||||||
script: "ERHAHwwBYQwUb0WRYs7rJIsHHsFX2eT2/Sb9vlBBYn1bUg==",
|
script: "CBHAHwwBYQwUb0WRYs7rJIsHHsFX2eT2/Sb9vlBBYn1bUg==",
|
||||||
}, {
|
}, {
|
||||||
ps: Params{{RawMessage: []byte(`"a"`)}, {RawMessage: []byte(`[{"type": "Boolean", "value": false}]`)}},
|
ps: Params{{RawMessage: []byte(`"a"`)}, {RawMessage: []byte(`[{"type": "Boolean", "value": false}]`)}},
|
||||||
script: "EBHAHwwBYQwUb0WRYs7rJIsHHsFX2eT2/Sb9vlBBYn1bUg==",
|
script: "CRHAHwwBYQwUb0WRYs7rJIsHHsFX2eT2/Sb9vlBBYn1bUg==",
|
||||||
}, {
|
}, {
|
||||||
ps: Params{{RawMessage: []byte(`"a"`)}, {RawMessage: []byte(`[{"type": "Boolean", "value": "blah"}]`)}}, // C# code doesn't use strict type assertions for JSON-ised params
|
ps: Params{{RawMessage: []byte(`"a"`)}, {RawMessage: []byte(`[{"type": "Boolean", "value": "blah"}]`)}}, // C# code doesn't use strict type assertions for JSON-ised params
|
||||||
script: "ERHAHwwBYQwUb0WRYs7rJIsHHsFX2eT2/Sb9vlBBYn1bUg==",
|
script: "CBHAHwwBYQwUb0WRYs7rJIsHHsFX2eT2/Sb9vlBBYn1bUg==",
|
||||||
}}
|
}}
|
||||||
for i, ps := range paramScripts {
|
for i, ps := range paramScripts {
|
||||||
method, err := ps.ps[0].GetString()
|
method, err := ps.ps[0].GetString()
|
||||||
|
|
|
@ -1438,7 +1438,7 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
res, ok := inv.(*result.Invoke)
|
res, ok := inv.(*result.Invoke)
|
||||||
require.True(t, ok)
|
require.True(t, ok)
|
||||||
expectedInvScript := io.NewBufBinWriter()
|
expectedInvScript := io.NewBufBinWriter()
|
||||||
emit.Int(expectedInvScript.BinWriter, 0)
|
emit.Bool(expectedInvScript.BinWriter, false)
|
||||||
emit.Int(expectedInvScript.BinWriter, int64(4))
|
emit.Int(expectedInvScript.BinWriter, int64(4))
|
||||||
emit.String(expectedInvScript.BinWriter, "good_string")
|
emit.String(expectedInvScript.BinWriter, "good_string")
|
||||||
require.NoError(t, expectedInvScript.Err)
|
require.NoError(t, expectedInvScript.Err)
|
||||||
|
@ -1456,7 +1456,7 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
res, ok := inv.(*result.Invoke)
|
res, ok := inv.(*result.Invoke)
|
||||||
require.True(t, ok)
|
require.True(t, ok)
|
||||||
expectedInvScript := io.NewBufBinWriter()
|
expectedInvScript := io.NewBufBinWriter()
|
||||||
emit.Int(expectedInvScript.BinWriter, 0)
|
emit.Bool(expectedInvScript.BinWriter, false)
|
||||||
emit.Int(expectedInvScript.BinWriter, int64(4))
|
emit.Int(expectedInvScript.BinWriter, int64(4))
|
||||||
emit.String(expectedInvScript.BinWriter, "invalid_string")
|
emit.String(expectedInvScript.BinWriter, "invalid_string")
|
||||||
require.NoError(t, expectedInvScript.Err)
|
require.NoError(t, expectedInvScript.Err)
|
||||||
|
@ -1556,7 +1556,7 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
res, ok := inv.(*result.Invoke)
|
res, ok := inv.(*result.Invoke)
|
||||||
require.True(t, ok)
|
require.True(t, ok)
|
||||||
expectedInvScript := io.NewBufBinWriter()
|
expectedInvScript := io.NewBufBinWriter()
|
||||||
emit.Int(expectedInvScript.BinWriter, 0)
|
emit.Bool(expectedInvScript.BinWriter, false)
|
||||||
emit.Int(expectedInvScript.BinWriter, int64(4))
|
emit.Int(expectedInvScript.BinWriter, int64(4))
|
||||||
emit.String(expectedInvScript.BinWriter, "good_string")
|
emit.String(expectedInvScript.BinWriter, "good_string")
|
||||||
require.NoError(t, expectedInvScript.Err)
|
require.NoError(t, expectedInvScript.Err)
|
||||||
|
@ -1574,7 +1574,7 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
res, ok := inv.(*result.Invoke)
|
res, ok := inv.(*result.Invoke)
|
||||||
require.True(t, ok)
|
require.True(t, ok)
|
||||||
expectedInvScript := io.NewBufBinWriter()
|
expectedInvScript := io.NewBufBinWriter()
|
||||||
emit.Int(expectedInvScript.BinWriter, 0)
|
emit.Bool(expectedInvScript.BinWriter, false)
|
||||||
emit.Int(expectedInvScript.BinWriter, int64(4))
|
emit.Int(expectedInvScript.BinWriter, int64(4))
|
||||||
emit.String(expectedInvScript.BinWriter, "invalid_string")
|
emit.String(expectedInvScript.BinWriter, "invalid_string")
|
||||||
require.NoError(t, expectedInvScript.Err)
|
require.NoError(t, expectedInvScript.Err)
|
||||||
|
@ -2560,7 +2560,7 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) []
|
||||||
t.Run("contract-based verification with parameters", func(t *testing.T) {
|
t.Run("contract-based verification with parameters", func(t *testing.T) {
|
||||||
verAcc, err := util.Uint160DecodeStringLE(verifyWithArgsContractHash)
|
verAcc, err := util.Uint160DecodeStringLE(verifyWithArgsContractHash)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
checkContract(t, verAcc, []byte{}, 245250) // No C# match, but we believe it's OK and it differs from the one above.
|
checkContract(t, verAcc, []byte{}, 244130) // No C# match, but we believe it's OK and it differs from the one above.
|
||||||
})
|
})
|
||||||
t.Run("contract-based verification with invocation script", func(t *testing.T) {
|
t.Run("contract-based verification with invocation script", func(t *testing.T) {
|
||||||
verAcc, err := util.Uint160DecodeStringLE(verifyWithArgsContractHash)
|
verAcc, err := util.Uint160DecodeStringLE(verifyWithArgsContractHash)
|
||||||
|
@ -2570,7 +2570,7 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) []
|
||||||
emit.Int(invocWriter.BinWriter, 5)
|
emit.Int(invocWriter.BinWriter, 5)
|
||||||
emit.String(invocWriter.BinWriter, "")
|
emit.String(invocWriter.BinWriter, "")
|
||||||
invocScript := invocWriter.Bytes()
|
invocScript := invocWriter.Bytes()
|
||||||
checkContract(t, verAcc, invocScript, 148080) // No C# match, but we believe it's OK and it has a specific invocation script overriding anything server-side.
|
checkContract(t, verAcc, invocScript, 146960) // No C# match, but we believe it's OK and it has a specific invocation script overriding anything server-side.
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -347,7 +347,7 @@ func TestEncodeDefaultValue(t *testing.T) {
|
||||||
for p, l := range map[ParamType]int{
|
for p, l := range map[ParamType]int{
|
||||||
UnknownType: 0,
|
UnknownType: 0,
|
||||||
AnyType: 66,
|
AnyType: 66,
|
||||||
BoolType: 2,
|
BoolType: 1,
|
||||||
IntegerType: 33,
|
IntegerType: 33,
|
||||||
ByteArrayType: 66,
|
ByteArrayType: 66,
|
||||||
StringType: 66,
|
StringType: 66,
|
||||||
|
|
|
@ -31,11 +31,11 @@ func Opcodes(w *io.BinWriter, ops ...opcode.Opcode) {
|
||||||
|
|
||||||
// Bool emits a bool type to the given buffer.
|
// Bool emits a bool type to the given buffer.
|
||||||
func Bool(w *io.BinWriter, ok bool) {
|
func Bool(w *io.BinWriter, ok bool) {
|
||||||
var opVal = opcode.PUSHF
|
var opVal = opcode.PUSHT
|
||||||
if !ok {
|
if !ok {
|
||||||
opVal = opcode.PUSHT
|
opVal = opcode.PUSHF
|
||||||
}
|
}
|
||||||
Opcodes(w, opVal, opcode.NOT)
|
Opcodes(w, opVal)
|
||||||
}
|
}
|
||||||
|
|
||||||
func padRight(s int, buf []byte) []byte {
|
func padRight(s int, buf []byte) []byte {
|
||||||
|
|
|
@ -224,15 +224,15 @@ func TestEmitArray(t *testing.T) {
|
||||||
veryBig := new(big.Int).SetUint64(math.MaxUint64)
|
veryBig := new(big.Int).SetUint64(math.MaxUint64)
|
||||||
veryBig.Add(veryBig, big.NewInt(1))
|
veryBig.Add(veryBig, big.NewInt(1))
|
||||||
Array(buf.BinWriter, p160, p256, &u160, &u256, u160, u256, big.NewInt(0), veryBig,
|
Array(buf.BinWriter, p160, p256, &u160, &u256, u160, u256, big.NewInt(0), veryBig,
|
||||||
[]interface{}{int64(1), int64(2)}, nil, int64(1), "str", true, []byte{0xCA, 0xFE})
|
[]interface{}{int64(1), int64(2)}, nil, int64(1), "str", false, true, []byte{0xCA, 0xFE})
|
||||||
require.NoError(t, buf.Err)
|
require.NoError(t, buf.Err)
|
||||||
|
|
||||||
res := buf.Bytes()
|
res := buf.Bytes()
|
||||||
assert.EqualValues(t, opcode.PUSHDATA1, res[0])
|
assert.EqualValues(t, opcode.PUSHDATA1, res[0])
|
||||||
assert.EqualValues(t, 2, res[1])
|
assert.EqualValues(t, 2, res[1])
|
||||||
assert.EqualValues(t, []byte{0xCA, 0xFE}, res[2:4])
|
assert.EqualValues(t, []byte{0xCA, 0xFE}, res[2:4])
|
||||||
assert.EqualValues(t, opcode.PUSHF, res[4])
|
assert.EqualValues(t, opcode.PUSHT, res[4])
|
||||||
assert.EqualValues(t, opcode.NOT, res[5])
|
assert.EqualValues(t, opcode.PUSHF, res[5])
|
||||||
assert.EqualValues(t, opcode.PUSHDATA1, res[6])
|
assert.EqualValues(t, opcode.PUSHDATA1, res[6])
|
||||||
assert.EqualValues(t, 3, res[7])
|
assert.EqualValues(t, 3, res[7])
|
||||||
assert.EqualValues(t, []byte("str"), res[8:11])
|
assert.EqualValues(t, []byte("str"), res[8:11])
|
||||||
|
@ -280,10 +280,8 @@ func TestEmitBool(t *testing.T) {
|
||||||
Bool(buf.BinWriter, true)
|
Bool(buf.BinWriter, true)
|
||||||
Bool(buf.BinWriter, false)
|
Bool(buf.BinWriter, false)
|
||||||
result := buf.Bytes()
|
result := buf.Bytes()
|
||||||
assert.EqualValues(t, opcode.PUSH0, result[0])
|
assert.EqualValues(t, opcode.PUSHT, result[0])
|
||||||
assert.EqualValues(t, opcode.NOT, result[1])
|
assert.EqualValues(t, opcode.PUSHF, result[1])
|
||||||
assert.EqualValues(t, opcode.PUSH1, result[2])
|
|
||||||
assert.EqualValues(t, opcode.NOT, result[3])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEmitOpcode(t *testing.T) {
|
func TestEmitOpcode(t *testing.T) {
|
||||||
|
|
|
@ -15,6 +15,9 @@ const (
|
||||||
PUSHINT128 Opcode = 0x04
|
PUSHINT128 Opcode = 0x04
|
||||||
PUSHINT256 Opcode = 0x05
|
PUSHINT256 Opcode = 0x05
|
||||||
|
|
||||||
|
PUSHT Opcode = 0x08
|
||||||
|
PUSHF Opcode = 0x09
|
||||||
|
|
||||||
PUSHA Opcode = 0x0A
|
PUSHA Opcode = 0x0A
|
||||||
PUSHNULL Opcode = 0x0B
|
PUSHNULL Opcode = 0x0B
|
||||||
|
|
||||||
|
@ -24,9 +27,7 @@ const (
|
||||||
|
|
||||||
PUSHM1 Opcode = 0x0F
|
PUSHM1 Opcode = 0x0F
|
||||||
PUSH0 Opcode = 0x10
|
PUSH0 Opcode = 0x10
|
||||||
PUSHF Opcode = PUSH0
|
|
||||||
PUSH1 Opcode = 0x11
|
PUSH1 Opcode = 0x11
|
||||||
PUSHT Opcode = PUSH1
|
|
||||||
PUSH2 Opcode = 0x12
|
PUSH2 Opcode = 0x12
|
||||||
PUSH3 Opcode = 0x13
|
PUSH3 Opcode = 0x13
|
||||||
PUSH4 Opcode = 0x14
|
PUSH4 Opcode = 0x14
|
||||||
|
|
|
@ -14,6 +14,8 @@ func _() {
|
||||||
_ = x[PUSHINT64-3]
|
_ = x[PUSHINT64-3]
|
||||||
_ = x[PUSHINT128-4]
|
_ = x[PUSHINT128-4]
|
||||||
_ = x[PUSHINT256-5]
|
_ = x[PUSHINT256-5]
|
||||||
|
_ = x[PUSHT-8]
|
||||||
|
_ = x[PUSHF-9]
|
||||||
_ = x[PUSHA-10]
|
_ = x[PUSHA-10]
|
||||||
_ = x[PUSHNULL-11]
|
_ = x[PUSHNULL-11]
|
||||||
_ = x[PUSHDATA1-12]
|
_ = x[PUSHDATA1-12]
|
||||||
|
@ -21,9 +23,7 @@ func _() {
|
||||||
_ = x[PUSHDATA4-14]
|
_ = x[PUSHDATA4-14]
|
||||||
_ = x[PUSHM1-15]
|
_ = x[PUSHM1-15]
|
||||||
_ = x[PUSH0-16]
|
_ = x[PUSH0-16]
|
||||||
_ = x[PUSHF-16]
|
|
||||||
_ = x[PUSH1-17]
|
_ = x[PUSH1-17]
|
||||||
_ = x[PUSHT-17]
|
|
||||||
_ = x[PUSH2-18]
|
_ = x[PUSH2-18]
|
||||||
_ = x[PUSH3-19]
|
_ = x[PUSH3-19]
|
||||||
_ = x[PUSH4-20]
|
_ = x[PUSH4-20]
|
||||||
|
@ -204,7 +204,7 @@ func _() {
|
||||||
_ = x[CONVERT-219]
|
_ = x[CONVERT-219]
|
||||||
}
|
}
|
||||||
|
|
||||||
const _Opcode_name = "PUSHINT8PUSHINT16PUSHINT32PUSHINT64PUSHINT128PUSHINT256PUSHAPUSHNULLPUSHDATA1PUSHDATA2PUSHDATA4PUSHM1PUSH0PUSH1PUSH2PUSH3PUSH4PUSH5PUSH6PUSH7PUSH8PUSH9PUSH10PUSH11PUSH12PUSH13PUSH14PUSH15PUSH16NOPJMPJMP_LJMPIFJMPIF_LJMPIFNOTJMPIFNOT_LJMPEQJMPEQ_LJMPNEJMPNE_LJMPGTJMPGT_LJMPGEJMPGE_LJMPLTJMPLT_LJMPLEJMPLE_LCALLCALL_LCALLACALLTABORTASSERTTHROWTRYTRY_LENDTRYENDTRY_LENDFINALLYRETSYSCALLDEPTHDROPNIPXDROPCLEARDUPOVERPICKTUCKSWAPROTROLLREVERSE3REVERSE4REVERSENINITSSLOTINITSLOTLDSFLD0LDSFLD1LDSFLD2LDSFLD3LDSFLD4LDSFLD5LDSFLD6LDSFLDSTSFLD0STSFLD1STSFLD2STSFLD3STSFLD4STSFLD5STSFLD6STSFLDLDLOC0LDLOC1LDLOC2LDLOC3LDLOC4LDLOC5LDLOC6LDLOCSTLOC0STLOC1STLOC2STLOC3STLOC4STLOC5STLOC6STLOCLDARG0LDARG1LDARG2LDARG3LDARG4LDARG5LDARG6LDARGSTARG0STARG1STARG2STARG3STARG4STARG5STARG6STARGNEWBUFFERMEMCPYCATSUBSTRLEFTRIGHTINVERTANDORXOREQUALNOTEQUALSIGNABSNEGATEINCDECADDSUBMULDIVMODPOWSQRTMODMULMODPOWSHLSHRNOTBOOLANDBOOLORNZNUMEQUALNUMNOTEQUALLTLEGTGEMINMAXWITHINPACKMAPPACKSTRUCTPACKUNPACKNEWARRAY0NEWARRAYNEWARRAY_TNEWSTRUCT0NEWSTRUCTNEWMAPSIZEHASKEYKEYSVALUESPICKITEMAPPENDSETITEMREVERSEITEMSREMOVECLEARITEMSPOPITEMISNULLISTYPECONVERT"
|
const _Opcode_name = "PUSHINT8PUSHINT16PUSHINT32PUSHINT64PUSHINT128PUSHINT256PUSHTPUSHFPUSHAPUSHNULLPUSHDATA1PUSHDATA2PUSHDATA4PUSHM1PUSH0PUSH1PUSH2PUSH3PUSH4PUSH5PUSH6PUSH7PUSH8PUSH9PUSH10PUSH11PUSH12PUSH13PUSH14PUSH15PUSH16NOPJMPJMP_LJMPIFJMPIF_LJMPIFNOTJMPIFNOT_LJMPEQJMPEQ_LJMPNEJMPNE_LJMPGTJMPGT_LJMPGEJMPGE_LJMPLTJMPLT_LJMPLEJMPLE_LCALLCALL_LCALLACALLTABORTASSERTTHROWTRYTRY_LENDTRYENDTRY_LENDFINALLYRETSYSCALLDEPTHDROPNIPXDROPCLEARDUPOVERPICKTUCKSWAPROTROLLREVERSE3REVERSE4REVERSENINITSSLOTINITSLOTLDSFLD0LDSFLD1LDSFLD2LDSFLD3LDSFLD4LDSFLD5LDSFLD6LDSFLDSTSFLD0STSFLD1STSFLD2STSFLD3STSFLD4STSFLD5STSFLD6STSFLDLDLOC0LDLOC1LDLOC2LDLOC3LDLOC4LDLOC5LDLOC6LDLOCSTLOC0STLOC1STLOC2STLOC3STLOC4STLOC5STLOC6STLOCLDARG0LDARG1LDARG2LDARG3LDARG4LDARG5LDARG6LDARGSTARG0STARG1STARG2STARG3STARG4STARG5STARG6STARGNEWBUFFERMEMCPYCATSUBSTRLEFTRIGHTINVERTANDORXOREQUALNOTEQUALSIGNABSNEGATEINCDECADDSUBMULDIVMODPOWSQRTMODMULMODPOWSHLSHRNOTBOOLANDBOOLORNZNUMEQUALNUMNOTEQUALLTLEGTGEMINMAXWITHINPACKMAPPACKSTRUCTPACKUNPACKNEWARRAY0NEWARRAYNEWARRAY_TNEWSTRUCT0NEWSTRUCTNEWMAPSIZEHASKEYKEYSVALUESPICKITEMAPPENDSETITEMREVERSEITEMSREMOVECLEARITEMSPOPITEMISNULLISTYPECONVERT"
|
||||||
|
|
||||||
var _Opcode_map = map[Opcode]string{
|
var _Opcode_map = map[Opcode]string{
|
||||||
0: _Opcode_name[0:8],
|
0: _Opcode_name[0:8],
|
||||||
|
@ -213,192 +213,194 @@ var _Opcode_map = map[Opcode]string{
|
||||||
3: _Opcode_name[26:35],
|
3: _Opcode_name[26:35],
|
||||||
4: _Opcode_name[35:45],
|
4: _Opcode_name[35:45],
|
||||||
5: _Opcode_name[45:55],
|
5: _Opcode_name[45:55],
|
||||||
10: _Opcode_name[55:60],
|
8: _Opcode_name[55:60],
|
||||||
11: _Opcode_name[60:68],
|
9: _Opcode_name[60:65],
|
||||||
12: _Opcode_name[68:77],
|
10: _Opcode_name[65:70],
|
||||||
13: _Opcode_name[77:86],
|
11: _Opcode_name[70:78],
|
||||||
14: _Opcode_name[86:95],
|
12: _Opcode_name[78:87],
|
||||||
15: _Opcode_name[95:101],
|
13: _Opcode_name[87:96],
|
||||||
16: _Opcode_name[101:106],
|
14: _Opcode_name[96:105],
|
||||||
17: _Opcode_name[106:111],
|
15: _Opcode_name[105:111],
|
||||||
18: _Opcode_name[111:116],
|
16: _Opcode_name[111:116],
|
||||||
19: _Opcode_name[116:121],
|
17: _Opcode_name[116:121],
|
||||||
20: _Opcode_name[121:126],
|
18: _Opcode_name[121:126],
|
||||||
21: _Opcode_name[126:131],
|
19: _Opcode_name[126:131],
|
||||||
22: _Opcode_name[131:136],
|
20: _Opcode_name[131:136],
|
||||||
23: _Opcode_name[136:141],
|
21: _Opcode_name[136:141],
|
||||||
24: _Opcode_name[141:146],
|
22: _Opcode_name[141:146],
|
||||||
25: _Opcode_name[146:151],
|
23: _Opcode_name[146:151],
|
||||||
26: _Opcode_name[151:157],
|
24: _Opcode_name[151:156],
|
||||||
27: _Opcode_name[157:163],
|
25: _Opcode_name[156:161],
|
||||||
28: _Opcode_name[163:169],
|
26: _Opcode_name[161:167],
|
||||||
29: _Opcode_name[169:175],
|
27: _Opcode_name[167:173],
|
||||||
30: _Opcode_name[175:181],
|
28: _Opcode_name[173:179],
|
||||||
31: _Opcode_name[181:187],
|
29: _Opcode_name[179:185],
|
||||||
32: _Opcode_name[187:193],
|
30: _Opcode_name[185:191],
|
||||||
33: _Opcode_name[193:196],
|
31: _Opcode_name[191:197],
|
||||||
34: _Opcode_name[196:199],
|
32: _Opcode_name[197:203],
|
||||||
35: _Opcode_name[199:204],
|
33: _Opcode_name[203:206],
|
||||||
36: _Opcode_name[204:209],
|
34: _Opcode_name[206:209],
|
||||||
37: _Opcode_name[209:216],
|
35: _Opcode_name[209:214],
|
||||||
38: _Opcode_name[216:224],
|
36: _Opcode_name[214:219],
|
||||||
39: _Opcode_name[224:234],
|
37: _Opcode_name[219:226],
|
||||||
40: _Opcode_name[234:239],
|
38: _Opcode_name[226:234],
|
||||||
41: _Opcode_name[239:246],
|
39: _Opcode_name[234:244],
|
||||||
42: _Opcode_name[246:251],
|
40: _Opcode_name[244:249],
|
||||||
43: _Opcode_name[251:258],
|
41: _Opcode_name[249:256],
|
||||||
44: _Opcode_name[258:263],
|
42: _Opcode_name[256:261],
|
||||||
45: _Opcode_name[263:270],
|
43: _Opcode_name[261:268],
|
||||||
46: _Opcode_name[270:275],
|
44: _Opcode_name[268:273],
|
||||||
47: _Opcode_name[275:282],
|
45: _Opcode_name[273:280],
|
||||||
48: _Opcode_name[282:287],
|
46: _Opcode_name[280:285],
|
||||||
49: _Opcode_name[287:294],
|
47: _Opcode_name[285:292],
|
||||||
50: _Opcode_name[294:299],
|
48: _Opcode_name[292:297],
|
||||||
51: _Opcode_name[299:306],
|
49: _Opcode_name[297:304],
|
||||||
52: _Opcode_name[306:310],
|
50: _Opcode_name[304:309],
|
||||||
53: _Opcode_name[310:316],
|
51: _Opcode_name[309:316],
|
||||||
54: _Opcode_name[316:321],
|
52: _Opcode_name[316:320],
|
||||||
55: _Opcode_name[321:326],
|
53: _Opcode_name[320:326],
|
||||||
56: _Opcode_name[326:331],
|
54: _Opcode_name[326:331],
|
||||||
57: _Opcode_name[331:337],
|
55: _Opcode_name[331:336],
|
||||||
58: _Opcode_name[337:342],
|
56: _Opcode_name[336:341],
|
||||||
59: _Opcode_name[342:345],
|
57: _Opcode_name[341:347],
|
||||||
60: _Opcode_name[345:350],
|
58: _Opcode_name[347:352],
|
||||||
61: _Opcode_name[350:356],
|
59: _Opcode_name[352:355],
|
||||||
62: _Opcode_name[356:364],
|
60: _Opcode_name[355:360],
|
||||||
63: _Opcode_name[364:374],
|
61: _Opcode_name[360:366],
|
||||||
64: _Opcode_name[374:377],
|
62: _Opcode_name[366:374],
|
||||||
65: _Opcode_name[377:384],
|
63: _Opcode_name[374:384],
|
||||||
67: _Opcode_name[384:389],
|
64: _Opcode_name[384:387],
|
||||||
69: _Opcode_name[389:393],
|
65: _Opcode_name[387:394],
|
||||||
70: _Opcode_name[393:396],
|
67: _Opcode_name[394:399],
|
||||||
72: _Opcode_name[396:401],
|
69: _Opcode_name[399:403],
|
||||||
73: _Opcode_name[401:406],
|
70: _Opcode_name[403:406],
|
||||||
74: _Opcode_name[406:409],
|
72: _Opcode_name[406:411],
|
||||||
75: _Opcode_name[409:413],
|
73: _Opcode_name[411:416],
|
||||||
77: _Opcode_name[413:417],
|
74: _Opcode_name[416:419],
|
||||||
78: _Opcode_name[417:421],
|
75: _Opcode_name[419:423],
|
||||||
80: _Opcode_name[421:425],
|
77: _Opcode_name[423:427],
|
||||||
81: _Opcode_name[425:428],
|
78: _Opcode_name[427:431],
|
||||||
82: _Opcode_name[428:432],
|
80: _Opcode_name[431:435],
|
||||||
83: _Opcode_name[432:440],
|
81: _Opcode_name[435:438],
|
||||||
84: _Opcode_name[440:448],
|
82: _Opcode_name[438:442],
|
||||||
85: _Opcode_name[448:456],
|
83: _Opcode_name[442:450],
|
||||||
86: _Opcode_name[456:465],
|
84: _Opcode_name[450:458],
|
||||||
87: _Opcode_name[465:473],
|
85: _Opcode_name[458:466],
|
||||||
88: _Opcode_name[473:480],
|
86: _Opcode_name[466:475],
|
||||||
89: _Opcode_name[480:487],
|
87: _Opcode_name[475:483],
|
||||||
90: _Opcode_name[487:494],
|
88: _Opcode_name[483:490],
|
||||||
91: _Opcode_name[494:501],
|
89: _Opcode_name[490:497],
|
||||||
92: _Opcode_name[501:508],
|
90: _Opcode_name[497:504],
|
||||||
93: _Opcode_name[508:515],
|
91: _Opcode_name[504:511],
|
||||||
94: _Opcode_name[515:522],
|
92: _Opcode_name[511:518],
|
||||||
95: _Opcode_name[522:528],
|
93: _Opcode_name[518:525],
|
||||||
96: _Opcode_name[528:535],
|
94: _Opcode_name[525:532],
|
||||||
97: _Opcode_name[535:542],
|
95: _Opcode_name[532:538],
|
||||||
98: _Opcode_name[542:549],
|
96: _Opcode_name[538:545],
|
||||||
99: _Opcode_name[549:556],
|
97: _Opcode_name[545:552],
|
||||||
100: _Opcode_name[556:563],
|
98: _Opcode_name[552:559],
|
||||||
101: _Opcode_name[563:570],
|
99: _Opcode_name[559:566],
|
||||||
102: _Opcode_name[570:577],
|
100: _Opcode_name[566:573],
|
||||||
103: _Opcode_name[577:583],
|
101: _Opcode_name[573:580],
|
||||||
104: _Opcode_name[583:589],
|
102: _Opcode_name[580:587],
|
||||||
105: _Opcode_name[589:595],
|
103: _Opcode_name[587:593],
|
||||||
106: _Opcode_name[595:601],
|
104: _Opcode_name[593:599],
|
||||||
107: _Opcode_name[601:607],
|
105: _Opcode_name[599:605],
|
||||||
108: _Opcode_name[607:613],
|
106: _Opcode_name[605:611],
|
||||||
109: _Opcode_name[613:619],
|
107: _Opcode_name[611:617],
|
||||||
110: _Opcode_name[619:625],
|
108: _Opcode_name[617:623],
|
||||||
111: _Opcode_name[625:630],
|
109: _Opcode_name[623:629],
|
||||||
112: _Opcode_name[630:636],
|
110: _Opcode_name[629:635],
|
||||||
113: _Opcode_name[636:642],
|
111: _Opcode_name[635:640],
|
||||||
114: _Opcode_name[642:648],
|
112: _Opcode_name[640:646],
|
||||||
115: _Opcode_name[648:654],
|
113: _Opcode_name[646:652],
|
||||||
116: _Opcode_name[654:660],
|
114: _Opcode_name[652:658],
|
||||||
117: _Opcode_name[660:666],
|
115: _Opcode_name[658:664],
|
||||||
118: _Opcode_name[666:672],
|
116: _Opcode_name[664:670],
|
||||||
119: _Opcode_name[672:677],
|
117: _Opcode_name[670:676],
|
||||||
120: _Opcode_name[677:683],
|
118: _Opcode_name[676:682],
|
||||||
121: _Opcode_name[683:689],
|
119: _Opcode_name[682:687],
|
||||||
122: _Opcode_name[689:695],
|
120: _Opcode_name[687:693],
|
||||||
123: _Opcode_name[695:701],
|
121: _Opcode_name[693:699],
|
||||||
124: _Opcode_name[701:707],
|
122: _Opcode_name[699:705],
|
||||||
125: _Opcode_name[707:713],
|
123: _Opcode_name[705:711],
|
||||||
126: _Opcode_name[713:719],
|
124: _Opcode_name[711:717],
|
||||||
127: _Opcode_name[719:724],
|
125: _Opcode_name[717:723],
|
||||||
128: _Opcode_name[724:730],
|
126: _Opcode_name[723:729],
|
||||||
129: _Opcode_name[730:736],
|
127: _Opcode_name[729:734],
|
||||||
130: _Opcode_name[736:742],
|
128: _Opcode_name[734:740],
|
||||||
131: _Opcode_name[742:748],
|
129: _Opcode_name[740:746],
|
||||||
132: _Opcode_name[748:754],
|
130: _Opcode_name[746:752],
|
||||||
133: _Opcode_name[754:760],
|
131: _Opcode_name[752:758],
|
||||||
134: _Opcode_name[760:766],
|
132: _Opcode_name[758:764],
|
||||||
135: _Opcode_name[766:771],
|
133: _Opcode_name[764:770],
|
||||||
136: _Opcode_name[771:780],
|
134: _Opcode_name[770:776],
|
||||||
137: _Opcode_name[780:786],
|
135: _Opcode_name[776:781],
|
||||||
139: _Opcode_name[786:789],
|
136: _Opcode_name[781:790],
|
||||||
140: _Opcode_name[789:795],
|
137: _Opcode_name[790:796],
|
||||||
141: _Opcode_name[795:799],
|
139: _Opcode_name[796:799],
|
||||||
142: _Opcode_name[799:804],
|
140: _Opcode_name[799:805],
|
||||||
144: _Opcode_name[804:810],
|
141: _Opcode_name[805:809],
|
||||||
145: _Opcode_name[810:813],
|
142: _Opcode_name[809:814],
|
||||||
146: _Opcode_name[813:815],
|
144: _Opcode_name[814:820],
|
||||||
147: _Opcode_name[815:818],
|
145: _Opcode_name[820:823],
|
||||||
151: _Opcode_name[818:823],
|
146: _Opcode_name[823:825],
|
||||||
152: _Opcode_name[823:831],
|
147: _Opcode_name[825:828],
|
||||||
153: _Opcode_name[831:835],
|
151: _Opcode_name[828:833],
|
||||||
154: _Opcode_name[835:838],
|
152: _Opcode_name[833:841],
|
||||||
155: _Opcode_name[838:844],
|
153: _Opcode_name[841:845],
|
||||||
156: _Opcode_name[844:847],
|
154: _Opcode_name[845:848],
|
||||||
157: _Opcode_name[847:850],
|
155: _Opcode_name[848:854],
|
||||||
158: _Opcode_name[850:853],
|
156: _Opcode_name[854:857],
|
||||||
159: _Opcode_name[853:856],
|
157: _Opcode_name[857:860],
|
||||||
160: _Opcode_name[856:859],
|
158: _Opcode_name[860:863],
|
||||||
161: _Opcode_name[859:862],
|
159: _Opcode_name[863:866],
|
||||||
162: _Opcode_name[862:865],
|
160: _Opcode_name[866:869],
|
||||||
163: _Opcode_name[865:868],
|
161: _Opcode_name[869:872],
|
||||||
164: _Opcode_name[868:872],
|
162: _Opcode_name[872:875],
|
||||||
165: _Opcode_name[872:878],
|
163: _Opcode_name[875:878],
|
||||||
166: _Opcode_name[878:884],
|
164: _Opcode_name[878:882],
|
||||||
168: _Opcode_name[884:887],
|
165: _Opcode_name[882:888],
|
||||||
169: _Opcode_name[887:890],
|
166: _Opcode_name[888:894],
|
||||||
170: _Opcode_name[890:893],
|
168: _Opcode_name[894:897],
|
||||||
171: _Opcode_name[893:900],
|
169: _Opcode_name[897:900],
|
||||||
172: _Opcode_name[900:906],
|
170: _Opcode_name[900:903],
|
||||||
177: _Opcode_name[906:908],
|
171: _Opcode_name[903:910],
|
||||||
179: _Opcode_name[908:916],
|
172: _Opcode_name[910:916],
|
||||||
180: _Opcode_name[916:927],
|
177: _Opcode_name[916:918],
|
||||||
181: _Opcode_name[927:929],
|
179: _Opcode_name[918:926],
|
||||||
182: _Opcode_name[929:931],
|
180: _Opcode_name[926:937],
|
||||||
183: _Opcode_name[931:933],
|
181: _Opcode_name[937:939],
|
||||||
184: _Opcode_name[933:935],
|
182: _Opcode_name[939:941],
|
||||||
185: _Opcode_name[935:938],
|
183: _Opcode_name[941:943],
|
||||||
186: _Opcode_name[938:941],
|
184: _Opcode_name[943:945],
|
||||||
187: _Opcode_name[941:947],
|
185: _Opcode_name[945:948],
|
||||||
190: _Opcode_name[947:954],
|
186: _Opcode_name[948:951],
|
||||||
191: _Opcode_name[954:964],
|
187: _Opcode_name[951:957],
|
||||||
192: _Opcode_name[964:968],
|
190: _Opcode_name[957:964],
|
||||||
193: _Opcode_name[968:974],
|
191: _Opcode_name[964:974],
|
||||||
194: _Opcode_name[974:983],
|
192: _Opcode_name[974:978],
|
||||||
195: _Opcode_name[983:991],
|
193: _Opcode_name[978:984],
|
||||||
196: _Opcode_name[991:1001],
|
194: _Opcode_name[984:993],
|
||||||
197: _Opcode_name[1001:1011],
|
195: _Opcode_name[993:1001],
|
||||||
198: _Opcode_name[1011:1020],
|
196: _Opcode_name[1001:1011],
|
||||||
200: _Opcode_name[1020:1026],
|
197: _Opcode_name[1011:1021],
|
||||||
202: _Opcode_name[1026:1030],
|
198: _Opcode_name[1021:1030],
|
||||||
203: _Opcode_name[1030:1036],
|
200: _Opcode_name[1030:1036],
|
||||||
204: _Opcode_name[1036:1040],
|
202: _Opcode_name[1036:1040],
|
||||||
205: _Opcode_name[1040:1046],
|
203: _Opcode_name[1040:1046],
|
||||||
206: _Opcode_name[1046:1054],
|
204: _Opcode_name[1046:1050],
|
||||||
207: _Opcode_name[1054:1060],
|
205: _Opcode_name[1050:1056],
|
||||||
208: _Opcode_name[1060:1067],
|
206: _Opcode_name[1056:1064],
|
||||||
209: _Opcode_name[1067:1079],
|
207: _Opcode_name[1064:1070],
|
||||||
210: _Opcode_name[1079:1085],
|
208: _Opcode_name[1070:1077],
|
||||||
211: _Opcode_name[1085:1095],
|
209: _Opcode_name[1077:1089],
|
||||||
212: _Opcode_name[1095:1102],
|
210: _Opcode_name[1089:1095],
|
||||||
216: _Opcode_name[1102:1108],
|
211: _Opcode_name[1095:1105],
|
||||||
217: _Opcode_name[1108:1114],
|
212: _Opcode_name[1105:1112],
|
||||||
219: _Opcode_name[1114:1121],
|
216: _Opcode_name[1112:1118],
|
||||||
|
217: _Opcode_name[1118:1124],
|
||||||
|
219: _Opcode_name[1124:1131],
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i Opcode) String() string {
|
func (i Opcode) String() string {
|
||||||
|
|
|
@ -612,6 +612,9 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro
|
||||||
case opcode.PUSHDATA1, opcode.PUSHDATA2, opcode.PUSHDATA4:
|
case opcode.PUSHDATA1, opcode.PUSHDATA2, opcode.PUSHDATA4:
|
||||||
v.estack.PushItem(stackitem.NewByteArray(parameter))
|
v.estack.PushItem(stackitem.NewByteArray(parameter))
|
||||||
|
|
||||||
|
case opcode.PUSHT, opcode.PUSHF:
|
||||||
|
v.estack.PushItem(stackitem.NewBool(op == opcode.PUSHT))
|
||||||
|
|
||||||
case opcode.PUSHA:
|
case opcode.PUSHA:
|
||||||
n := getJumpOffset(ctx, parameter)
|
n := getJumpOffset(ctx, parameter)
|
||||||
ptr := stackitem.NewPointerWithHash(n, ctx.sc.prog, ctx.ScriptHash())
|
ptr := stackitem.NewPointerWithHash(n, ctx.sc.prog, ctx.ScriptHash())
|
||||||
|
|
Loading…
Reference in a new issue