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