jump_table.go 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859
  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. "math/big"
  19. "github.com/ethereum/go-ethereum/params"
  20. )
  21. type (
  22. executionFunc func(pc *uint64, env *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error)
  23. gasFunc func(params.GasTable, *EVM, *Contract, *Stack, *Memory, *big.Int) *big.Int
  24. stackValidationFunc func(*Stack) error
  25. memorySizeFunc func(*Stack) *big.Int
  26. )
  27. type operation struct {
  28. // op is the operation function
  29. execute executionFunc
  30. // gasCost is the gas function and returns the gas required for execution
  31. gasCost gasFunc
  32. // validateStack validates the stack (size) for the operation
  33. validateStack stackValidationFunc
  34. // memorySize returns the memory size required for the operation
  35. memorySize memorySizeFunc
  36. // halts indicates whether the operation shoult halt further execution
  37. // and return
  38. halts bool
  39. // jumps indicates whether operation made a jump. This prevents the program
  40. // counter from further incrementing.
  41. jumps bool
  42. // valid is used to check whether the retrieved operation is valid and known
  43. valid bool
  44. }
  45. var defaultJumpTable = NewJumpTable()
  46. func NewJumpTable() [256]operation {
  47. return [256]operation{
  48. ADD: {
  49. execute: opAdd,
  50. gasCost: constGasFunc(GasFastestStep),
  51. validateStack: makeStackFunc(2, 1),
  52. valid: true,
  53. },
  54. SUB: {
  55. execute: opSub,
  56. gasCost: constGasFunc(GasFastestStep),
  57. validateStack: makeStackFunc(2, 1),
  58. valid: true,
  59. },
  60. MUL: {
  61. execute: opMul,
  62. gasCost: constGasFunc(GasFastStep),
  63. validateStack: makeStackFunc(2, 1),
  64. valid: true,
  65. },
  66. DIV: {
  67. execute: opDiv,
  68. gasCost: constGasFunc(GasFastStep),
  69. validateStack: makeStackFunc(2, 1),
  70. valid: true,
  71. },
  72. SDIV: {
  73. execute: opSdiv,
  74. gasCost: constGasFunc(GasFastStep),
  75. validateStack: makeStackFunc(2, 1),
  76. valid: true,
  77. },
  78. MOD: {
  79. execute: opMod,
  80. gasCost: constGasFunc(GasFastStep),
  81. validateStack: makeStackFunc(2, 1),
  82. valid: true,
  83. },
  84. SMOD: {
  85. execute: opSmod,
  86. gasCost: constGasFunc(GasFastStep),
  87. validateStack: makeStackFunc(2, 1),
  88. valid: true,
  89. },
  90. EXP: {
  91. execute: opExp,
  92. gasCost: gasExp,
  93. validateStack: makeStackFunc(2, 1),
  94. valid: true,
  95. },
  96. SIGNEXTEND: {
  97. execute: opSignExtend,
  98. gasCost: constGasFunc(GasFastStep),
  99. validateStack: makeStackFunc(2, 1),
  100. valid: true,
  101. },
  102. NOT: {
  103. execute: opNot,
  104. gasCost: constGasFunc(GasFastestStep),
  105. validateStack: makeStackFunc(1, 1),
  106. valid: true,
  107. },
  108. LT: {
  109. execute: opLt,
  110. gasCost: constGasFunc(GasFastestStep),
  111. validateStack: makeStackFunc(2, 1),
  112. valid: true,
  113. },
  114. GT: {
  115. execute: opGt,
  116. gasCost: constGasFunc(GasFastestStep),
  117. validateStack: makeStackFunc(2, 1),
  118. valid: true,
  119. },
  120. SLT: {
  121. execute: opSlt,
  122. gasCost: constGasFunc(GasFastestStep),
  123. validateStack: makeStackFunc(2, 1),
  124. valid: true,
  125. },
  126. SGT: {
  127. execute: opSgt,
  128. gasCost: constGasFunc(GasFastestStep),
  129. validateStack: makeStackFunc(2, 1),
  130. valid: true,
  131. },
  132. EQ: {
  133. execute: opEq,
  134. gasCost: constGasFunc(GasFastestStep),
  135. validateStack: makeStackFunc(2, 1),
  136. valid: true,
  137. },
  138. ISZERO: {
  139. execute: opIszero,
  140. gasCost: constGasFunc(GasFastestStep),
  141. validateStack: makeStackFunc(1, 1),
  142. valid: true,
  143. },
  144. AND: {
  145. execute: opAnd,
  146. gasCost: constGasFunc(GasFastestStep),
  147. validateStack: makeStackFunc(2, 1),
  148. valid: true,
  149. },
  150. OR: {
  151. execute: opOr,
  152. gasCost: constGasFunc(GasFastestStep),
  153. validateStack: makeStackFunc(2, 1),
  154. valid: true,
  155. },
  156. XOR: {
  157. execute: opXor,
  158. gasCost: constGasFunc(GasFastestStep),
  159. validateStack: makeStackFunc(2, 1),
  160. valid: true,
  161. },
  162. BYTE: {
  163. execute: opByte,
  164. gasCost: constGasFunc(GasFastestStep),
  165. validateStack: makeStackFunc(2, 1),
  166. valid: true,
  167. },
  168. ADDMOD: {
  169. execute: opAddmod,
  170. gasCost: constGasFunc(GasMidStep),
  171. validateStack: makeStackFunc(3, 1),
  172. valid: true,
  173. },
  174. MULMOD: {
  175. execute: opMulmod,
  176. gasCost: constGasFunc(GasMidStep),
  177. validateStack: makeStackFunc(3, 1),
  178. valid: true,
  179. },
  180. SHA3: {
  181. execute: opSha3,
  182. gasCost: gasSha3,
  183. validateStack: makeStackFunc(2, 1),
  184. memorySize: memorySha3,
  185. valid: true,
  186. },
  187. ADDRESS: {
  188. execute: opAddress,
  189. gasCost: constGasFunc(GasQuickStep),
  190. validateStack: makeStackFunc(0, 1),
  191. valid: true,
  192. },
  193. BALANCE: {
  194. execute: opBalance,
  195. gasCost: gasBalance,
  196. validateStack: makeStackFunc(0, 1),
  197. valid: true,
  198. },
  199. ORIGIN: {
  200. execute: opOrigin,
  201. gasCost: constGasFunc(GasQuickStep),
  202. validateStack: makeStackFunc(0, 1),
  203. valid: true,
  204. },
  205. CALLER: {
  206. execute: opCaller,
  207. gasCost: constGasFunc(GasQuickStep),
  208. validateStack: makeStackFunc(0, 1),
  209. valid: true,
  210. },
  211. CALLVALUE: {
  212. execute: opCallValue,
  213. gasCost: constGasFunc(GasQuickStep),
  214. validateStack: makeStackFunc(0, 1),
  215. valid: true,
  216. },
  217. CALLDATALOAD: {
  218. execute: opCalldataLoad,
  219. gasCost: constGasFunc(GasFastestStep),
  220. validateStack: makeStackFunc(1, 1),
  221. valid: true,
  222. },
  223. CALLDATASIZE: {
  224. execute: opCalldataSize,
  225. gasCost: constGasFunc(GasQuickStep),
  226. validateStack: makeStackFunc(0, 1),
  227. valid: true,
  228. },
  229. CALLDATACOPY: {
  230. execute: opCalldataCopy,
  231. gasCost: gasCalldataCopy,
  232. validateStack: makeStackFunc(3, 1),
  233. memorySize: memoryCalldataCopy,
  234. valid: true,
  235. },
  236. CODESIZE: {
  237. execute: opCodeSize,
  238. gasCost: constGasFunc(GasQuickStep),
  239. validateStack: makeStackFunc(0, 1),
  240. valid: true,
  241. },
  242. EXTCODESIZE: {
  243. execute: opExtCodeSize,
  244. gasCost: gasExtCodeSize,
  245. validateStack: makeStackFunc(1, 1),
  246. valid: true,
  247. },
  248. CODECOPY: {
  249. execute: opCodeCopy,
  250. gasCost: gasCodeCopy,
  251. validateStack: makeStackFunc(3, 0),
  252. memorySize: memoryCodeCopy,
  253. valid: true,
  254. },
  255. EXTCODECOPY: {
  256. execute: opExtCodeCopy,
  257. gasCost: gasExtCodeCopy,
  258. validateStack: makeStackFunc(4, 0),
  259. memorySize: memoryExtCodeCopy,
  260. valid: true,
  261. },
  262. GASPRICE: {
  263. execute: opGasprice,
  264. gasCost: constGasFunc(GasQuickStep),
  265. validateStack: makeStackFunc(0, 1),
  266. valid: true,
  267. },
  268. BLOCKHASH: {
  269. execute: opBlockhash,
  270. gasCost: constGasFunc(GasExtStep),
  271. validateStack: makeStackFunc(1, 1),
  272. valid: true,
  273. },
  274. COINBASE: {
  275. execute: opCoinbase,
  276. gasCost: constGasFunc(GasQuickStep),
  277. validateStack: makeStackFunc(0, 1),
  278. valid: true,
  279. },
  280. TIMESTAMP: {
  281. execute: opTimestamp,
  282. gasCost: constGasFunc(GasQuickStep),
  283. validateStack: makeStackFunc(0, 1),
  284. valid: true,
  285. },
  286. NUMBER: {
  287. execute: opNumber,
  288. gasCost: constGasFunc(GasQuickStep),
  289. validateStack: makeStackFunc(0, 1),
  290. valid: true,
  291. },
  292. DIFFICULTY: {
  293. execute: opDifficulty,
  294. gasCost: constGasFunc(GasQuickStep),
  295. validateStack: makeStackFunc(0, 1),
  296. valid: true,
  297. },
  298. GASLIMIT: {
  299. execute: opGasLimit,
  300. gasCost: constGasFunc(GasQuickStep),
  301. validateStack: makeStackFunc(0, 1),
  302. valid: true,
  303. },
  304. POP: {
  305. execute: opPop,
  306. gasCost: constGasFunc(GasQuickStep),
  307. validateStack: makeStackFunc(1, 0),
  308. valid: true,
  309. },
  310. MLOAD: {
  311. execute: opMload,
  312. gasCost: gasMLoad,
  313. validateStack: makeStackFunc(1, 1),
  314. memorySize: memoryMLoad,
  315. valid: true,
  316. },
  317. MSTORE: {
  318. execute: opMstore,
  319. gasCost: gasMStore,
  320. validateStack: makeStackFunc(2, 0),
  321. memorySize: memoryMStore,
  322. valid: true,
  323. },
  324. MSTORE8: {
  325. execute: opMstore8,
  326. gasCost: gasMStore8,
  327. memorySize: memoryMStore8,
  328. validateStack: makeStackFunc(2, 0),
  329. valid: true,
  330. },
  331. SLOAD: {
  332. execute: opSload,
  333. gasCost: gasSLoad,
  334. validateStack: makeStackFunc(1, 1),
  335. valid: true,
  336. },
  337. SSTORE: {
  338. execute: opSstore,
  339. gasCost: gasSStore,
  340. validateStack: makeStackFunc(2, 0),
  341. valid: true,
  342. },
  343. JUMPDEST: {
  344. execute: opJumpdest,
  345. gasCost: constGasFunc(params.JumpdestGas),
  346. validateStack: makeStackFunc(0, 0),
  347. valid: true,
  348. },
  349. PC: {
  350. execute: opPc,
  351. gasCost: constGasFunc(GasQuickStep),
  352. validateStack: makeStackFunc(0, 1),
  353. valid: true,
  354. },
  355. MSIZE: {
  356. execute: opMsize,
  357. gasCost: constGasFunc(GasQuickStep),
  358. validateStack: makeStackFunc(0, 1),
  359. valid: true,
  360. },
  361. GAS: {
  362. execute: opGas,
  363. gasCost: constGasFunc(GasQuickStep),
  364. validateStack: makeStackFunc(0, 1),
  365. valid: true,
  366. },
  367. CREATE: {
  368. execute: opCreate,
  369. gasCost: gasCreate,
  370. validateStack: makeStackFunc(3, 1),
  371. memorySize: memoryCreate,
  372. valid: true,
  373. },
  374. CALL: {
  375. execute: opCall,
  376. gasCost: gasCall,
  377. validateStack: makeStackFunc(7, 1),
  378. memorySize: memoryCall,
  379. valid: true,
  380. },
  381. CALLCODE: {
  382. execute: opCallCode,
  383. gasCost: gasCallCode,
  384. validateStack: makeStackFunc(7, 1),
  385. memorySize: memoryCall,
  386. valid: true,
  387. },
  388. DELEGATECALL: {
  389. execute: opDelegateCall,
  390. gasCost: gasDelegateCall,
  391. validateStack: makeStackFunc(6, 1),
  392. memorySize: memoryDelegateCall,
  393. valid: true,
  394. },
  395. RETURN: {
  396. execute: opReturn,
  397. gasCost: gasReturn,
  398. validateStack: makeStackFunc(2, 0),
  399. memorySize: memoryReturn,
  400. halts: true,
  401. valid: true,
  402. },
  403. SUICIDE: {
  404. execute: opSuicide,
  405. gasCost: gasSuicide,
  406. validateStack: makeStackFunc(1, 0),
  407. halts: true,
  408. valid: true,
  409. },
  410. JUMP: {
  411. execute: opJump,
  412. gasCost: constGasFunc(GasMidStep),
  413. validateStack: makeStackFunc(1, 0),
  414. jumps: true,
  415. valid: true,
  416. },
  417. JUMPI: {
  418. execute: opJumpi,
  419. gasCost: constGasFunc(GasSlowStep),
  420. validateStack: makeStackFunc(2, 0),
  421. jumps: true,
  422. valid: true,
  423. },
  424. STOP: {
  425. execute: opStop,
  426. gasCost: constGasFunc(Zero),
  427. validateStack: makeStackFunc(0, 0),
  428. halts: true,
  429. valid: true,
  430. },
  431. LOG0: {
  432. execute: makeLog(0),
  433. gasCost: makeGasLog(0),
  434. validateStack: makeStackFunc(2, 0),
  435. memorySize: memoryLog,
  436. valid: true,
  437. },
  438. LOG1: {
  439. execute: makeLog(1),
  440. gasCost: makeGasLog(1),
  441. validateStack: makeStackFunc(3, 0),
  442. memorySize: memoryLog,
  443. valid: true,
  444. },
  445. LOG2: {
  446. execute: makeLog(2),
  447. gasCost: makeGasLog(2),
  448. validateStack: makeStackFunc(4, 0),
  449. memorySize: memoryLog,
  450. valid: true,
  451. },
  452. LOG3: {
  453. execute: makeLog(3),
  454. gasCost: makeGasLog(3),
  455. validateStack: makeStackFunc(5, 0),
  456. memorySize: memoryLog,
  457. valid: true,
  458. },
  459. LOG4: {
  460. execute: makeLog(4),
  461. gasCost: makeGasLog(4),
  462. validateStack: makeStackFunc(6, 0),
  463. memorySize: memoryLog,
  464. valid: true,
  465. },
  466. SWAP1: {
  467. execute: makeSwap(1),
  468. gasCost: gasSwap,
  469. validateStack: makeStackFunc(2, 0),
  470. valid: true,
  471. },
  472. SWAP2: {
  473. execute: makeSwap(2),
  474. gasCost: gasSwap,
  475. validateStack: makeStackFunc(3, 0),
  476. valid: true,
  477. },
  478. SWAP3: {
  479. execute: makeSwap(3),
  480. gasCost: gasSwap,
  481. validateStack: makeStackFunc(4, 0),
  482. valid: true,
  483. },
  484. SWAP4: {
  485. execute: makeSwap(4),
  486. gasCost: gasSwap,
  487. validateStack: makeStackFunc(5, 0),
  488. valid: true,
  489. },
  490. SWAP5: {
  491. execute: makeSwap(5),
  492. gasCost: gasSwap,
  493. validateStack: makeStackFunc(6, 0),
  494. valid: true,
  495. },
  496. SWAP6: {
  497. execute: makeSwap(6),
  498. gasCost: gasSwap,
  499. validateStack: makeStackFunc(7, 0),
  500. valid: true,
  501. },
  502. SWAP7: {
  503. execute: makeSwap(7),
  504. gasCost: gasSwap,
  505. validateStack: makeStackFunc(8, 0),
  506. valid: true,
  507. },
  508. SWAP8: {
  509. execute: makeSwap(8),
  510. gasCost: gasSwap,
  511. validateStack: makeStackFunc(9, 0),
  512. valid: true,
  513. },
  514. SWAP9: {
  515. execute: makeSwap(9),
  516. gasCost: gasSwap,
  517. validateStack: makeStackFunc(10, 0),
  518. valid: true,
  519. },
  520. SWAP10: {
  521. execute: makeSwap(10),
  522. gasCost: gasSwap,
  523. validateStack: makeStackFunc(11, 0),
  524. valid: true,
  525. },
  526. SWAP11: {
  527. execute: makeSwap(11),
  528. gasCost: gasSwap,
  529. validateStack: makeStackFunc(12, 0),
  530. valid: true,
  531. },
  532. SWAP12: {
  533. execute: makeSwap(12),
  534. gasCost: gasSwap,
  535. validateStack: makeStackFunc(13, 0),
  536. valid: true,
  537. },
  538. SWAP13: {
  539. execute: makeSwap(13),
  540. gasCost: gasSwap,
  541. validateStack: makeStackFunc(14, 0),
  542. valid: true,
  543. },
  544. SWAP14: {
  545. execute: makeSwap(14),
  546. gasCost: gasSwap,
  547. validateStack: makeStackFunc(15, 0),
  548. valid: true,
  549. },
  550. SWAP15: {
  551. execute: makeSwap(15),
  552. gasCost: gasSwap,
  553. validateStack: makeStackFunc(16, 0),
  554. valid: true,
  555. },
  556. SWAP16: {
  557. execute: makeSwap(16),
  558. gasCost: gasSwap,
  559. validateStack: makeStackFunc(17, 0),
  560. valid: true,
  561. },
  562. PUSH1: {
  563. execute: makePush(1, big.NewInt(1)),
  564. gasCost: gasPush,
  565. validateStack: makeStackFunc(0, 1),
  566. valid: true,
  567. },
  568. PUSH2: {
  569. execute: makePush(2, big.NewInt(2)),
  570. gasCost: gasPush,
  571. validateStack: makeStackFunc(0, 1),
  572. valid: true,
  573. },
  574. PUSH3: {
  575. execute: makePush(3, big.NewInt(3)),
  576. gasCost: gasPush,
  577. validateStack: makeStackFunc(0, 1),
  578. valid: true,
  579. },
  580. PUSH4: {
  581. execute: makePush(4, big.NewInt(4)),
  582. gasCost: gasPush,
  583. validateStack: makeStackFunc(0, 1),
  584. valid: true,
  585. },
  586. PUSH5: {
  587. execute: makePush(5, big.NewInt(5)),
  588. gasCost: gasPush,
  589. validateStack: makeStackFunc(0, 1),
  590. valid: true,
  591. },
  592. PUSH6: {
  593. execute: makePush(6, big.NewInt(6)),
  594. gasCost: gasPush,
  595. validateStack: makeStackFunc(0, 1),
  596. valid: true,
  597. },
  598. PUSH7: {
  599. execute: makePush(7, big.NewInt(7)),
  600. gasCost: gasPush,
  601. validateStack: makeStackFunc(0, 1),
  602. valid: true,
  603. },
  604. PUSH8: {
  605. execute: makePush(8, big.NewInt(8)),
  606. gasCost: gasPush,
  607. validateStack: makeStackFunc(0, 1),
  608. valid: true,
  609. },
  610. PUSH9: {
  611. execute: makePush(9, big.NewInt(9)),
  612. gasCost: gasPush,
  613. validateStack: makeStackFunc(0, 1),
  614. valid: true,
  615. },
  616. PUSH10: {
  617. execute: makePush(10, big.NewInt(10)),
  618. gasCost: gasPush,
  619. validateStack: makeStackFunc(0, 1),
  620. valid: true,
  621. },
  622. PUSH11: {
  623. execute: makePush(11, big.NewInt(11)),
  624. gasCost: gasPush,
  625. validateStack: makeStackFunc(0, 1),
  626. valid: true,
  627. },
  628. PUSH12: {
  629. execute: makePush(12, big.NewInt(12)),
  630. gasCost: gasPush,
  631. validateStack: makeStackFunc(0, 1),
  632. valid: true,
  633. },
  634. PUSH13: {
  635. execute: makePush(13, big.NewInt(13)),
  636. gasCost: gasPush,
  637. validateStack: makeStackFunc(0, 1),
  638. valid: true,
  639. },
  640. PUSH14: {
  641. execute: makePush(14, big.NewInt(14)),
  642. gasCost: gasPush,
  643. validateStack: makeStackFunc(0, 1),
  644. valid: true,
  645. },
  646. PUSH15: {
  647. execute: makePush(15, big.NewInt(15)),
  648. gasCost: gasPush,
  649. validateStack: makeStackFunc(0, 1),
  650. valid: true,
  651. },
  652. PUSH16: {
  653. execute: makePush(16, big.NewInt(16)),
  654. gasCost: gasPush,
  655. validateStack: makeStackFunc(0, 1),
  656. valid: true,
  657. },
  658. PUSH17: {
  659. execute: makePush(17, big.NewInt(17)),
  660. gasCost: gasPush,
  661. validateStack: makeStackFunc(0, 1),
  662. valid: true,
  663. },
  664. PUSH18: {
  665. execute: makePush(18, big.NewInt(18)),
  666. gasCost: gasPush,
  667. validateStack: makeStackFunc(0, 1),
  668. valid: true,
  669. },
  670. PUSH19: {
  671. execute: makePush(19, big.NewInt(19)),
  672. gasCost: gasPush,
  673. validateStack: makeStackFunc(0, 1),
  674. valid: true,
  675. },
  676. PUSH20: {
  677. execute: makePush(20, big.NewInt(20)),
  678. gasCost: gasPush,
  679. validateStack: makeStackFunc(0, 1),
  680. valid: true,
  681. },
  682. PUSH21: {
  683. execute: makePush(21, big.NewInt(21)),
  684. gasCost: gasPush,
  685. validateStack: makeStackFunc(0, 1),
  686. valid: true,
  687. },
  688. PUSH22: {
  689. execute: makePush(22, big.NewInt(22)),
  690. gasCost: gasPush,
  691. validateStack: makeStackFunc(0, 1),
  692. valid: true,
  693. },
  694. PUSH23: {
  695. execute: makePush(23, big.NewInt(23)),
  696. gasCost: gasPush,
  697. validateStack: makeStackFunc(0, 1),
  698. valid: true,
  699. },
  700. PUSH24: {
  701. execute: makePush(24, big.NewInt(24)),
  702. gasCost: gasPush,
  703. validateStack: makeStackFunc(0, 1),
  704. valid: true,
  705. },
  706. PUSH25: {
  707. execute: makePush(25, big.NewInt(25)),
  708. gasCost: gasPush,
  709. validateStack: makeStackFunc(0, 1),
  710. valid: true,
  711. },
  712. PUSH26: {
  713. execute: makePush(26, big.NewInt(26)),
  714. gasCost: gasPush,
  715. validateStack: makeStackFunc(0, 1),
  716. valid: true,
  717. },
  718. PUSH27: {
  719. execute: makePush(27, big.NewInt(27)),
  720. gasCost: gasPush,
  721. validateStack: makeStackFunc(0, 1),
  722. valid: true,
  723. },
  724. PUSH28: {
  725. execute: makePush(28, big.NewInt(28)),
  726. gasCost: gasPush,
  727. validateStack: makeStackFunc(0, 1),
  728. valid: true,
  729. },
  730. PUSH29: {
  731. execute: makePush(29, big.NewInt(29)),
  732. gasCost: gasPush,
  733. validateStack: makeStackFunc(0, 1),
  734. valid: true,
  735. },
  736. PUSH30: {
  737. execute: makePush(30, big.NewInt(30)),
  738. gasCost: gasPush,
  739. validateStack: makeStackFunc(0, 1),
  740. valid: true,
  741. },
  742. PUSH31: {
  743. execute: makePush(31, big.NewInt(31)),
  744. gasCost: gasPush,
  745. validateStack: makeStackFunc(0, 1),
  746. valid: true,
  747. },
  748. PUSH32: {
  749. execute: makePush(32, big.NewInt(32)),
  750. gasCost: gasPush,
  751. validateStack: makeStackFunc(0, 1),
  752. valid: true,
  753. },
  754. DUP1: {
  755. execute: makeDup(1),
  756. gasCost: gasDup,
  757. validateStack: makeStackFunc(1, 1),
  758. valid: true,
  759. },
  760. DUP2: {
  761. execute: makeDup(2),
  762. gasCost: gasDup,
  763. validateStack: makeStackFunc(2, 1),
  764. valid: true,
  765. },
  766. DUP3: {
  767. execute: makeDup(3),
  768. gasCost: gasDup,
  769. validateStack: makeStackFunc(3, 1),
  770. valid: true,
  771. },
  772. DUP4: {
  773. execute: makeDup(4),
  774. gasCost: gasDup,
  775. validateStack: makeStackFunc(4, 1),
  776. valid: true,
  777. },
  778. DUP5: {
  779. execute: makeDup(5),
  780. gasCost: gasDup,
  781. validateStack: makeStackFunc(5, 1),
  782. valid: true,
  783. },
  784. DUP6: {
  785. execute: makeDup(6),
  786. gasCost: gasDup,
  787. validateStack: makeStackFunc(6, 1),
  788. valid: true,
  789. },
  790. DUP7: {
  791. execute: makeDup(7),
  792. gasCost: gasDup,
  793. validateStack: makeStackFunc(7, 1),
  794. valid: true,
  795. },
  796. DUP8: {
  797. execute: makeDup(8),
  798. gasCost: gasDup,
  799. validateStack: makeStackFunc(8, 1),
  800. valid: true,
  801. },
  802. DUP9: {
  803. execute: makeDup(9),
  804. gasCost: gasDup,
  805. validateStack: makeStackFunc(9, 1),
  806. valid: true,
  807. },
  808. DUP10: {
  809. execute: makeDup(10),
  810. gasCost: gasDup,
  811. validateStack: makeStackFunc(10, 1),
  812. valid: true,
  813. },
  814. DUP11: {
  815. execute: makeDup(11),
  816. gasCost: gasDup,
  817. validateStack: makeStackFunc(11, 1),
  818. valid: true,
  819. },
  820. DUP12: {
  821. execute: makeDup(12),
  822. gasCost: gasDup,
  823. validateStack: makeStackFunc(12, 1),
  824. valid: true,
  825. },
  826. DUP13: {
  827. execute: makeDup(13),
  828. gasCost: gasDup,
  829. validateStack: makeStackFunc(13, 1),
  830. valid: true,
  831. },
  832. DUP14: {
  833. execute: makeDup(14),
  834. gasCost: gasDup,
  835. validateStack: makeStackFunc(14, 1),
  836. valid: true,
  837. },
  838. DUP15: {
  839. execute: makeDup(15),
  840. gasCost: gasDup,
  841. validateStack: makeStackFunc(15, 1),
  842. valid: true,
  843. },
  844. DUP16: {
  845. execute: makeDup(16),
  846. gasCost: gasDup,
  847. validateStack: makeStackFunc(16, 1),
  848. valid: true,
  849. },
  850. }
  851. }