gitlab.com/flarenetwork/coreth@v0.1.1/core/vm/jump_table.go (about)

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