github.com/core-coin/go-core/v2@v2.1.9/core/vm/jump_table.go (about)

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