transaction_test.go 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. "path/filepath"
  20. "testing"
  21. "github.com/ethereum/go-ethereum/params"
  22. )
  23. func TestTransactions(t *testing.T) {
  24. config := &params.ChainConfig{}
  25. err := RunTransactionTests(config, filepath.Join(transactionTestDir, "ttTransactionTest.json"), TransSkipTests)
  26. if err != nil {
  27. t.Fatal(err)
  28. }
  29. }
  30. func TestWrongRLPTransactions(t *testing.T) {
  31. config := &params.ChainConfig{}
  32. err := RunTransactionTests(config, filepath.Join(transactionTestDir, "ttWrongRLPTransaction.json"), TransSkipTests)
  33. if err != nil {
  34. t.Fatal(err)
  35. }
  36. }
  37. func Test10MBTransactions(t *testing.T) {
  38. config := &params.ChainConfig{}
  39. err := RunTransactionTests(config, filepath.Join(transactionTestDir, "tt10mbDataField.json"), TransSkipTests)
  40. if err != nil {
  41. t.Fatal(err)
  42. }
  43. }
  44. // homestead tests
  45. func TestHomesteadTransactions(t *testing.T) {
  46. config := &params.ChainConfig{
  47. HomesteadBlock: big.NewInt(0),
  48. }
  49. err := RunTransactionTests(config, filepath.Join(transactionTestDir, "Homestead", "ttTransactionTest.json"), TransSkipTests)
  50. if err != nil {
  51. t.Fatal(err)
  52. }
  53. }
  54. func TestHomesteadWrongRLPTransactions(t *testing.T) {
  55. config := &params.ChainConfig{
  56. HomesteadBlock: big.NewInt(0),
  57. }
  58. err := RunTransactionTests(config, filepath.Join(transactionTestDir, "Homestead", "ttWrongRLPTransaction.json"), TransSkipTests)
  59. if err != nil {
  60. t.Fatal(err)
  61. }
  62. }
  63. func TestHomestead10MBTransactions(t *testing.T) {
  64. config := &params.ChainConfig{
  65. HomesteadBlock: big.NewInt(0),
  66. }
  67. err := RunTransactionTests(config, filepath.Join(transactionTestDir, "Homestead", "tt10mbDataField.json"), TransSkipTests)
  68. if err != nil {
  69. t.Fatal(err)
  70. }
  71. }
  72. func TestHomesteadVitalik(t *testing.T) {
  73. config := &params.ChainConfig{
  74. HomesteadBlock: big.NewInt(0),
  75. }
  76. err := RunTransactionTests(config, filepath.Join(transactionTestDir, "Homestead", "ttTransactionTestEip155VitaliksTests.json"), TransSkipTests)
  77. if err != nil {
  78. t.Fatal(err)
  79. }
  80. }
  81. func TestTxEIP155Transaction(t *testing.T) {
  82. config := &params.ChainConfig{
  83. ChainId: big.NewInt(1),
  84. HomesteadBlock: big.NewInt(0),
  85. EIP155Block: big.NewInt(0),
  86. }
  87. err := RunTransactionTests(config, filepath.Join(transactionTestDir, "EIP155", "ttTransactionTest.json"), TransSkipTests)
  88. if err != nil {
  89. t.Fatal(err)
  90. }
  91. }
  92. func TestTxEIP155VitaliksTests(t *testing.T) {
  93. config := &params.ChainConfig{
  94. ChainId: big.NewInt(1),
  95. HomesteadBlock: big.NewInt(0),
  96. EIP155Block: big.NewInt(0),
  97. }
  98. err := RunTransactionTests(config, filepath.Join(transactionTestDir, "EIP155", "ttTransactionTestEip155VitaliksTests.json"), TransSkipTests)
  99. if err != nil {
  100. t.Fatal(err)
  101. }
  102. }
  103. func TestTxEIP155VRule(t *testing.T) {
  104. config := &params.ChainConfig{
  105. ChainId: big.NewInt(1),
  106. HomesteadBlock: big.NewInt(0),
  107. EIP155Block: big.NewInt(0),
  108. }
  109. err := RunTransactionTests(config, filepath.Join(transactionTestDir, "EIP155", "ttTransactionTestVRule.json"), TransSkipTests)
  110. if err != nil {
  111. t.Fatal(err)
  112. }
  113. }