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