github.com/bamzi/go-ethereum@v1.6.7-0.20170704111104-138f26c93af1/core/vm/jump_table.go (about)

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