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