github.com/bigzoro/my_simplechain@v0.0.0-20240315012955-8ad0a2a29bb9/core/vm/jump_table.go (about)

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