github.com/baptiste-b-pegasys/quorum/v22@v22.4.2/core/vm/jump_table.go (about)

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