diff --git a/pkg/vm/compiler/compiler.go b/pkg/vm/compiler/compiler.go index 828e8983c..e16da65e5 100644 --- a/pkg/vm/compiler/compiler.go +++ b/pkg/vm/compiler/compiler.go @@ -112,22 +112,19 @@ func CompileAndInspect(src string) error { fmt.Fprintln(w, "INDEX\tOPCODE\tDESC\t") for i := 0; i <= len(b)-1; { instr := vm.Instruction(b[i]) - if instr >= vm.PUSHBYTES1 && instr <= vm.PUSHBYTES75 { - fmt.Fprintf(w, "%d\t0x%x\t%s\t\n", i, b[i], fmt.Sprintf("PUSHBYTES%d", int(instr))) - for x := 0; x < int(instr); x++ { - fmt.Fprintf(w, "%d\t0x%x\t%s\t\n", i, b[i+1+x], string(b[i+1+x])) - } - i += int(instr) + 1 - continue - } + paramlength := 0 fmt.Fprintf(w, "%d\t0x%x\t%s\t\n", i, b[i], instr) i++ - if instr == vm.JMP || instr == vm.JMPIF || instr == vm.JMPIFNOT || instr == vm.CALL { - for x := 0; x < 2; x++ { - fmt.Fprintf(w, "%d\t0x%x\t%d\t\n", i, b[i + x], b[i + x]) - } - i += 2 + if instr >= vm.PUSHBYTES1 && instr <= vm.PUSHBYTES75 { + paramlength = int(instr) } + if instr == vm.JMP || instr == vm.JMPIF || instr == vm.JMPIFNOT || instr == vm.CALL { + paramlength = 2 + } + for x := 0; x < paramlength; x++ { + fmt.Fprintf(w, "%d\t0x%x\t%s\t\n", i, b[i+1+x], string(b[i+1+x])) + } + i += paramlength } w.Flush() return nil diff --git a/pkg/vm/instruction_string.go b/pkg/vm/instruction_string.go index da98524bb..80e60b49c 100644 --- a/pkg/vm/instruction_string.go +++ b/pkg/vm/instruction_string.go @@ -4,115 +4,251 @@ package vm import "strconv" -const _Instruction_name = "PUSH0PUSHBYTES1PUSHBYTES75PUSHDATA1PUSHDATA2PUSHDATA4PUSHM1PUSH1PUSH2PUSH3PUSH4PUSH5PUSH6PUSH7PUSH8PUSH9PUSH10PUSH11PUSH12PUSH13PUSH14PUSH15PUSH16NOPJMPJMPIFJMPIFNOTCALLRETAPPCALLSYSCALLTAILCALLDUPFROMALTSTACKTOALTSTACKFROMALTSTACKXDROPXSWAPXTUCKDEPTHDROPDUPNIPOVERPICKROLLROTSWAPTUCKCATSUBSTRLEFTRIGHTSIZEINVERTANDORXOREQUALINCDECSIGNNEGATEABSNOTNZADDSUBMULDIVMODSHLSHRBOOLANDBOOLORNUMEQUALNUMNOTEQUALLTGTLTEGTEMINMAXWITHINSHA1SHA256HASH160HASH256CHECKSIGCHECKMULTISIGARRAYSIZEPACKUNPACKPICKITEMSETITEMNEWARRAYNEWSTRUCTAPPENDREVERSEREMOVETHROWTHROWIFNOT" - -var _Instruction_map = map[Instruction]string{ - 0: _Instruction_name[0:5], - 1: _Instruction_name[5:15], - 75: _Instruction_name[15:26], - 76: _Instruction_name[26:35], - 77: _Instruction_name[35:44], - 78: _Instruction_name[44:53], - 79: _Instruction_name[53:59], - 81: _Instruction_name[59:64], - 82: _Instruction_name[64:69], - 83: _Instruction_name[69:74], - 84: _Instruction_name[74:79], - 85: _Instruction_name[79:84], - 86: _Instruction_name[84:89], - 87: _Instruction_name[89:94], - 88: _Instruction_name[94:99], - 89: _Instruction_name[99:104], - 90: _Instruction_name[104:110], - 91: _Instruction_name[110:116], - 92: _Instruction_name[116:122], - 93: _Instruction_name[122:128], - 94: _Instruction_name[128:134], - 95: _Instruction_name[134:140], - 96: _Instruction_name[140:146], - 97: _Instruction_name[146:149], - 98: _Instruction_name[149:152], - 99: _Instruction_name[152:157], - 100: _Instruction_name[157:165], - 101: _Instruction_name[165:169], - 102: _Instruction_name[169:172], - 103: _Instruction_name[172:179], - 104: _Instruction_name[179:186], - 105: _Instruction_name[186:194], - 106: _Instruction_name[194:209], - 107: _Instruction_name[209:219], - 108: _Instruction_name[219:231], - 109: _Instruction_name[231:236], - 114: _Instruction_name[236:241], - 115: _Instruction_name[241:246], - 116: _Instruction_name[246:251], - 117: _Instruction_name[251:255], - 118: _Instruction_name[255:258], - 119: _Instruction_name[258:261], - 120: _Instruction_name[261:265], - 121: _Instruction_name[265:269], - 122: _Instruction_name[269:273], - 123: _Instruction_name[273:276], - 124: _Instruction_name[276:280], - 125: _Instruction_name[280:284], - 126: _Instruction_name[284:287], - 127: _Instruction_name[287:293], - 128: _Instruction_name[293:297], - 129: _Instruction_name[297:302], - 130: _Instruction_name[302:306], - 131: _Instruction_name[306:312], - 132: _Instruction_name[312:315], - 133: _Instruction_name[315:317], - 134: _Instruction_name[317:320], - 135: _Instruction_name[320:325], - 139: _Instruction_name[325:328], - 140: _Instruction_name[328:331], - 141: _Instruction_name[331:335], - 143: _Instruction_name[335:341], - 144: _Instruction_name[341:344], - 145: _Instruction_name[344:347], - 146: _Instruction_name[347:349], - 147: _Instruction_name[349:352], - 148: _Instruction_name[352:355], - 149: _Instruction_name[355:358], - 150: _Instruction_name[358:361], - 151: _Instruction_name[361:364], - 152: _Instruction_name[364:367], - 153: _Instruction_name[367:370], - 154: _Instruction_name[370:377], - 155: _Instruction_name[377:383], - 156: _Instruction_name[383:391], - 158: _Instruction_name[391:402], - 159: _Instruction_name[402:404], - 160: _Instruction_name[404:406], - 161: _Instruction_name[406:409], - 162: _Instruction_name[409:412], - 163: _Instruction_name[412:415], - 164: _Instruction_name[415:418], - 165: _Instruction_name[418:424], - 167: _Instruction_name[424:428], - 168: _Instruction_name[428:434], - 169: _Instruction_name[434:441], - 170: _Instruction_name[441:448], - 172: _Instruction_name[448:456], - 174: _Instruction_name[456:469], - 192: _Instruction_name[469:478], - 193: _Instruction_name[478:482], - 194: _Instruction_name[482:488], - 195: _Instruction_name[488:496], - 196: _Instruction_name[496:503], - 197: _Instruction_name[503:511], - 198: _Instruction_name[511:520], - 200: _Instruction_name[520:526], - 201: _Instruction_name[526:533], - 202: _Instruction_name[533:539], - 240: _Instruction_name[539:544], - 241: _Instruction_name[544:554], +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[PUSH0-0] + _ = x[PUSHF-0] + _ = x[PUSHBYTES1-1] + _ = x[PUSHBYTES2-2] + _ = x[PUSHBYTES3-3] + _ = x[PUSHBYTES4-4] + _ = x[PUSHBYTES5-5] + _ = x[PUSHBYTES6-6] + _ = x[PUSHBYTES7-7] + _ = x[PUSHBYTES8-8] + _ = x[PUSHBYTES9-9] + _ = x[PUSHBYTES10-10] + _ = x[PUSHBYTES11-11] + _ = x[PUSHBYTES12-12] + _ = x[PUSHBYTES13-13] + _ = x[PUSHBYTES14-14] + _ = x[PUSHBYTES15-15] + _ = x[PUSHBYTES16-16] + _ = x[PUSHBYTES17-17] + _ = x[PUSHBYTES18-18] + _ = x[PUSHBYTES19-19] + _ = x[PUSHBYTES20-20] + _ = x[PUSHBYTES21-21] + _ = x[PUSHBYTES22-22] + _ = x[PUSHBYTES23-23] + _ = x[PUSHBYTES24-24] + _ = x[PUSHBYTES25-25] + _ = x[PUSHBYTES26-26] + _ = x[PUSHBYTES27-27] + _ = x[PUSHBYTES28-28] + _ = x[PUSHBYTES29-29] + _ = x[PUSHBYTES30-30] + _ = x[PUSHBYTES31-31] + _ = x[PUSHBYTES32-32] + _ = x[PUSHBYTES33-33] + _ = x[PUSHBYTES34-34] + _ = x[PUSHBYTES35-35] + _ = x[PUSHBYTES36-36] + _ = x[PUSHBYTES37-37] + _ = x[PUSHBYTES38-38] + _ = x[PUSHBYTES39-39] + _ = x[PUSHBYTES40-40] + _ = x[PUSHBYTES41-41] + _ = x[PUSHBYTES42-42] + _ = x[PUSHBYTES43-43] + _ = x[PUSHBYTES44-44] + _ = x[PUSHBYTES45-45] + _ = x[PUSHBYTES46-46] + _ = x[PUSHBYTES47-47] + _ = x[PUSHBYTES48-48] + _ = x[PUSHBYTES49-49] + _ = x[PUSHBYTES50-50] + _ = x[PUSHBYTES51-51] + _ = x[PUSHBYTES52-52] + _ = x[PUSHBYTES53-53] + _ = x[PUSHBYTES54-54] + _ = x[PUSHBYTES55-55] + _ = x[PUSHBYTES56-56] + _ = x[PUSHBYTES57-57] + _ = x[PUSHBYTES58-58] + _ = x[PUSHBYTES59-59] + _ = x[PUSHBYTES60-60] + _ = x[PUSHBYTES61-61] + _ = x[PUSHBYTES62-62] + _ = x[PUSHBYTES63-63] + _ = x[PUSHBYTES64-64] + _ = x[PUSHBYTES65-65] + _ = x[PUSHBYTES66-66] + _ = x[PUSHBYTES67-67] + _ = x[PUSHBYTES68-68] + _ = x[PUSHBYTES69-69] + _ = x[PUSHBYTES70-70] + _ = x[PUSHBYTES71-71] + _ = x[PUSHBYTES72-72] + _ = x[PUSHBYTES73-73] + _ = x[PUSHBYTES74-74] + _ = x[PUSHBYTES75-75] + _ = x[PUSHDATA1-76] + _ = x[PUSHDATA2-77] + _ = x[PUSHDATA4-78] + _ = x[PUSHM1-79] + _ = x[PUSH1-81] + _ = x[PUSHT-81] + _ = x[PUSH2-82] + _ = x[PUSH3-83] + _ = x[PUSH4-84] + _ = x[PUSH5-85] + _ = x[PUSH6-86] + _ = x[PUSH7-87] + _ = x[PUSH8-88] + _ = x[PUSH9-89] + _ = x[PUSH10-90] + _ = x[PUSH11-91] + _ = x[PUSH12-92] + _ = x[PUSH13-93] + _ = x[PUSH14-94] + _ = x[PUSH15-95] + _ = x[PUSH16-96] + _ = x[NOP-97] + _ = x[JMP-98] + _ = x[JMPIF-99] + _ = x[JMPIFNOT-100] + _ = x[CALL-101] + _ = x[RET-102] + _ = x[APPCALL-103] + _ = x[SYSCALL-104] + _ = x[TAILCALL-105] + _ = x[DUPFROMALTSTACK-106] + _ = x[TOALTSTACK-107] + _ = x[FROMALTSTACK-108] + _ = x[XDROP-109] + _ = x[XSWAP-114] + _ = x[XTUCK-115] + _ = x[DEPTH-116] + _ = x[DROP-117] + _ = x[DUP-118] + _ = x[NIP-119] + _ = x[OVER-120] + _ = x[PICK-121] + _ = x[ROLL-122] + _ = x[ROT-123] + _ = x[SWAP-124] + _ = x[TUCK-125] + _ = x[CAT-126] + _ = x[SUBSTR-127] + _ = x[LEFT-128] + _ = x[RIGHT-129] + _ = x[SIZE-130] + _ = x[INVERT-131] + _ = x[AND-132] + _ = x[OR-133] + _ = x[XOR-134] + _ = x[EQUAL-135] + _ = x[INC-139] + _ = x[DEC-140] + _ = x[SIGN-141] + _ = x[NEGATE-143] + _ = x[ABS-144] + _ = x[NOT-145] + _ = x[NZ-146] + _ = x[ADD-147] + _ = x[SUB-148] + _ = x[MUL-149] + _ = x[DIV-150] + _ = x[MOD-151] + _ = x[SHL-152] + _ = x[SHR-153] + _ = x[BOOLAND-154] + _ = x[BOOLOR-155] + _ = x[NUMEQUAL-156] + _ = x[NUMNOTEQUAL-158] + _ = x[LT-159] + _ = x[GT-160] + _ = x[LTE-161] + _ = x[GTE-162] + _ = x[MIN-163] + _ = x[MAX-164] + _ = x[WITHIN-165] + _ = x[SHA1-167] + _ = x[SHA256-168] + _ = x[HASH160-169] + _ = x[HASH256-170] + _ = x[CHECKSIG-172] + _ = x[VERIFY-173] + _ = x[CHECKMULTISIG-174] + _ = x[ARRAYSIZE-192] + _ = x[PACK-193] + _ = x[UNPACK-194] + _ = x[PICKITEM-195] + _ = x[SETITEM-196] + _ = x[NEWARRAY-197] + _ = x[NEWSTRUCT-198] + _ = x[NEWMAP-199] + _ = x[APPEND-200] + _ = x[REVERSE-201] + _ = x[REMOVE-202] + _ = x[HASKEY-203] + _ = x[KEYS-204] + _ = x[VALUES-205] + _ = x[THROW-240] + _ = x[THROWIFNOT-241] } +const ( + _Instruction_name_0 = "PUSH0PUSHBYTES1PUSHBYTES2PUSHBYTES3PUSHBYTES4PUSHBYTES5PUSHBYTES6PUSHBYTES7PUSHBYTES8PUSHBYTES9PUSHBYTES10PUSHBYTES11PUSHBYTES12PUSHBYTES13PUSHBYTES14PUSHBYTES15PUSHBYTES16PUSHBYTES17PUSHBYTES18PUSHBYTES19PUSHBYTES20PUSHBYTES21PUSHBYTES22PUSHBYTES23PUSHBYTES24PUSHBYTES25PUSHBYTES26PUSHBYTES27PUSHBYTES28PUSHBYTES29PUSHBYTES30PUSHBYTES31PUSHBYTES32PUSHBYTES33PUSHBYTES34PUSHBYTES35PUSHBYTES36PUSHBYTES37PUSHBYTES38PUSHBYTES39PUSHBYTES40PUSHBYTES41PUSHBYTES42PUSHBYTES43PUSHBYTES44PUSHBYTES45PUSHBYTES46PUSHBYTES47PUSHBYTES48PUSHBYTES49PUSHBYTES50PUSHBYTES51PUSHBYTES52PUSHBYTES53PUSHBYTES54PUSHBYTES55PUSHBYTES56PUSHBYTES57PUSHBYTES58PUSHBYTES59PUSHBYTES60PUSHBYTES61PUSHBYTES62PUSHBYTES63PUSHBYTES64PUSHBYTES65PUSHBYTES66PUSHBYTES67PUSHBYTES68PUSHBYTES69PUSHBYTES70PUSHBYTES71PUSHBYTES72PUSHBYTES73PUSHBYTES74PUSHBYTES75PUSHDATA1PUSHDATA2PUSHDATA4PUSHM1" + _Instruction_name_1 = "PUSH1PUSH2PUSH3PUSH4PUSH5PUSH6PUSH7PUSH8PUSH9PUSH10PUSH11PUSH12PUSH13PUSH14PUSH15PUSH16NOPJMPJMPIFJMPIFNOTCALLRETAPPCALLSYSCALLTAILCALLDUPFROMALTSTACKTOALTSTACKFROMALTSTACKXDROP" + _Instruction_name_2 = "XSWAPXTUCKDEPTHDROPDUPNIPOVERPICKROLLROTSWAPTUCKCATSUBSTRLEFTRIGHTSIZEINVERTANDORXOREQUAL" + _Instruction_name_3 = "INCDECSIGN" + _Instruction_name_4 = "NEGATEABSNOTNZADDSUBMULDIVMODSHLSHRBOOLANDBOOLORNUMEQUAL" + _Instruction_name_5 = "NUMNOTEQUALLTGTLTEGTEMINMAXWITHIN" + _Instruction_name_6 = "SHA1SHA256HASH160HASH256" + _Instruction_name_7 = "CHECKSIGVERIFYCHECKMULTISIG" + _Instruction_name_8 = "ARRAYSIZEPACKUNPACKPICKITEMSETITEMNEWARRAYNEWSTRUCTNEWMAPAPPENDREVERSEREMOVEHASKEYKEYSVALUES" + _Instruction_name_9 = "THROWTHROWIFNOT" +) + +var ( + _Instruction_index_0 = [...]uint16{0, 5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 106, 117, 128, 139, 150, 161, 172, 183, 194, 205, 216, 227, 238, 249, 260, 271, 282, 293, 304, 315, 326, 337, 348, 359, 370, 381, 392, 403, 414, 425, 436, 447, 458, 469, 480, 491, 502, 513, 524, 535, 546, 557, 568, 579, 590, 601, 612, 623, 634, 645, 656, 667, 678, 689, 700, 711, 722, 733, 744, 755, 766, 777, 788, 799, 810, 821, 830, 839, 848, 854} + _Instruction_index_1 = [...]uint8{0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 51, 57, 63, 69, 75, 81, 87, 90, 93, 98, 106, 110, 113, 120, 127, 135, 150, 160, 172, 177} + _Instruction_index_2 = [...]uint8{0, 5, 10, 15, 19, 22, 25, 29, 33, 37, 40, 44, 48, 51, 57, 61, 66, 70, 76, 79, 81, 84, 89} + _Instruction_index_3 = [...]uint8{0, 3, 6, 10} + _Instruction_index_4 = [...]uint8{0, 6, 9, 12, 14, 17, 20, 23, 26, 29, 32, 35, 42, 48, 56} + _Instruction_index_5 = [...]uint8{0, 11, 13, 15, 18, 21, 24, 27, 33} + _Instruction_index_6 = [...]uint8{0, 4, 10, 17, 24} + _Instruction_index_7 = [...]uint8{0, 8, 14, 27} + _Instruction_index_8 = [...]uint8{0, 9, 13, 19, 27, 34, 42, 51, 57, 63, 70, 76, 82, 86, 92} + _Instruction_index_9 = [...]uint8{0, 5, 15} +) + func (i Instruction) String() string { - if str, ok := _Instruction_map[i]; ok { - return str + switch { + case 0 <= i && i <= 79: + return _Instruction_name_0[_Instruction_index_0[i]:_Instruction_index_0[i+1]] + case 81 <= i && i <= 109: + i -= 81 + return _Instruction_name_1[_Instruction_index_1[i]:_Instruction_index_1[i+1]] + case 114 <= i && i <= 135: + i -= 114 + return _Instruction_name_2[_Instruction_index_2[i]:_Instruction_index_2[i+1]] + case 139 <= i && i <= 141: + i -= 139 + return _Instruction_name_3[_Instruction_index_3[i]:_Instruction_index_3[i+1]] + case 143 <= i && i <= 156: + i -= 143 + return _Instruction_name_4[_Instruction_index_4[i]:_Instruction_index_4[i+1]] + case 158 <= i && i <= 165: + i -= 158 + return _Instruction_name_5[_Instruction_index_5[i]:_Instruction_index_5[i+1]] + case 167 <= i && i <= 170: + i -= 167 + return _Instruction_name_6[_Instruction_index_6[i]:_Instruction_index_6[i+1]] + case 172 <= i && i <= 174: + i -= 172 + return _Instruction_name_7[_Instruction_index_7[i]:_Instruction_index_7[i+1]] + case 192 <= i && i <= 205: + i -= 192 + return _Instruction_name_8[_Instruction_index_8[i]:_Instruction_index_8[i+1]] + case 240 <= i && i <= 241: + i -= 240 + return _Instruction_name_9[_Instruction_index_9[i]:_Instruction_index_9[i+1]] + default: + return "Instruction(" + strconv.FormatInt(int64(i), 10) + ")" } - return "Instruction(" + strconv.FormatInt(int64(i), 10) + ")" } diff --git a/pkg/vm/instructions.go b/pkg/vm/instructions.go index 032c0a5c9..6c3d30e17 100644 --- a/pkg/vm/instructions.go +++ b/pkg/vm/instructions.go @@ -11,6 +11,79 @@ const ( PUSH0 Instruction = 0x00 PUSHF Instruction = PUSH0 PUSHBYTES1 Instruction = 0x01 + PUSHBYTES2 Instruction = 0x02 + PUSHBYTES3 Instruction = 0x03 + PUSHBYTES4 Instruction = 0x04 + PUSHBYTES5 Instruction = 0x05 + PUSHBYTES6 Instruction = 0x06 + PUSHBYTES7 Instruction = 0x07 + PUSHBYTES8 Instruction = 0x08 + PUSHBYTES9 Instruction = 0x09 + PUSHBYTES10 Instruction = 0x0A + PUSHBYTES11 Instruction = 0x0B + PUSHBYTES12 Instruction = 0x0C + PUSHBYTES13 Instruction = 0x0D + PUSHBYTES14 Instruction = 0x0E + PUSHBYTES15 Instruction = 0x0F + PUSHBYTES16 Instruction = 0x10 + PUSHBYTES17 Instruction = 0x11 + PUSHBYTES18 Instruction = 0x12 + PUSHBYTES19 Instruction = 0x13 + PUSHBYTES20 Instruction = 0x14 + PUSHBYTES21 Instruction = 0x15 + PUSHBYTES22 Instruction = 0x16 + PUSHBYTES23 Instruction = 0x17 + PUSHBYTES24 Instruction = 0x18 + PUSHBYTES25 Instruction = 0x19 + PUSHBYTES26 Instruction = 0x1A + PUSHBYTES27 Instruction = 0x1B + PUSHBYTES28 Instruction = 0x1C + PUSHBYTES29 Instruction = 0x1D + PUSHBYTES30 Instruction = 0x1E + PUSHBYTES31 Instruction = 0x1F + PUSHBYTES32 Instruction = 0x20 + PUSHBYTES33 Instruction = 0x21 + PUSHBYTES34 Instruction = 0x22 + PUSHBYTES35 Instruction = 0x23 + PUSHBYTES36 Instruction = 0x24 + PUSHBYTES37 Instruction = 0x25 + PUSHBYTES38 Instruction = 0x26 + PUSHBYTES39 Instruction = 0x27 + PUSHBYTES40 Instruction = 0x28 + PUSHBYTES41 Instruction = 0x29 + PUSHBYTES42 Instruction = 0x2A + PUSHBYTES43 Instruction = 0x2B + PUSHBYTES44 Instruction = 0x2C + PUSHBYTES45 Instruction = 0x2D + PUSHBYTES46 Instruction = 0x2E + PUSHBYTES47 Instruction = 0x2F + PUSHBYTES48 Instruction = 0x30 + PUSHBYTES49 Instruction = 0x31 + PUSHBYTES50 Instruction = 0x32 + PUSHBYTES51 Instruction = 0x33 + PUSHBYTES52 Instruction = 0x34 + PUSHBYTES53 Instruction = 0x35 + PUSHBYTES54 Instruction = 0x36 + PUSHBYTES55 Instruction = 0x37 + PUSHBYTES56 Instruction = 0x38 + PUSHBYTES57 Instruction = 0x39 + PUSHBYTES58 Instruction = 0x3A + PUSHBYTES59 Instruction = 0x3B + PUSHBYTES60 Instruction = 0x3C + PUSHBYTES61 Instruction = 0x3D + PUSHBYTES62 Instruction = 0x3E + PUSHBYTES63 Instruction = 0x3F + PUSHBYTES64 Instruction = 0x40 + PUSHBYTES65 Instruction = 0x41 + PUSHBYTES66 Instruction = 0x42 + PUSHBYTES67 Instruction = 0x43 + PUSHBYTES68 Instruction = 0x44 + PUSHBYTES69 Instruction = 0x45 + PUSHBYTES70 Instruction = 0x46 + PUSHBYTES71 Instruction = 0x47 + PUSHBYTES72 Instruction = 0x48 + PUSHBYTES73 Instruction = 0x49 + PUSHBYTES74 Instruction = 0x4A PUSHBYTES75 Instruction = 0x4B PUSHDATA1 Instruction = 0x4C PUSHDATA2 Instruction = 0x4D @@ -110,9 +183,10 @@ const ( HASH160 Instruction = 0xA9 HASH256 Instruction = 0xAA CHECKSIG Instruction = 0xAC + VERIFY Instruction = 0xAD CHECKMULTISIG Instruction = 0xAE - // Array + // Advanced data structures (arrays, structures, maps) ARRAYSIZE Instruction = 0xC0 PACK Instruction = 0xC1 UNPACK Instruction = 0xC2 @@ -120,9 +194,20 @@ const ( SETITEM Instruction = 0xC4 NEWARRAY Instruction = 0xC5 NEWSTRUCT Instruction = 0xC6 + NEWMAP Instruction = 0xC7 APPEND Instruction = 0xC8 REVERSE Instruction = 0xC9 REMOVE Instruction = 0xCA + HASKEY Instruction = 0xCB + KEYS Instruction = 0xCC + VALUES Instruction = 0xCD + + // Stack isolation (intentionally left out, see #362) + // CALL_I Instruction = 0xE0 + // CALL_E Instruction = 0xE1 + // CALL_ED Instruction = 0xE2 + // CALL_ET Instruction = 0xE3 + // CALL_EDT Instruction = 0xE4 // Exceptions THROW Instruction = 0xF0 diff --git a/pkg/vm/vm.go b/pkg/vm/vm.go index fae084ce3..216f6ca6c 100644 --- a/pkg/vm/vm.go +++ b/pkg/vm/vm.go @@ -771,7 +771,7 @@ func (v *VM) execute(ctx *Context, op Instruction) { v.state = haltState } - case CHECKSIG, CHECKMULTISIG: + case CHECKSIG, VERIFY, CHECKMULTISIG, NEWMAP, HASKEY, KEYS, VALUES: panic("unimplemented") // Cryptographic operations.