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