github.hscsec.cn/scroll-tech/go-ethereum@v1.9.7/core/vm/jump_table.go (about)

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