github.com/ylsGit/go-ethereum@v1.6.5/tests/state_test.go (about) 1 // Copyright 2015 The go-ethereum Authors 2 // This file is part of the go-ethereum library. 3 // 4 // The go-ethereum library is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU Lesser General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // The go-ethereum library is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU Lesser General Public License for more details. 13 // 14 // You should have received a copy of the GNU Lesser General Public License 15 // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. 16 17 package tests 18 19 import ( 20 "math/big" 21 "os" 22 "path/filepath" 23 "testing" 24 25 "github.com/ethereum/go-ethereum/params" 26 ) 27 28 func BenchmarkStateCall1024(b *testing.B) { 29 fn := filepath.Join(stateTestDir, "stCallCreateCallCodeTest.json") 30 if err := BenchVmTest(fn, bconf{"Call1024BalanceTooLow", true, os.Getenv("JITVM") == "true"}, b); err != nil { 31 b.Error(err) 32 } 33 } 34 35 func TestStateSystemOperations(t *testing.T) { 36 chainConfig := ¶ms.ChainConfig{ 37 HomesteadBlock: big.NewInt(1150000), 38 } 39 40 fn := filepath.Join(stateTestDir, "stSystemOperationsTest.json") 41 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 42 t.Error(err) 43 } 44 } 45 46 func TestStateExample(t *testing.T) { 47 chainConfig := ¶ms.ChainConfig{ 48 HomesteadBlock: big.NewInt(1150000), 49 } 50 51 fn := filepath.Join(stateTestDir, "stExample.json") 52 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 53 t.Error(err) 54 } 55 } 56 57 func TestStatePreCompiledContracts(t *testing.T) { 58 chainConfig := ¶ms.ChainConfig{ 59 HomesteadBlock: big.NewInt(1150000), 60 } 61 62 fn := filepath.Join(stateTestDir, "stPreCompiledContracts.json") 63 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 64 t.Error(err) 65 } 66 } 67 68 func TestStateRecursiveCreate(t *testing.T) { 69 chainConfig := ¶ms.ChainConfig{ 70 HomesteadBlock: big.NewInt(1150000), 71 } 72 73 fn := filepath.Join(stateTestDir, "stRecursiveCreate.json") 74 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 75 t.Error(err) 76 } 77 } 78 79 func TestStateSpecial(t *testing.T) { 80 chainConfig := ¶ms.ChainConfig{ 81 HomesteadBlock: big.NewInt(1150000), 82 } 83 84 fn := filepath.Join(stateTestDir, "stSpecialTest.json") 85 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 86 t.Error(err) 87 } 88 } 89 90 func TestStateRefund(t *testing.T) { 91 chainConfig := ¶ms.ChainConfig{ 92 HomesteadBlock: big.NewInt(1150000), 93 } 94 95 fn := filepath.Join(stateTestDir, "stRefundTest.json") 96 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 97 t.Error(err) 98 } 99 } 100 101 func TestStateBlockHash(t *testing.T) { 102 chainConfig := ¶ms.ChainConfig{ 103 HomesteadBlock: big.NewInt(1150000), 104 } 105 106 fn := filepath.Join(stateTestDir, "stBlockHashTest.json") 107 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 108 t.Error(err) 109 } 110 } 111 112 func TestStateInitCode(t *testing.T) { 113 chainConfig := ¶ms.ChainConfig{ 114 HomesteadBlock: big.NewInt(1150000), 115 } 116 117 fn := filepath.Join(stateTestDir, "stInitCodeTest.json") 118 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 119 t.Error(err) 120 } 121 } 122 123 func TestStateLog(t *testing.T) { 124 chainConfig := ¶ms.ChainConfig{ 125 HomesteadBlock: big.NewInt(1150000), 126 } 127 128 fn := filepath.Join(stateTestDir, "stLogTests.json") 129 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 130 t.Error(err) 131 } 132 } 133 134 func TestStateTransaction(t *testing.T) { 135 chainConfig := ¶ms.ChainConfig{ 136 HomesteadBlock: big.NewInt(1150000), 137 } 138 139 fn := filepath.Join(stateTestDir, "stTransactionTest.json") 140 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 141 t.Error(err) 142 } 143 } 144 145 func TestStateTransition(t *testing.T) { 146 chainConfig := ¶ms.ChainConfig{ 147 HomesteadBlock: big.NewInt(1150000), 148 } 149 150 fn := filepath.Join(stateTestDir, "stTransitionTest.json") 151 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 152 t.Error(err) 153 } 154 } 155 156 func TestCallCreateCallCode(t *testing.T) { 157 chainConfig := ¶ms.ChainConfig{ 158 HomesteadBlock: big.NewInt(1150000), 159 } 160 161 fn := filepath.Join(stateTestDir, "stCallCreateCallCodeTest.json") 162 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 163 t.Error(err) 164 } 165 } 166 167 func TestCallCodes(t *testing.T) { 168 chainConfig := ¶ms.ChainConfig{ 169 HomesteadBlock: big.NewInt(1150000), 170 } 171 172 fn := filepath.Join(stateTestDir, "stCallCodes.json") 173 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 174 t.Error(err) 175 } 176 } 177 178 func TestMemory(t *testing.T) { 179 chainConfig := ¶ms.ChainConfig{ 180 HomesteadBlock: big.NewInt(1150000), 181 } 182 183 fn := filepath.Join(stateTestDir, "stMemoryTest.json") 184 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 185 t.Error(err) 186 } 187 } 188 189 func TestMemoryStress(t *testing.T) { 190 chainConfig := ¶ms.ChainConfig{ 191 HomesteadBlock: big.NewInt(1150000), 192 } 193 194 if os.Getenv("TEST_VM_COMPLEX") == "" { 195 t.Skip() 196 } 197 fn := filepath.Join(stateTestDir, "stMemoryStressTest.json") 198 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 199 t.Error(err) 200 } 201 } 202 203 func TestQuadraticComplexity(t *testing.T) { 204 chainConfig := ¶ms.ChainConfig{ 205 HomesteadBlock: big.NewInt(1150000), 206 } 207 208 if os.Getenv("TEST_VM_COMPLEX") == "" { 209 t.Skip() 210 } 211 fn := filepath.Join(stateTestDir, "stQuadraticComplexityTest.json") 212 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 213 t.Error(err) 214 } 215 } 216 217 func TestSolidity(t *testing.T) { 218 chainConfig := ¶ms.ChainConfig{ 219 HomesteadBlock: big.NewInt(1150000), 220 } 221 222 fn := filepath.Join(stateTestDir, "stSolidityTest.json") 223 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 224 t.Error(err) 225 } 226 } 227 228 func TestWallet(t *testing.T) { 229 chainConfig := ¶ms.ChainConfig{ 230 HomesteadBlock: big.NewInt(1150000), 231 } 232 233 fn := filepath.Join(stateTestDir, "stWalletTest.json") 234 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 235 t.Error(err) 236 } 237 } 238 239 func TestStateTestsRandom(t *testing.T) { 240 chainConfig := ¶ms.ChainConfig{ 241 HomesteadBlock: big.NewInt(1150000), 242 } 243 244 fns, _ := filepath.Glob("./files/StateTests/RandomTests/*") 245 for _, fn := range fns { 246 t.Log("running:", fn) 247 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 248 t.Error(fn, err) 249 } 250 } 251 } 252 253 // homestead tests 254 func TestHomesteadDelegateCall(t *testing.T) { 255 chainConfig := ¶ms.ChainConfig{ 256 HomesteadBlock: big.NewInt(1150000), 257 } 258 259 fn := filepath.Join(stateTestDir, "Homestead", "stDelegatecallTest.json") 260 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 261 t.Error(err) 262 } 263 } 264 265 func TestHomesteadStateSystemOperations(t *testing.T) { 266 chainConfig := ¶ms.ChainConfig{ 267 HomesteadBlock: new(big.Int), 268 } 269 270 fn := filepath.Join(stateTestDir, "Homestead", "stSystemOperationsTest.json") 271 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 272 t.Error(err) 273 } 274 } 275 276 func TestHomesteadStatePreCompiledContracts(t *testing.T) { 277 chainConfig := ¶ms.ChainConfig{ 278 HomesteadBlock: new(big.Int), 279 } 280 281 fn := filepath.Join(stateTestDir, "Homestead", "stPreCompiledContracts.json") 282 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 283 t.Error(err) 284 } 285 } 286 287 func TestHomesteadStateRecursiveCreate(t *testing.T) { 288 chainConfig := ¶ms.ChainConfig{ 289 HomesteadBlock: new(big.Int), 290 } 291 292 fn := filepath.Join(stateTestDir, "Homestead", "stSpecialTest.json") 293 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 294 t.Error(err) 295 } 296 } 297 298 func TestHomesteadStateRefund(t *testing.T) { 299 chainConfig := ¶ms.ChainConfig{ 300 HomesteadBlock: new(big.Int), 301 } 302 303 fn := filepath.Join(stateTestDir, "Homestead", "stRefundTest.json") 304 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 305 t.Error(err) 306 } 307 } 308 309 func TestHomesteadStateInitCode(t *testing.T) { 310 chainConfig := ¶ms.ChainConfig{ 311 HomesteadBlock: new(big.Int), 312 } 313 314 fn := filepath.Join(stateTestDir, "Homestead", "stInitCodeTest.json") 315 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 316 t.Error(err) 317 } 318 } 319 320 func TestHomesteadStateLog(t *testing.T) { 321 chainConfig := ¶ms.ChainConfig{ 322 HomesteadBlock: new(big.Int), 323 } 324 325 fn := filepath.Join(stateTestDir, "Homestead", "stLogTests.json") 326 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 327 t.Error(err) 328 } 329 } 330 331 func TestHomesteadStateTransaction(t *testing.T) { 332 chainConfig := ¶ms.ChainConfig{ 333 HomesteadBlock: new(big.Int), 334 } 335 336 fn := filepath.Join(stateTestDir, "Homestead", "stTransactionTest.json") 337 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 338 t.Error(err) 339 } 340 } 341 342 func TestHomesteadCallCreateCallCode(t *testing.T) { 343 chainConfig := ¶ms.ChainConfig{ 344 HomesteadBlock: new(big.Int), 345 } 346 347 fn := filepath.Join(stateTestDir, "Homestead", "stCallCreateCallCodeTest.json") 348 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 349 t.Error(err) 350 } 351 } 352 353 func TestHomesteadCallCodes(t *testing.T) { 354 chainConfig := ¶ms.ChainConfig{ 355 HomesteadBlock: new(big.Int), 356 } 357 358 fn := filepath.Join(stateTestDir, "Homestead", "stCallCodes.json") 359 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 360 t.Error(err) 361 } 362 } 363 364 func TestHomesteadMemory(t *testing.T) { 365 chainConfig := ¶ms.ChainConfig{ 366 HomesteadBlock: new(big.Int), 367 } 368 369 fn := filepath.Join(stateTestDir, "Homestead", "stMemoryTest.json") 370 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 371 t.Error(err) 372 } 373 } 374 375 func TestHomesteadMemoryStress(t *testing.T) { 376 chainConfig := ¶ms.ChainConfig{ 377 HomesteadBlock: new(big.Int), 378 } 379 380 if os.Getenv("TEST_VM_COMPLEX") == "" { 381 t.Skip() 382 } 383 fn := filepath.Join(stateTestDir, "Homestead", "stMemoryStressTest.json") 384 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 385 t.Error(err) 386 } 387 } 388 389 func TestHomesteadQuadraticComplexity(t *testing.T) { 390 chainConfig := ¶ms.ChainConfig{ 391 HomesteadBlock: new(big.Int), 392 } 393 394 if os.Getenv("TEST_VM_COMPLEX") == "" { 395 t.Skip() 396 } 397 fn := filepath.Join(stateTestDir, "Homestead", "stQuadraticComplexityTest.json") 398 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 399 t.Error(err) 400 } 401 } 402 403 func TestHomesteadWallet(t *testing.T) { 404 chainConfig := ¶ms.ChainConfig{ 405 HomesteadBlock: new(big.Int), 406 } 407 408 fn := filepath.Join(stateTestDir, "Homestead", "stWalletTest.json") 409 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 410 t.Error(err) 411 } 412 } 413 414 func TestHomesteadDelegateCodes(t *testing.T) { 415 chainConfig := ¶ms.ChainConfig{ 416 HomesteadBlock: new(big.Int), 417 } 418 419 fn := filepath.Join(stateTestDir, "Homestead", "stCallDelegateCodes.json") 420 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 421 t.Error(err) 422 } 423 } 424 425 func TestHomesteadDelegateCodesCallCode(t *testing.T) { 426 chainConfig := ¶ms.ChainConfig{ 427 HomesteadBlock: new(big.Int), 428 } 429 430 fn := filepath.Join(stateTestDir, "Homestead", "stCallDelegateCodesCallCode.json") 431 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 432 t.Error(err) 433 } 434 } 435 436 func TestHomesteadBounds(t *testing.T) { 437 chainConfig := ¶ms.ChainConfig{ 438 HomesteadBlock: new(big.Int), 439 } 440 441 fn := filepath.Join(stateTestDir, "Homestead", "stBoundsTest.json") 442 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 443 t.Error(err) 444 } 445 } 446 447 // EIP150 tests 448 func TestEIP150Specific(t *testing.T) { 449 chainConfig := ¶ms.ChainConfig{ 450 HomesteadBlock: new(big.Int), 451 EIP150Block: big.NewInt(2457000), 452 } 453 454 fn := filepath.Join(stateTestDir, "EIP150", "stEIPSpecificTest.json") 455 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 456 t.Error(err) 457 } 458 } 459 460 func TestEIP150SingleCodeGasPrice(t *testing.T) { 461 chainConfig := ¶ms.ChainConfig{ 462 HomesteadBlock: new(big.Int), 463 EIP150Block: big.NewInt(2457000), 464 } 465 466 fn := filepath.Join(stateTestDir, "EIP150", "stEIPSingleCodeGasPrices.json") 467 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 468 t.Error(err) 469 } 470 } 471 472 func TestEIP150MemExpandingCalls(t *testing.T) { 473 chainConfig := ¶ms.ChainConfig{ 474 HomesteadBlock: new(big.Int), 475 EIP150Block: big.NewInt(2457000), 476 } 477 478 fn := filepath.Join(stateTestDir, "EIP150", "stMemExpandingEIPCalls.json") 479 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 480 t.Error(err) 481 } 482 } 483 484 func TestEIP150HomesteadStateSystemOperations(t *testing.T) { 485 chainConfig := ¶ms.ChainConfig{ 486 HomesteadBlock: new(big.Int), 487 EIP150Block: big.NewInt(2457000), 488 } 489 490 fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stSystemOperationsTest.json") 491 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 492 t.Error(err) 493 } 494 } 495 496 func TestEIP150HomesteadStatePreCompiledContracts(t *testing.T) { 497 chainConfig := ¶ms.ChainConfig{ 498 HomesteadBlock: new(big.Int), 499 EIP150Block: big.NewInt(2457000), 500 } 501 502 fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stPreCompiledContracts.json") 503 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 504 t.Error(err) 505 } 506 } 507 508 func TestEIP150HomesteadStateRecursiveCreate(t *testing.T) { 509 chainConfig := ¶ms.ChainConfig{ 510 HomesteadBlock: new(big.Int), 511 EIP150Block: big.NewInt(2457000), 512 } 513 514 fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stSpecialTest.json") 515 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 516 t.Error(err) 517 } 518 } 519 520 func TestEIP150HomesteadStateRefund(t *testing.T) { 521 chainConfig := ¶ms.ChainConfig{ 522 HomesteadBlock: new(big.Int), 523 EIP150Block: big.NewInt(2457000), 524 } 525 526 fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stRefundTest.json") 527 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 528 t.Error(err) 529 } 530 } 531 532 func TestEIP150HomesteadStateInitCode(t *testing.T) { 533 chainConfig := ¶ms.ChainConfig{ 534 HomesteadBlock: new(big.Int), 535 EIP150Block: big.NewInt(2457000), 536 } 537 538 fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stInitCodeTest.json") 539 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 540 t.Error(err) 541 } 542 } 543 544 func TestEIP150HomesteadStateLog(t *testing.T) { 545 chainConfig := ¶ms.ChainConfig{ 546 HomesteadBlock: new(big.Int), 547 EIP150Block: big.NewInt(2457000), 548 } 549 550 fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stLogTests.json") 551 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 552 t.Error(err) 553 } 554 } 555 556 func TestEIP150HomesteadStateTransaction(t *testing.T) { 557 chainConfig := ¶ms.ChainConfig{ 558 HomesteadBlock: new(big.Int), 559 EIP150Block: big.NewInt(2457000), 560 } 561 562 fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stTransactionTest.json") 563 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 564 t.Error(err) 565 } 566 } 567 568 func TestEIP150HomesteadCallCreateCallCode(t *testing.T) { 569 chainConfig := ¶ms.ChainConfig{ 570 HomesteadBlock: new(big.Int), 571 EIP150Block: big.NewInt(2457000), 572 } 573 574 fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stCallCreateCallCodeTest.json") 575 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 576 t.Error(err) 577 } 578 } 579 580 func TestEIP150HomesteadCallCodes(t *testing.T) { 581 chainConfig := ¶ms.ChainConfig{ 582 HomesteadBlock: new(big.Int), 583 EIP150Block: big.NewInt(2457000), 584 } 585 586 fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stCallCodes.json") 587 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 588 t.Error(err) 589 } 590 } 591 592 func TestEIP150HomesteadMemory(t *testing.T) { 593 chainConfig := ¶ms.ChainConfig{ 594 HomesteadBlock: new(big.Int), 595 EIP150Block: big.NewInt(2457000), 596 } 597 598 fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stMemoryTest.json") 599 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 600 t.Error(err) 601 } 602 } 603 604 func TestEIP150HomesteadMemoryStress(t *testing.T) { 605 chainConfig := ¶ms.ChainConfig{ 606 HomesteadBlock: new(big.Int), 607 EIP150Block: big.NewInt(2457000), 608 } 609 610 if os.Getenv("TEST_VM_COMPLEX") == "" { 611 t.Skip() 612 } 613 fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stMemoryStressTest.json") 614 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 615 t.Error(err) 616 } 617 } 618 619 func TestEIP150HomesteadQuadraticComplexity(t *testing.T) { 620 chainConfig := ¶ms.ChainConfig{ 621 HomesteadBlock: new(big.Int), 622 EIP150Block: big.NewInt(2457000), 623 } 624 625 if os.Getenv("TEST_VM_COMPLEX") == "" { 626 t.Skip() 627 } 628 fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stQuadraticComplexityTest.json") 629 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 630 t.Error(err) 631 } 632 } 633 634 func TestEIP150HomesteadWallet(t *testing.T) { 635 chainConfig := ¶ms.ChainConfig{ 636 HomesteadBlock: new(big.Int), 637 EIP150Block: big.NewInt(2457000), 638 } 639 640 fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stWalletTest.json") 641 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 642 t.Error(err) 643 } 644 } 645 646 func TestEIP150HomesteadDelegateCodes(t *testing.T) { 647 chainConfig := ¶ms.ChainConfig{ 648 HomesteadBlock: new(big.Int), 649 EIP150Block: big.NewInt(2457000), 650 } 651 652 fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stCallDelegateCodes.json") 653 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 654 t.Error(err) 655 } 656 } 657 658 func TestEIP150HomesteadDelegateCodesCallCode(t *testing.T) { 659 chainConfig := ¶ms.ChainConfig{ 660 HomesteadBlock: new(big.Int), 661 EIP150Block: big.NewInt(2457000), 662 } 663 664 fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stCallDelegateCodesCallCode.json") 665 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 666 t.Error(err) 667 } 668 } 669 670 func TestEIP150HomesteadBounds(t *testing.T) { 671 chainConfig := ¶ms.ChainConfig{ 672 HomesteadBlock: new(big.Int), 673 EIP150Block: big.NewInt(2457000), 674 } 675 676 fn := filepath.Join(stateTestDir, "EIP150", "Homestead", "stBoundsTest.json") 677 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 678 t.Error(err) 679 } 680 } 681 682 // EIP158 tests 683 func TestEIP158Create(t *testing.T) { 684 chainConfig := ¶ms.ChainConfig{ 685 HomesteadBlock: new(big.Int), 686 EIP150Block: big.NewInt(2457000), 687 EIP158Block: params.MainNetSpuriousDragon, 688 } 689 690 fn := filepath.Join(stateTestDir, "EIP158", "stCreateTest.json") 691 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 692 t.Error(err) 693 } 694 } 695 696 func TestEIP158Specific(t *testing.T) { 697 chainConfig := ¶ms.ChainConfig{ 698 HomesteadBlock: new(big.Int), 699 EIP150Block: big.NewInt(2457000), 700 EIP158Block: params.MainNetSpuriousDragon, 701 } 702 703 fn := filepath.Join(stateTestDir, "EIP158", "stEIP158SpecificTest.json") 704 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 705 t.Error(err) 706 } 707 } 708 709 func TestEIP158NonZeroCalls(t *testing.T) { 710 chainConfig := ¶ms.ChainConfig{ 711 HomesteadBlock: new(big.Int), 712 EIP150Block: big.NewInt(2457000), 713 EIP158Block: params.MainNetSpuriousDragon, 714 } 715 716 fn := filepath.Join(stateTestDir, "EIP158", "stNonZeroCallsTest.json") 717 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 718 t.Error(err) 719 } 720 } 721 722 func TestEIP158ZeroCalls(t *testing.T) { 723 chainConfig := ¶ms.ChainConfig{ 724 HomesteadBlock: new(big.Int), 725 EIP150Block: big.NewInt(2457000), 726 EIP158Block: params.MainNetSpuriousDragon, 727 } 728 729 fn := filepath.Join(stateTestDir, "EIP158", "stZeroCallsTest.json") 730 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 731 t.Error(err) 732 } 733 } 734 735 func TestEIP158_150Specific(t *testing.T) { 736 chainConfig := ¶ms.ChainConfig{ 737 HomesteadBlock: new(big.Int), 738 EIP150Block: big.NewInt(2457000), 739 EIP158Block: params.MainNetSpuriousDragon, 740 } 741 742 fn := filepath.Join(stateTestDir, "EIP158", "EIP150", "stEIPSpecificTest.json") 743 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 744 t.Error(err) 745 } 746 } 747 748 func TestEIP158_150SingleCodeGasPrice(t *testing.T) { 749 chainConfig := ¶ms.ChainConfig{ 750 HomesteadBlock: new(big.Int), 751 EIP150Block: big.NewInt(2457000), 752 EIP158Block: params.MainNetSpuriousDragon, 753 } 754 755 fn := filepath.Join(stateTestDir, "EIP158", "EIP150", "stEIPsingleCodeGasPrices.json") 756 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 757 t.Error(err) 758 } 759 } 760 761 func TestEIP158_150MemExpandingCalls(t *testing.T) { 762 chainConfig := ¶ms.ChainConfig{ 763 HomesteadBlock: new(big.Int), 764 EIP150Block: big.NewInt(2457000), 765 EIP158Block: params.MainNetSpuriousDragon, 766 } 767 768 fn := filepath.Join(stateTestDir, "EIP158", "EIP150", "stMemExpandingEIPCalls.json") 769 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 770 t.Error(err) 771 } 772 } 773 774 func TestEIP158HomesteadStateSystemOperations(t *testing.T) { 775 chainConfig := ¶ms.ChainConfig{ 776 HomesteadBlock: new(big.Int), 777 EIP150Block: big.NewInt(2457000), 778 EIP158Block: params.MainNetSpuriousDragon, 779 } 780 781 fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stSystemOperationsTest.json") 782 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 783 t.Error(err) 784 } 785 } 786 787 func TestEIP158HomesteadStatePreCompiledContracts(t *testing.T) { 788 chainConfig := ¶ms.ChainConfig{ 789 HomesteadBlock: new(big.Int), 790 EIP150Block: big.NewInt(2457000), 791 EIP158Block: params.MainNetSpuriousDragon, 792 } 793 794 fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stPreCompiledContracts.json") 795 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 796 t.Error(err) 797 } 798 } 799 800 func TestEIP158HomesteadStateRecursiveCreate(t *testing.T) { 801 chainConfig := ¶ms.ChainConfig{ 802 HomesteadBlock: new(big.Int), 803 EIP150Block: big.NewInt(2457000), 804 EIP158Block: params.MainNetSpuriousDragon, 805 } 806 807 fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stSpecialTest.json") 808 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 809 t.Error(err) 810 } 811 } 812 813 func TestEIP158HomesteadStateRefund(t *testing.T) { 814 chainConfig := ¶ms.ChainConfig{ 815 HomesteadBlock: new(big.Int), 816 EIP150Block: big.NewInt(2457000), 817 EIP158Block: params.MainNetSpuriousDragon, 818 } 819 820 fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stRefundTest.json") 821 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 822 t.Error(err) 823 } 824 } 825 826 func TestEIP158HomesteadStateInitCode(t *testing.T) { 827 chainConfig := ¶ms.ChainConfig{ 828 HomesteadBlock: new(big.Int), 829 EIP150Block: big.NewInt(2457000), 830 EIP158Block: params.MainNetSpuriousDragon, 831 } 832 833 fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stInitCodeTest.json") 834 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 835 t.Error(err) 836 } 837 } 838 839 func TestEIP158HomesteadStateLog(t *testing.T) { 840 chainConfig := ¶ms.ChainConfig{ 841 HomesteadBlock: new(big.Int), 842 EIP150Block: big.NewInt(2457000), 843 EIP158Block: params.MainNetSpuriousDragon, 844 } 845 846 fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stLogTests.json") 847 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 848 t.Error(err) 849 } 850 } 851 852 func TestEIP158HomesteadStateTransaction(t *testing.T) { 853 chainConfig := ¶ms.ChainConfig{ 854 HomesteadBlock: new(big.Int), 855 EIP150Block: big.NewInt(2457000), 856 EIP158Block: params.MainNetSpuriousDragon, 857 } 858 859 fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stTransactionTest.json") 860 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 861 t.Error(err) 862 } 863 } 864 865 func TestEIP158HomesteadCallCreateCallCode(t *testing.T) { 866 chainConfig := ¶ms.ChainConfig{ 867 HomesteadBlock: new(big.Int), 868 EIP150Block: big.NewInt(2457000), 869 EIP158Block: params.MainNetSpuriousDragon, 870 } 871 872 fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stCallCreateCallCodeTest.json") 873 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 874 t.Error(err) 875 } 876 } 877 878 func TestEIP158HomesteadCallCodes(t *testing.T) { 879 chainConfig := ¶ms.ChainConfig{ 880 HomesteadBlock: new(big.Int), 881 EIP150Block: big.NewInt(2457000), 882 EIP158Block: params.MainNetSpuriousDragon, 883 } 884 885 fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stCallCodes.json") 886 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 887 t.Error(err) 888 } 889 } 890 891 func TestEIP158HomesteadMemory(t *testing.T) { 892 chainConfig := ¶ms.ChainConfig{ 893 HomesteadBlock: new(big.Int), 894 EIP150Block: big.NewInt(2457000), 895 EIP158Block: params.MainNetSpuriousDragon, 896 } 897 898 fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stMemoryTest.json") 899 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 900 t.Error(err) 901 } 902 } 903 904 func TestEIP158HomesteadMemoryStress(t *testing.T) { 905 chainConfig := ¶ms.ChainConfig{ 906 HomesteadBlock: new(big.Int), 907 EIP150Block: big.NewInt(2457000), 908 EIP158Block: params.MainNetSpuriousDragon, 909 } 910 911 if os.Getenv("TEST_VM_COMPLEX") == "" { 912 t.Skip() 913 } 914 fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stMemoryStressTest.json") 915 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 916 t.Error(err) 917 } 918 } 919 920 func TestEIP158HomesteadQuadraticComplexity(t *testing.T) { 921 chainConfig := ¶ms.ChainConfig{ 922 HomesteadBlock: new(big.Int), 923 EIP150Block: big.NewInt(2457000), 924 EIP158Block: params.MainNetSpuriousDragon, 925 } 926 927 if os.Getenv("TEST_VM_COMPLEX") == "" { 928 t.Skip() 929 } 930 fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stQuadraticComplexityTest.json") 931 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 932 t.Error(err) 933 } 934 } 935 936 func TestEIP158HomesteadWallet(t *testing.T) { 937 chainConfig := ¶ms.ChainConfig{ 938 HomesteadBlock: new(big.Int), 939 EIP150Block: big.NewInt(2457000), 940 EIP158Block: params.MainNetSpuriousDragon, 941 } 942 943 fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stWalletTest.json") 944 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 945 t.Error(err) 946 } 947 } 948 949 func TestEIP158HomesteadDelegateCodes(t *testing.T) { 950 chainConfig := ¶ms.ChainConfig{ 951 HomesteadBlock: new(big.Int), 952 EIP150Block: big.NewInt(2457000), 953 EIP158Block: params.MainNetSpuriousDragon, 954 } 955 956 fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stCallDelegateCodes.json") 957 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 958 t.Error(err) 959 } 960 } 961 962 func TestEIP158HomesteadDelegateCodesCallCode(t *testing.T) { 963 chainConfig := ¶ms.ChainConfig{ 964 HomesteadBlock: new(big.Int), 965 EIP150Block: big.NewInt(2457000), 966 EIP158Block: params.MainNetSpuriousDragon, 967 } 968 969 fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stCallDelegateCodesCallCode.json") 970 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 971 t.Error(err) 972 } 973 } 974 975 func TestEIP158HomesteadBounds(t *testing.T) { 976 chainConfig := ¶ms.ChainConfig{ 977 HomesteadBlock: new(big.Int), 978 EIP150Block: big.NewInt(2457000), 979 EIP158Block: params.MainNetSpuriousDragon, 980 } 981 982 fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stBoundsTest.json") 983 if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { 984 t.Error(err) 985 } 986 }