github.com/klaytn/klaytn@v1.10.2/blockchain/vm/jump_table.go (about)

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