github.com/arieschain/arieschain@v0.0.0-20191023063405-37c074544356/core/vm/jump_table.go (about) 1 package vm 2 3 import ( 4 "errors" 5 "math/big" 6 7 "github.com/quickchainproject/quickchain/params" 8 ) 9 10 type ( 11 executionFunc func(pc *uint64, env *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) 12 gasFunc func(params.GasTable, *EVM, *Contract, *Stack, *Memory, uint64) (uint64, error) // last parameter is the requested memory size as a uint64 13 stackValidationFunc func(*Stack) error 14 memorySizeFunc func(*Stack) *big.Int 15 ) 16 17 var errGasUintOverflow = errors.New("gas uint64 overflow") 18 19 type operation struct { 20 // op is the operation function 21 execute executionFunc 22 // gasCost is the gas function and returns the gas required for execution 23 gasCost gasFunc 24 // validateStack validates the stack (size) for the operation 25 validateStack stackValidationFunc 26 // memorySize returns the memory size required for the operation 27 memorySize memorySizeFunc 28 29 halts bool // indicates whether the operation should halt further execution 30 jumps bool // indicates whether the program counter should not increment 31 writes bool // determines whether this a state modifying operation 32 valid bool // indication whether the retrieved operation is valid and known 33 reverts bool // determines whether the operation reverts state (implicitly halts) 34 returns bool // determines whether the operations sets the return data content 35 } 36 37 var ( 38 frontierInstructionSet = NewFrontierInstructionSet() 39 homesteadInstructionSet = NewHomesteadInstructionSet() 40 byzantiumInstructionSet = NewByzantiumInstructionSet() 41 constantinopleInstructionSet = NewConstantinopleInstructionSet() 42 ) 43 44 // NewConstantinopleInstructionSet returns the frontier, homestead 45 // byzantium and contantinople instructions. 46 func NewConstantinopleInstructionSet() [256]operation { 47 // instructions that can be executed during the byzantium phase. 48 instructionSet := NewByzantiumInstructionSet() 49 instructionSet[SHL] = operation{ 50 execute: opSHL, 51 gasCost: constGasFunc(GasFastestStep), 52 validateStack: makeStackFunc(2, 1), 53 valid: true, 54 } 55 instructionSet[SHR] = operation{ 56 execute: opSHR, 57 gasCost: constGasFunc(GasFastestStep), 58 validateStack: makeStackFunc(2, 1), 59 valid: true, 60 } 61 instructionSet[SAR] = operation{ 62 execute: opSAR, 63 gasCost: constGasFunc(GasFastestStep), 64 validateStack: makeStackFunc(2, 1), 65 valid: true, 66 } 67 return instructionSet 68 } 69 70 // NewByzantiumInstructionSet returns the frontier, homestead and 71 // byzantium instructions. 72 func NewByzantiumInstructionSet() [256]operation { 73 // instructions that can be executed during the homestead phase. 74 instructionSet := NewHomesteadInstructionSet() 75 instructionSet[STATICCALL] = operation{ 76 execute: opStaticCall, 77 gasCost: gasStaticCall, 78 validateStack: makeStackFunc(6, 1), 79 memorySize: memoryStaticCall, 80 valid: true, 81 returns: true, 82 } 83 instructionSet[RETURNDATASIZE] = operation{ 84 execute: opReturnDataSize, 85 gasCost: constGasFunc(GasQuickStep), 86 validateStack: makeStackFunc(0, 1), 87 valid: true, 88 } 89 instructionSet[RETURNDATACOPY] = operation{ 90 execute: opReturnDataCopy, 91 gasCost: gasReturnDataCopy, 92 validateStack: makeStackFunc(3, 0), 93 memorySize: memoryReturnDataCopy, 94 valid: true, 95 } 96 instructionSet[REVERT] = operation{ 97 execute: opRevert, 98 gasCost: gasRevert, 99 validateStack: makeStackFunc(2, 0), 100 memorySize: memoryRevert, 101 valid: true, 102 reverts: true, 103 returns: true, 104 } 105 return instructionSet 106 } 107 108 // NewHomesteadInstructionSet returns the frontier and homestead 109 // instructions that can be executed during the homestead phase. 110 func NewHomesteadInstructionSet() [256]operation { 111 instructionSet := NewFrontierInstructionSet() 112 instructionSet[DELEGATECALL] = operation{ 113 execute: opDelegateCall, 114 gasCost: gasDelegateCall, 115 validateStack: makeStackFunc(6, 1), 116 memorySize: memoryDelegateCall, 117 valid: true, 118 returns: true, 119 } 120 return instructionSet 121 } 122 123 // NewFrontierInstructionSet returns the frontier instructions 124 // that can be executed during the frontier phase. 125 func NewFrontierInstructionSet() [256]operation { 126 return [256]operation{ 127 STOP: { 128 execute: opStop, 129 gasCost: constGasFunc(0), 130 validateStack: makeStackFunc(0, 0), 131 halts: true, 132 valid: true, 133 }, 134 ADD: { 135 execute: opAdd, 136 gasCost: constGasFunc(GasFastestStep), 137 validateStack: makeStackFunc(2, 1), 138 valid: true, 139 }, 140 MUL: { 141 execute: opMul, 142 gasCost: constGasFunc(GasFastStep), 143 validateStack: makeStackFunc(2, 1), 144 valid: true, 145 }, 146 SUB: { 147 execute: opSub, 148 gasCost: constGasFunc(GasFastestStep), 149 validateStack: makeStackFunc(2, 1), 150 valid: true, 151 }, 152 DIV: { 153 execute: opDiv, 154 gasCost: constGasFunc(GasFastStep), 155 validateStack: makeStackFunc(2, 1), 156 valid: true, 157 }, 158 SDIV: { 159 execute: opSdiv, 160 gasCost: constGasFunc(GasFastStep), 161 validateStack: makeStackFunc(2, 1), 162 valid: true, 163 }, 164 MOD: { 165 execute: opMod, 166 gasCost: constGasFunc(GasFastStep), 167 validateStack: makeStackFunc(2, 1), 168 valid: true, 169 }, 170 SMOD: { 171 execute: opSmod, 172 gasCost: constGasFunc(GasFastStep), 173 validateStack: makeStackFunc(2, 1), 174 valid: true, 175 }, 176 ADDMOD: { 177 execute: opAddmod, 178 gasCost: constGasFunc(GasMidStep), 179 validateStack: makeStackFunc(3, 1), 180 valid: true, 181 }, 182 MULMOD: { 183 execute: opMulmod, 184 gasCost: constGasFunc(GasMidStep), 185 validateStack: makeStackFunc(3, 1), 186 valid: true, 187 }, 188 EXP: { 189 execute: opExp, 190 gasCost: gasExp, 191 validateStack: makeStackFunc(2, 1), 192 valid: true, 193 }, 194 SIGNEXTEND: { 195 execute: opSignExtend, 196 gasCost: constGasFunc(GasFastStep), 197 validateStack: makeStackFunc(2, 1), 198 valid: true, 199 }, 200 LT: { 201 execute: opLt, 202 gasCost: constGasFunc(GasFastestStep), 203 validateStack: makeStackFunc(2, 1), 204 valid: true, 205 }, 206 GT: { 207 execute: opGt, 208 gasCost: constGasFunc(GasFastestStep), 209 validateStack: makeStackFunc(2, 1), 210 valid: true, 211 }, 212 SLT: { 213 execute: opSlt, 214 gasCost: constGasFunc(GasFastestStep), 215 validateStack: makeStackFunc(2, 1), 216 valid: true, 217 }, 218 SGT: { 219 execute: opSgt, 220 gasCost: constGasFunc(GasFastestStep), 221 validateStack: makeStackFunc(2, 1), 222 valid: true, 223 }, 224 EQ: { 225 execute: opEq, 226 gasCost: constGasFunc(GasFastestStep), 227 validateStack: makeStackFunc(2, 1), 228 valid: true, 229 }, 230 ISZERO: { 231 execute: opIszero, 232 gasCost: constGasFunc(GasFastestStep), 233 validateStack: makeStackFunc(1, 1), 234 valid: true, 235 }, 236 AND: { 237 execute: opAnd, 238 gasCost: constGasFunc(GasFastestStep), 239 validateStack: makeStackFunc(2, 1), 240 valid: true, 241 }, 242 XOR: { 243 execute: opXor, 244 gasCost: constGasFunc(GasFastestStep), 245 validateStack: makeStackFunc(2, 1), 246 valid: true, 247 }, 248 OR: { 249 execute: opOr, 250 gasCost: constGasFunc(GasFastestStep), 251 validateStack: makeStackFunc(2, 1), 252 valid: true, 253 }, 254 NOT: { 255 execute: opNot, 256 gasCost: constGasFunc(GasFastestStep), 257 validateStack: makeStackFunc(1, 1), 258 valid: true, 259 }, 260 BYTE: { 261 execute: opByte, 262 gasCost: constGasFunc(GasFastestStep), 263 validateStack: makeStackFunc(2, 1), 264 valid: true, 265 }, 266 SHA3: { 267 execute: opSha3, 268 gasCost: gasSha3, 269 validateStack: makeStackFunc(2, 1), 270 memorySize: memorySha3, 271 valid: true, 272 }, 273 ADDRESS: { 274 execute: opAddress, 275 gasCost: constGasFunc(GasQuickStep), 276 validateStack: makeStackFunc(0, 1), 277 valid: true, 278 }, 279 BALANCE: { 280 execute: opBalance, 281 gasCost: gasBalance, 282 validateStack: makeStackFunc(1, 1), 283 valid: true, 284 }, 285 ORIGIN: { 286 execute: opOrigin, 287 gasCost: constGasFunc(GasQuickStep), 288 validateStack: makeStackFunc(0, 1), 289 valid: true, 290 }, 291 CALLER: { 292 execute: opCaller, 293 gasCost: constGasFunc(GasQuickStep), 294 validateStack: makeStackFunc(0, 1), 295 valid: true, 296 }, 297 CALLVALUE: { 298 execute: opCallValue, 299 gasCost: constGasFunc(GasQuickStep), 300 validateStack: makeStackFunc(0, 1), 301 valid: true, 302 }, 303 CALLDATALOAD: { 304 execute: opCallDataLoad, 305 gasCost: constGasFunc(GasFastestStep), 306 validateStack: makeStackFunc(1, 1), 307 valid: true, 308 }, 309 CALLDATASIZE: { 310 execute: opCallDataSize, 311 gasCost: constGasFunc(GasQuickStep), 312 validateStack: makeStackFunc(0, 1), 313 valid: true, 314 }, 315 CALLDATACOPY: { 316 execute: opCallDataCopy, 317 gasCost: gasCallDataCopy, 318 validateStack: makeStackFunc(3, 0), 319 memorySize: memoryCallDataCopy, 320 valid: true, 321 }, 322 CODESIZE: { 323 execute: opCodeSize, 324 gasCost: constGasFunc(GasQuickStep), 325 validateStack: makeStackFunc(0, 1), 326 valid: true, 327 }, 328 CODECOPY: { 329 execute: opCodeCopy, 330 gasCost: gasCodeCopy, 331 validateStack: makeStackFunc(3, 0), 332 memorySize: memoryCodeCopy, 333 valid: true, 334 }, 335 GASPRICE: { 336 execute: opGasprice, 337 gasCost: constGasFunc(GasQuickStep), 338 validateStack: makeStackFunc(0, 1), 339 valid: true, 340 }, 341 EXTCODESIZE: { 342 execute: opExtCodeSize, 343 gasCost: gasExtCodeSize, 344 validateStack: makeStackFunc(1, 1), 345 valid: true, 346 }, 347 EXTCODECOPY: { 348 execute: opExtCodeCopy, 349 gasCost: gasExtCodeCopy, 350 validateStack: makeStackFunc(4, 0), 351 memorySize: memoryExtCodeCopy, 352 valid: true, 353 }, 354 BLOCKHASH: { 355 execute: opBlockhash, 356 gasCost: constGasFunc(GasExtStep), 357 validateStack: makeStackFunc(1, 1), 358 valid: true, 359 }, 360 COINBASE: { 361 execute: opCoinbase, 362 gasCost: constGasFunc(GasQuickStep), 363 validateStack: makeStackFunc(0, 1), 364 valid: true, 365 }, 366 TIMESTAMP: { 367 execute: opTimestamp, 368 gasCost: constGasFunc(GasQuickStep), 369 validateStack: makeStackFunc(0, 1), 370 valid: true, 371 }, 372 NUMBER: { 373 execute: opNumber, 374 gasCost: constGasFunc(GasQuickStep), 375 validateStack: makeStackFunc(0, 1), 376 valid: true, 377 }, 378 DIFFICULTY: { 379 execute: opDifficulty, 380 gasCost: constGasFunc(GasQuickStep), 381 validateStack: makeStackFunc(0, 1), 382 valid: true, 383 }, 384 GASLIMIT: { 385 execute: opGasLimit, 386 gasCost: constGasFunc(GasQuickStep), 387 validateStack: makeStackFunc(0, 1), 388 valid: true, 389 }, 390 POP: { 391 execute: opPop, 392 gasCost: constGasFunc(GasQuickStep), 393 validateStack: makeStackFunc(1, 0), 394 valid: true, 395 }, 396 MLOAD: { 397 execute: opMload, 398 gasCost: gasMLoad, 399 validateStack: makeStackFunc(1, 1), 400 memorySize: memoryMLoad, 401 valid: true, 402 }, 403 MSTORE: { 404 execute: opMstore, 405 gasCost: gasMStore, 406 validateStack: makeStackFunc(2, 0), 407 memorySize: memoryMStore, 408 valid: true, 409 }, 410 MSTORE8: { 411 execute: opMstore8, 412 gasCost: gasMStore8, 413 memorySize: memoryMStore8, 414 validateStack: makeStackFunc(2, 0), 415 416 valid: true, 417 }, 418 SLOAD: { 419 execute: opSload, 420 gasCost: gasSLoad, 421 validateStack: makeStackFunc(1, 1), 422 valid: true, 423 }, 424 SSTORE: { 425 execute: opSstore, 426 gasCost: gasSStore, 427 validateStack: makeStackFunc(2, 0), 428 valid: true, 429 writes: true, 430 }, 431 JUMP: { 432 execute: opJump, 433 gasCost: constGasFunc(GasMidStep), 434 validateStack: makeStackFunc(1, 0), 435 jumps: true, 436 valid: true, 437 }, 438 JUMPI: { 439 execute: opJumpi, 440 gasCost: constGasFunc(GasSlowStep), 441 validateStack: makeStackFunc(2, 0), 442 jumps: true, 443 valid: true, 444 }, 445 PC: { 446 execute: opPc, 447 gasCost: constGasFunc(GasQuickStep), 448 validateStack: makeStackFunc(0, 1), 449 valid: true, 450 }, 451 MSIZE: { 452 execute: opMsize, 453 gasCost: constGasFunc(GasQuickStep), 454 validateStack: makeStackFunc(0, 1), 455 valid: true, 456 }, 457 GAS: { 458 execute: opGas, 459 gasCost: constGasFunc(GasQuickStep), 460 validateStack: makeStackFunc(0, 1), 461 valid: true, 462 }, 463 JUMPDEST: { 464 execute: opJumpdest, 465 gasCost: constGasFunc(params.JumpdestGas), 466 validateStack: makeStackFunc(0, 0), 467 valid: true, 468 }, 469 PUSH1: { 470 execute: makePush(1, 1), 471 gasCost: gasPush, 472 validateStack: makeStackFunc(0, 1), 473 valid: true, 474 }, 475 PUSH2: { 476 execute: makePush(2, 2), 477 gasCost: gasPush, 478 validateStack: makeStackFunc(0, 1), 479 valid: true, 480 }, 481 PUSH3: { 482 execute: makePush(3, 3), 483 gasCost: gasPush, 484 validateStack: makeStackFunc(0, 1), 485 valid: true, 486 }, 487 PUSH4: { 488 execute: makePush(4, 4), 489 gasCost: gasPush, 490 validateStack: makeStackFunc(0, 1), 491 valid: true, 492 }, 493 PUSH5: { 494 execute: makePush(5, 5), 495 gasCost: gasPush, 496 validateStack: makeStackFunc(0, 1), 497 valid: true, 498 }, 499 PUSH6: { 500 execute: makePush(6, 6), 501 gasCost: gasPush, 502 validateStack: makeStackFunc(0, 1), 503 valid: true, 504 }, 505 PUSH7: { 506 execute: makePush(7, 7), 507 gasCost: gasPush, 508 validateStack: makeStackFunc(0, 1), 509 valid: true, 510 }, 511 PUSH8: { 512 execute: makePush(8, 8), 513 gasCost: gasPush, 514 validateStack: makeStackFunc(0, 1), 515 valid: true, 516 }, 517 PUSH9: { 518 execute: makePush(9, 9), 519 gasCost: gasPush, 520 validateStack: makeStackFunc(0, 1), 521 valid: true, 522 }, 523 PUSH10: { 524 execute: makePush(10, 10), 525 gasCost: gasPush, 526 validateStack: makeStackFunc(0, 1), 527 valid: true, 528 }, 529 PUSH11: { 530 execute: makePush(11, 11), 531 gasCost: gasPush, 532 validateStack: makeStackFunc(0, 1), 533 valid: true, 534 }, 535 PUSH12: { 536 execute: makePush(12, 12), 537 gasCost: gasPush, 538 validateStack: makeStackFunc(0, 1), 539 valid: true, 540 }, 541 PUSH13: { 542 execute: makePush(13, 13), 543 gasCost: gasPush, 544 validateStack: makeStackFunc(0, 1), 545 valid: true, 546 }, 547 PUSH14: { 548 execute: makePush(14, 14), 549 gasCost: gasPush, 550 validateStack: makeStackFunc(0, 1), 551 valid: true, 552 }, 553 PUSH15: { 554 execute: makePush(15, 15), 555 gasCost: gasPush, 556 validateStack: makeStackFunc(0, 1), 557 valid: true, 558 }, 559 PUSH16: { 560 execute: makePush(16, 16), 561 gasCost: gasPush, 562 validateStack: makeStackFunc(0, 1), 563 valid: true, 564 }, 565 PUSH17: { 566 execute: makePush(17, 17), 567 gasCost: gasPush, 568 validateStack: makeStackFunc(0, 1), 569 valid: true, 570 }, 571 PUSH18: { 572 execute: makePush(18, 18), 573 gasCost: gasPush, 574 validateStack: makeStackFunc(0, 1), 575 valid: true, 576 }, 577 PUSH19: { 578 execute: makePush(19, 19), 579 gasCost: gasPush, 580 validateStack: makeStackFunc(0, 1), 581 valid: true, 582 }, 583 PUSH20: { 584 execute: makePush(20, 20), 585 gasCost: gasPush, 586 validateStack: makeStackFunc(0, 1), 587 valid: true, 588 }, 589 PUSH21: { 590 execute: makePush(21, 21), 591 gasCost: gasPush, 592 validateStack: makeStackFunc(0, 1), 593 valid: true, 594 }, 595 PUSH22: { 596 execute: makePush(22, 22), 597 gasCost: gasPush, 598 validateStack: makeStackFunc(0, 1), 599 valid: true, 600 }, 601 PUSH23: { 602 execute: makePush(23, 23), 603 gasCost: gasPush, 604 validateStack: makeStackFunc(0, 1), 605 valid: true, 606 }, 607 PUSH24: { 608 execute: makePush(24, 24), 609 gasCost: gasPush, 610 validateStack: makeStackFunc(0, 1), 611 valid: true, 612 }, 613 PUSH25: { 614 execute: makePush(25, 25), 615 gasCost: gasPush, 616 validateStack: makeStackFunc(0, 1), 617 valid: true, 618 }, 619 PUSH26: { 620 execute: makePush(26, 26), 621 gasCost: gasPush, 622 validateStack: makeStackFunc(0, 1), 623 valid: true, 624 }, 625 PUSH27: { 626 execute: makePush(27, 27), 627 gasCost: gasPush, 628 validateStack: makeStackFunc(0, 1), 629 valid: true, 630 }, 631 PUSH28: { 632 execute: makePush(28, 28), 633 gasCost: gasPush, 634 validateStack: makeStackFunc(0, 1), 635 valid: true, 636 }, 637 PUSH29: { 638 execute: makePush(29, 29), 639 gasCost: gasPush, 640 validateStack: makeStackFunc(0, 1), 641 valid: true, 642 }, 643 PUSH30: { 644 execute: makePush(30, 30), 645 gasCost: gasPush, 646 validateStack: makeStackFunc(0, 1), 647 valid: true, 648 }, 649 PUSH31: { 650 execute: makePush(31, 31), 651 gasCost: gasPush, 652 validateStack: makeStackFunc(0, 1), 653 valid: true, 654 }, 655 PUSH32: { 656 execute: makePush(32, 32), 657 gasCost: gasPush, 658 validateStack: makeStackFunc(0, 1), 659 valid: true, 660 }, 661 DUP1: { 662 execute: makeDup(1), 663 gasCost: gasDup, 664 validateStack: makeDupStackFunc(1), 665 valid: true, 666 }, 667 DUP2: { 668 execute: makeDup(2), 669 gasCost: gasDup, 670 validateStack: makeDupStackFunc(2), 671 valid: true, 672 }, 673 DUP3: { 674 execute: makeDup(3), 675 gasCost: gasDup, 676 validateStack: makeDupStackFunc(3), 677 valid: true, 678 }, 679 DUP4: { 680 execute: makeDup(4), 681 gasCost: gasDup, 682 validateStack: makeDupStackFunc(4), 683 valid: true, 684 }, 685 DUP5: { 686 execute: makeDup(5), 687 gasCost: gasDup, 688 validateStack: makeDupStackFunc(5), 689 valid: true, 690 }, 691 DUP6: { 692 execute: makeDup(6), 693 gasCost: gasDup, 694 validateStack: makeDupStackFunc(6), 695 valid: true, 696 }, 697 DUP7: { 698 execute: makeDup(7), 699 gasCost: gasDup, 700 validateStack: makeDupStackFunc(7), 701 valid: true, 702 }, 703 DUP8: { 704 execute: makeDup(8), 705 gasCost: gasDup, 706 validateStack: makeDupStackFunc(8), 707 valid: true, 708 }, 709 DUP9: { 710 execute: makeDup(9), 711 gasCost: gasDup, 712 validateStack: makeDupStackFunc(9), 713 valid: true, 714 }, 715 DUP10: { 716 execute: makeDup(10), 717 gasCost: gasDup, 718 validateStack: makeDupStackFunc(10), 719 valid: true, 720 }, 721 DUP11: { 722 execute: makeDup(11), 723 gasCost: gasDup, 724 validateStack: makeDupStackFunc(11), 725 valid: true, 726 }, 727 DUP12: { 728 execute: makeDup(12), 729 gasCost: gasDup, 730 validateStack: makeDupStackFunc(12), 731 valid: true, 732 }, 733 DUP13: { 734 execute: makeDup(13), 735 gasCost: gasDup, 736 validateStack: makeDupStackFunc(13), 737 valid: true, 738 }, 739 DUP14: { 740 execute: makeDup(14), 741 gasCost: gasDup, 742 validateStack: makeDupStackFunc(14), 743 valid: true, 744 }, 745 DUP15: { 746 execute: makeDup(15), 747 gasCost: gasDup, 748 validateStack: makeDupStackFunc(15), 749 valid: true, 750 }, 751 DUP16: { 752 execute: makeDup(16), 753 gasCost: gasDup, 754 validateStack: makeDupStackFunc(16), 755 valid: true, 756 }, 757 SWAP1: { 758 execute: makeSwap(1), 759 gasCost: gasSwap, 760 validateStack: makeSwapStackFunc(2), 761 valid: true, 762 }, 763 SWAP2: { 764 execute: makeSwap(2), 765 gasCost: gasSwap, 766 validateStack: makeSwapStackFunc(3), 767 valid: true, 768 }, 769 SWAP3: { 770 execute: makeSwap(3), 771 gasCost: gasSwap, 772 validateStack: makeSwapStackFunc(4), 773 valid: true, 774 }, 775 SWAP4: { 776 execute: makeSwap(4), 777 gasCost: gasSwap, 778 validateStack: makeSwapStackFunc(5), 779 valid: true, 780 }, 781 SWAP5: { 782 execute: makeSwap(5), 783 gasCost: gasSwap, 784 validateStack: makeSwapStackFunc(6), 785 valid: true, 786 }, 787 SWAP6: { 788 execute: makeSwap(6), 789 gasCost: gasSwap, 790 validateStack: makeSwapStackFunc(7), 791 valid: true, 792 }, 793 SWAP7: { 794 execute: makeSwap(7), 795 gasCost: gasSwap, 796 validateStack: makeSwapStackFunc(8), 797 valid: true, 798 }, 799 SWAP8: { 800 execute: makeSwap(8), 801 gasCost: gasSwap, 802 validateStack: makeSwapStackFunc(9), 803 valid: true, 804 }, 805 SWAP9: { 806 execute: makeSwap(9), 807 gasCost: gasSwap, 808 validateStack: makeSwapStackFunc(10), 809 valid: true, 810 }, 811 SWAP10: { 812 execute: makeSwap(10), 813 gasCost: gasSwap, 814 validateStack: makeSwapStackFunc(11), 815 valid: true, 816 }, 817 SWAP11: { 818 execute: makeSwap(11), 819 gasCost: gasSwap, 820 validateStack: makeSwapStackFunc(12), 821 valid: true, 822 }, 823 SWAP12: { 824 execute: makeSwap(12), 825 gasCost: gasSwap, 826 validateStack: makeSwapStackFunc(13), 827 valid: true, 828 }, 829 SWAP13: { 830 execute: makeSwap(13), 831 gasCost: gasSwap, 832 validateStack: makeSwapStackFunc(14), 833 valid: true, 834 }, 835 SWAP14: { 836 execute: makeSwap(14), 837 gasCost: gasSwap, 838 validateStack: makeSwapStackFunc(15), 839 valid: true, 840 }, 841 SWAP15: { 842 execute: makeSwap(15), 843 gasCost: gasSwap, 844 validateStack: makeSwapStackFunc(16), 845 valid: true, 846 }, 847 SWAP16: { 848 execute: makeSwap(16), 849 gasCost: gasSwap, 850 validateStack: makeSwapStackFunc(17), 851 valid: true, 852 }, 853 LOG0: { 854 execute: makeLog(0), 855 gasCost: makeGasLog(0), 856 validateStack: makeStackFunc(2, 0), 857 memorySize: memoryLog, 858 valid: true, 859 writes: true, 860 }, 861 LOG1: { 862 execute: makeLog(1), 863 gasCost: makeGasLog(1), 864 validateStack: makeStackFunc(3, 0), 865 memorySize: memoryLog, 866 valid: true, 867 writes: true, 868 }, 869 LOG2: { 870 execute: makeLog(2), 871 gasCost: makeGasLog(2), 872 validateStack: makeStackFunc(4, 0), 873 memorySize: memoryLog, 874 valid: true, 875 writes: true, 876 }, 877 LOG3: { 878 execute: makeLog(3), 879 gasCost: makeGasLog(3), 880 validateStack: makeStackFunc(5, 0), 881 memorySize: memoryLog, 882 valid: true, 883 writes: true, 884 }, 885 LOG4: { 886 execute: makeLog(4), 887 gasCost: makeGasLog(4), 888 validateStack: makeStackFunc(6, 0), 889 memorySize: memoryLog, 890 valid: true, 891 writes: true, 892 }, 893 CREATE: { 894 execute: opCreate, 895 gasCost: gasCreate, 896 validateStack: makeStackFunc(3, 1), 897 memorySize: memoryCreate, 898 valid: true, 899 writes: true, 900 returns: true, 901 }, 902 CALL: { 903 execute: opCall, 904 gasCost: gasCall, 905 validateStack: makeStackFunc(7, 1), 906 memorySize: memoryCall, 907 valid: true, 908 returns: true, 909 }, 910 CALLCODE: { 911 execute: opCallCode, 912 gasCost: gasCallCode, 913 validateStack: makeStackFunc(7, 1), 914 memorySize: memoryCall, 915 valid: true, 916 returns: true, 917 }, 918 RETURN: { 919 execute: opReturn, 920 gasCost: gasReturn, 921 validateStack: makeStackFunc(2, 0), 922 memorySize: memoryReturn, 923 halts: true, 924 valid: true, 925 }, 926 SELFDESTRUCT: { 927 execute: opSuicide, 928 gasCost: gasSuicide, 929 validateStack: makeStackFunc(1, 0), 930 halts: true, 931 valid: true, 932 writes: true, 933 }, 934 } 935 }