state_test.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  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 tests
  17. import (
  18. "math/big"
  19. "os"
  20. "path/filepath"
  21. "testing"
  22. "github.com/ethereum/go-ethereum/params"
  23. )
  24. func BenchmarkStateCall1024(b *testing.B) {
  25. fn := filepath.Join(stateTestDir, "stCallCreateCallCodeTest.json")
  26. if err := BenchVmTest(fn, bconf{"Call1024BalanceTooLow", true, os.Getenv("JITVM") == "true"}, b); err != nil {
  27. b.Error(err)
  28. }
  29. }
  30. func TestStateSystemOperations(t *testing.T) {
  31. chainConfig := &params.ChainConfig{
  32. HomesteadBlock: big.NewInt(1150000),
  33. }
  34. fn := filepath.Join(stateTestDir, "stSystemOperationsTest.json")
  35. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  36. t.Error(err)
  37. }
  38. }
  39. func TestStateExample(t *testing.T) {
  40. chainConfig := &params.ChainConfig{
  41. HomesteadBlock: big.NewInt(1150000),
  42. }
  43. fn := filepath.Join(stateTestDir, "stExample.json")
  44. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  45. t.Error(err)
  46. }
  47. }
  48. func TestStatePreCompiledContracts(t *testing.T) {
  49. chainConfig := &params.ChainConfig{
  50. HomesteadBlock: big.NewInt(1150000),
  51. }
  52. fn := filepath.Join(stateTestDir, "stPreCompiledContracts.json")
  53. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  54. t.Error(err)
  55. }
  56. }
  57. func TestStateRecursiveCreate(t *testing.T) {
  58. chainConfig := &params.ChainConfig{
  59. HomesteadBlock: big.NewInt(1150000),
  60. }
  61. fn := filepath.Join(stateTestDir, "stRecursiveCreate.json")
  62. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  63. t.Error(err)
  64. }
  65. }
  66. func TestStateSpecial(t *testing.T) {
  67. chainConfig := &params.ChainConfig{
  68. HomesteadBlock: big.NewInt(1150000),
  69. }
  70. fn := filepath.Join(stateTestDir, "stSpecialTest.json")
  71. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  72. t.Error(err)
  73. }
  74. }
  75. func TestStateRefund(t *testing.T) {
  76. chainConfig := &params.ChainConfig{
  77. HomesteadBlock: big.NewInt(1150000),
  78. }
  79. fn := filepath.Join(stateTestDir, "stRefundTest.json")
  80. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  81. t.Error(err)
  82. }
  83. }
  84. func TestStateBlockHash(t *testing.T) {
  85. chainConfig := &params.ChainConfig{
  86. HomesteadBlock: big.NewInt(1150000),
  87. }
  88. fn := filepath.Join(stateTestDir, "stBlockHashTest.json")
  89. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  90. t.Error(err)
  91. }
  92. }
  93. func TestStateInitCode(t *testing.T) {
  94. chainConfig := &params.ChainConfig{
  95. HomesteadBlock: big.NewInt(1150000),
  96. }
  97. fn := filepath.Join(stateTestDir, "stInitCodeTest.json")
  98. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  99. t.Error(err)
  100. }
  101. }
  102. func TestStateLog(t *testing.T) {
  103. chainConfig := &params.ChainConfig{
  104. HomesteadBlock: big.NewInt(1150000),
  105. }
  106. fn := filepath.Join(stateTestDir, "stLogTests.json")
  107. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  108. t.Error(err)
  109. }
  110. }
  111. func TestStateTransaction(t *testing.T) {
  112. chainConfig := &params.ChainConfig{
  113. HomesteadBlock: big.NewInt(1150000),
  114. }
  115. fn := filepath.Join(stateTestDir, "stTransactionTest.json")
  116. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  117. t.Error(err)
  118. }
  119. }
  120. func TestStateTransition(t *testing.T) {
  121. chainConfig := &params.ChainConfig{
  122. HomesteadBlock: big.NewInt(1150000),
  123. }
  124. fn := filepath.Join(stateTestDir, "stTransitionTest.json")
  125. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  126. t.Error(err)
  127. }
  128. }
  129. func TestCallCreateCallCode(t *testing.T) {
  130. chainConfig := &params.ChainConfig{
  131. HomesteadBlock: big.NewInt(1150000),
  132. }
  133. fn := filepath.Join(stateTestDir, "stCallCreateCallCodeTest.json")
  134. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  135. t.Error(err)
  136. }
  137. }
  138. func TestCallCodes(t *testing.T) {
  139. chainConfig := &params.ChainConfig{
  140. HomesteadBlock: big.NewInt(1150000),
  141. }
  142. fn := filepath.Join(stateTestDir, "stCallCodes.json")
  143. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  144. t.Error(err)
  145. }
  146. }
  147. func TestDelegateCall(t *testing.T) {
  148. chainConfig := &params.ChainConfig{
  149. HomesteadBlock: big.NewInt(1150000),
  150. }
  151. fn := filepath.Join(stateTestDir, "stDelegatecallTest.json")
  152. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  153. t.Error(err)
  154. }
  155. }
  156. func TestMemory(t *testing.T) {
  157. chainConfig := &params.ChainConfig{
  158. HomesteadBlock: big.NewInt(1150000),
  159. }
  160. fn := filepath.Join(stateTestDir, "stMemoryTest.json")
  161. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  162. t.Error(err)
  163. }
  164. }
  165. func TestMemoryStress(t *testing.T) {
  166. chainConfig := &params.ChainConfig{
  167. HomesteadBlock: big.NewInt(1150000),
  168. }
  169. if os.Getenv("TEST_VM_COMPLEX") == "" {
  170. t.Skip()
  171. }
  172. fn := filepath.Join(stateTestDir, "stMemoryStressTest.json")
  173. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  174. t.Error(err)
  175. }
  176. }
  177. func TestQuadraticComplexity(t *testing.T) {
  178. chainConfig := &params.ChainConfig{
  179. HomesteadBlock: big.NewInt(1150000),
  180. }
  181. if os.Getenv("TEST_VM_COMPLEX") == "" {
  182. t.Skip()
  183. }
  184. fn := filepath.Join(stateTestDir, "stQuadraticComplexityTest.json")
  185. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  186. t.Error(err)
  187. }
  188. }
  189. func TestSolidity(t *testing.T) {
  190. chainConfig := &params.ChainConfig{
  191. HomesteadBlock: big.NewInt(1150000),
  192. }
  193. fn := filepath.Join(stateTestDir, "stSolidityTest.json")
  194. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  195. t.Error(err)
  196. }
  197. }
  198. func TestWallet(t *testing.T) {
  199. chainConfig := &params.ChainConfig{
  200. HomesteadBlock: big.NewInt(1150000),
  201. }
  202. fn := filepath.Join(stateTestDir, "stWalletTest.json")
  203. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  204. t.Error(err)
  205. }
  206. }
  207. func TestStateTestsRandom(t *testing.T) {
  208. chainConfig := &params.ChainConfig{
  209. HomesteadBlock: big.NewInt(1150000),
  210. }
  211. fns, _ := filepath.Glob("./files/StateTests/RandomTests/*")
  212. for _, fn := range fns {
  213. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  214. t.Error(fn, err)
  215. }
  216. }
  217. }
  218. // homestead tests
  219. func TestHomesteadStateSystemOperations(t *testing.T) {
  220. chainConfig := &params.ChainConfig{
  221. HomesteadBlock: new(big.Int),
  222. }
  223. fn := filepath.Join(stateTestDir, "Homestead", "stSystemOperationsTest.json")
  224. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  225. t.Error(err)
  226. }
  227. }
  228. func TestHomesteadStatePreCompiledContracts(t *testing.T) {
  229. chainConfig := &params.ChainConfig{
  230. HomesteadBlock: new(big.Int),
  231. }
  232. fn := filepath.Join(stateTestDir, "Homestead", "stPreCompiledContracts.json")
  233. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  234. t.Error(err)
  235. }
  236. }
  237. func TestHomesteadStateRecursiveCreate(t *testing.T) {
  238. chainConfig := &params.ChainConfig{
  239. HomesteadBlock: new(big.Int),
  240. }
  241. fn := filepath.Join(stateTestDir, "Homestead", "stSpecialTest.json")
  242. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  243. t.Error(err)
  244. }
  245. }
  246. func TestHomesteadStateRefund(t *testing.T) {
  247. chainConfig := &params.ChainConfig{
  248. HomesteadBlock: new(big.Int),
  249. }
  250. fn := filepath.Join(stateTestDir, "Homestead", "stRefundTest.json")
  251. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  252. t.Error(err)
  253. }
  254. }
  255. func TestHomesteadStateInitCode(t *testing.T) {
  256. chainConfig := &params.ChainConfig{
  257. HomesteadBlock: new(big.Int),
  258. }
  259. fn := filepath.Join(stateTestDir, "Homestead", "stInitCodeTest.json")
  260. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  261. t.Error(err)
  262. }
  263. }
  264. func TestHomesteadStateLog(t *testing.T) {
  265. chainConfig := &params.ChainConfig{
  266. HomesteadBlock: new(big.Int),
  267. }
  268. fn := filepath.Join(stateTestDir, "Homestead", "stLogTests.json")
  269. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  270. t.Error(err)
  271. }
  272. }
  273. func TestHomesteadStateTransaction(t *testing.T) {
  274. chainConfig := &params.ChainConfig{
  275. HomesteadBlock: new(big.Int),
  276. }
  277. fn := filepath.Join(stateTestDir, "Homestead", "stTransactionTest.json")
  278. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  279. t.Error(err)
  280. }
  281. }
  282. func TestHomesteadCallCreateCallCode(t *testing.T) {
  283. chainConfig := &params.ChainConfig{
  284. HomesteadBlock: new(big.Int),
  285. }
  286. fn := filepath.Join(stateTestDir, "Homestead", "stCallCreateCallCodeTest.json")
  287. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  288. t.Error(err)
  289. }
  290. }
  291. func TestHomesteadCallCodes(t *testing.T) {
  292. chainConfig := &params.ChainConfig{
  293. HomesteadBlock: new(big.Int),
  294. }
  295. fn := filepath.Join(stateTestDir, "Homestead", "stCallCodes.json")
  296. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  297. t.Error(err)
  298. }
  299. }
  300. func TestHomesteadMemory(t *testing.T) {
  301. chainConfig := &params.ChainConfig{
  302. HomesteadBlock: new(big.Int),
  303. }
  304. fn := filepath.Join(stateTestDir, "Homestead", "stMemoryTest.json")
  305. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  306. t.Error(err)
  307. }
  308. }
  309. func TestHomesteadMemoryStress(t *testing.T) {
  310. chainConfig := &params.ChainConfig{
  311. HomesteadBlock: new(big.Int),
  312. }
  313. if os.Getenv("TEST_VM_COMPLEX") == "" {
  314. t.Skip()
  315. }
  316. fn := filepath.Join(stateTestDir, "Homestead", "stMemoryStressTest.json")
  317. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  318. t.Error(err)
  319. }
  320. }
  321. func TestHomesteadQuadraticComplexity(t *testing.T) {
  322. chainConfig := &params.ChainConfig{
  323. HomesteadBlock: new(big.Int),
  324. }
  325. if os.Getenv("TEST_VM_COMPLEX") == "" {
  326. t.Skip()
  327. }
  328. fn := filepath.Join(stateTestDir, "Homestead", "stQuadraticComplexityTest.json")
  329. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  330. t.Error(err)
  331. }
  332. }
  333. func TestHomesteadWallet(t *testing.T) {
  334. chainConfig := &params.ChainConfig{
  335. HomesteadBlock: new(big.Int),
  336. }
  337. fn := filepath.Join(stateTestDir, "Homestead", "stWalletTest.json")
  338. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  339. t.Error(err)
  340. }
  341. }
  342. func TestHomesteadDelegateCodes(t *testing.T) {
  343. chainConfig := &params.ChainConfig{
  344. HomesteadBlock: new(big.Int),
  345. }
  346. fn := filepath.Join(stateTestDir, "Homestead", "stCallDelegateCodes.json")
  347. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  348. t.Error(err)
  349. }
  350. }
  351. func TestHomesteadDelegateCodesCallCode(t *testing.T) {
  352. chainConfig := &params.ChainConfig{
  353. HomesteadBlock: new(big.Int),
  354. }
  355. fn := filepath.Join(stateTestDir, "Homestead", "stCallDelegateCodesCallCode.json")
  356. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  357. t.Error(err)
  358. }
  359. }
  360. func TestHomesteadBounds(t *testing.T) {
  361. chainConfig := &params.ChainConfig{
  362. HomesteadBlock: new(big.Int),
  363. }
  364. fn := filepath.Join(stateTestDir, "Homestead", "stBoundsTest.json")
  365. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  366. t.Error(err)
  367. }
  368. }
  369. // EIP150 tests
  370. func TestEIP150Specific(t *testing.T) {
  371. chainConfig := &params.ChainConfig{
  372. HomesteadBlock: new(big.Int),
  373. EIP150Block: big.NewInt(2457000),
  374. }
  375. fn := filepath.Join(stateTestDir, "EIP150", "stEIPSpecificTest.json")
  376. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  377. t.Error(err)
  378. }
  379. }
  380. func TestEIP150SingleCodeGasPrice(t *testing.T) {
  381. chainConfig := &params.ChainConfig{
  382. HomesteadBlock: new(big.Int),
  383. EIP150Block: big.NewInt(2457000),
  384. }
  385. fn := filepath.Join(stateTestDir, "EIP150", "stEIPSingleCodeGasPrices.json")
  386. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  387. t.Error(err)
  388. }
  389. }
  390. func TestEIP150MemExpandingCalls(t *testing.T) {
  391. chainConfig := &params.ChainConfig{
  392. HomesteadBlock: new(big.Int),
  393. EIP150Block: big.NewInt(2457000),
  394. }
  395. fn := filepath.Join(stateTestDir, "EIP150", "stMemExpandingEIPCalls.json")
  396. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  397. t.Error(err)
  398. }
  399. }
  400. func TestEIP150HomesteadStateSystemOperations(t *testing.T) {
  401. chainConfig := &params.ChainConfig{
  402. HomesteadBlock: new(big.Int),
  403. EIP150Block: big.NewInt(2457000),
  404. }
  405. fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stSystemOperationsTest.json")
  406. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  407. t.Error(err)
  408. }
  409. }
  410. func TestEIP150HomesteadStatePreCompiledContracts(t *testing.T) {
  411. chainConfig := &params.ChainConfig{
  412. HomesteadBlock: new(big.Int),
  413. EIP150Block: big.NewInt(2457000),
  414. }
  415. fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stPreCompiledContracts.json")
  416. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  417. t.Error(err)
  418. }
  419. }
  420. func TestEIP150HomesteadStateRecursiveCreate(t *testing.T) {
  421. chainConfig := &params.ChainConfig{
  422. HomesteadBlock: new(big.Int),
  423. EIP150Block: big.NewInt(2457000),
  424. }
  425. fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stSpecialTest.json")
  426. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  427. t.Error(err)
  428. }
  429. }
  430. func TestEIP150HomesteadStateRefund(t *testing.T) {
  431. chainConfig := &params.ChainConfig{
  432. HomesteadBlock: new(big.Int),
  433. EIP150Block: big.NewInt(2457000),
  434. }
  435. fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stRefundTest.json")
  436. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  437. t.Error(err)
  438. }
  439. }
  440. func TestEIP150HomesteadStateInitCode(t *testing.T) {
  441. chainConfig := &params.ChainConfig{
  442. HomesteadBlock: new(big.Int),
  443. EIP150Block: big.NewInt(2457000),
  444. }
  445. fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stInitCodeTest.json")
  446. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  447. t.Error(err)
  448. }
  449. }
  450. func TestEIP150HomesteadStateLog(t *testing.T) {
  451. chainConfig := &params.ChainConfig{
  452. HomesteadBlock: new(big.Int),
  453. EIP150Block: big.NewInt(2457000),
  454. }
  455. fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stLogTests.json")
  456. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  457. t.Error(err)
  458. }
  459. }
  460. func TestEIP150HomesteadStateTransaction(t *testing.T) {
  461. chainConfig := &params.ChainConfig{
  462. HomesteadBlock: new(big.Int),
  463. EIP150Block: big.NewInt(2457000),
  464. }
  465. fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stTransactionTest.json")
  466. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  467. t.Error(err)
  468. }
  469. }
  470. func TestEIP150HomesteadCallCreateCallCode(t *testing.T) {
  471. chainConfig := &params.ChainConfig{
  472. HomesteadBlock: new(big.Int),
  473. EIP150Block: big.NewInt(2457000),
  474. }
  475. fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stCallCreateCallCodeTest.json")
  476. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  477. t.Error(err)
  478. }
  479. }
  480. func TestEIP150HomesteadCallCodes(t *testing.T) {
  481. chainConfig := &params.ChainConfig{
  482. HomesteadBlock: new(big.Int),
  483. EIP150Block: big.NewInt(2457000),
  484. }
  485. fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stCallCodes.json")
  486. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  487. t.Error(err)
  488. }
  489. }
  490. func TestEIP150HomesteadMemory(t *testing.T) {
  491. chainConfig := &params.ChainConfig{
  492. HomesteadBlock: new(big.Int),
  493. EIP150Block: big.NewInt(2457000),
  494. }
  495. fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stMemoryTest.json")
  496. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  497. t.Error(err)
  498. }
  499. }
  500. func TestEIP150HomesteadMemoryStress(t *testing.T) {
  501. chainConfig := &params.ChainConfig{
  502. HomesteadBlock: new(big.Int),
  503. EIP150Block: big.NewInt(2457000),
  504. }
  505. if os.Getenv("TEST_VM_COMPLEX") == "" {
  506. t.Skip()
  507. }
  508. fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stMemoryStressTest.json")
  509. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  510. t.Error(err)
  511. }
  512. }
  513. func TestEIP150HomesteadQuadraticComplexity(t *testing.T) {
  514. chainConfig := &params.ChainConfig{
  515. HomesteadBlock: new(big.Int),
  516. EIP150Block: big.NewInt(2457000),
  517. }
  518. if os.Getenv("TEST_VM_COMPLEX") == "" {
  519. t.Skip()
  520. }
  521. fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stQuadraticComplexityTest.json")
  522. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  523. t.Error(err)
  524. }
  525. }
  526. func TestEIP150HomesteadWallet(t *testing.T) {
  527. chainConfig := &params.ChainConfig{
  528. HomesteadBlock: new(big.Int),
  529. EIP150Block: big.NewInt(2457000),
  530. }
  531. fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stWalletTest.json")
  532. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  533. t.Error(err)
  534. }
  535. }
  536. func TestEIP150HomesteadDelegateCodes(t *testing.T) {
  537. chainConfig := &params.ChainConfig{
  538. HomesteadBlock: new(big.Int),
  539. EIP150Block: big.NewInt(2457000),
  540. }
  541. fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stCallDelegateCodes.json")
  542. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  543. t.Error(err)
  544. }
  545. }
  546. func TestEIP150HomesteadDelegateCodesCallCode(t *testing.T) {
  547. chainConfig := &params.ChainConfig{
  548. HomesteadBlock: new(big.Int),
  549. EIP150Block: big.NewInt(2457000),
  550. }
  551. fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stCallDelegateCodesCallCode.json")
  552. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  553. t.Error(err)
  554. }
  555. }
  556. func TestEIP150HomesteadBounds(t *testing.T) {
  557. chainConfig := &params.ChainConfig{
  558. HomesteadBlock: new(big.Int),
  559. EIP150Block: big.NewInt(2457000),
  560. }
  561. fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stBoundsTest.json")
  562. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  563. t.Error(err)
  564. }
  565. }
  566. // EIP158 tests
  567. func TestEIP158Create(t *testing.T) {
  568. chainConfig := &params.ChainConfig{
  569. HomesteadBlock: new(big.Int),
  570. EIP150Block: big.NewInt(2457000),
  571. EIP158Block: big.NewInt(3500000),
  572. }
  573. fn := filepath.Join(stateTestDir, "EIP158", "stCreateTest.json")
  574. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  575. t.Error(err)
  576. }
  577. }
  578. func TestEIP158Specific(t *testing.T) {
  579. chainConfig := &params.ChainConfig{
  580. HomesteadBlock: new(big.Int),
  581. EIP150Block: big.NewInt(2457000),
  582. EIP158Block: big.NewInt(3500000),
  583. }
  584. fn := filepath.Join(stateTestDir, "EIP158", "stEIP158SpecificTest.json")
  585. if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
  586. t.Error(err)
  587. }
  588. }