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