jump_table.go 27 KB

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