17
17
package tests
18
18
19
19
import (
20
+ "math/big"
20
21
"path/filepath"
21
22
"testing"
23
+
24
+ "github.com/ethereum/go-ethereum/params"
22
25
)
23
26
24
27
func TestBcValidBlockTests (t * testing.T ) {
28
+ params .HomesteadBlock = big .NewInt (1000000 )
25
29
err := RunBlockTest (filepath .Join (blockTestDir , "bcValidBlockTest.json" ), BlockSkipTests )
26
30
if err != nil {
27
31
t .Fatal (err )
28
32
}
29
33
}
30
34
31
35
func TestBcUncleHeaderValidityTests (t * testing.T ) {
36
+ params .HomesteadBlock = big .NewInt (1000000 )
32
37
err := RunBlockTest (filepath .Join (blockTestDir , "bcUncleHeaderValiditiy.json" ), BlockSkipTests )
33
38
if err != nil {
34
39
t .Fatal (err )
35
40
}
36
41
}
37
42
38
43
func TestBcUncleTests (t * testing.T ) {
44
+ params .HomesteadBlock = big .NewInt (1000000 )
39
45
err := RunBlockTest (filepath .Join (blockTestDir , "bcUncleTest.json" ), BlockSkipTests )
40
46
if err != nil {
41
47
t .Fatal (err )
42
48
}
43
49
}
44
50
45
51
func TestBcForkUncleTests (t * testing.T ) {
52
+ params .HomesteadBlock = big .NewInt (1000000 )
46
53
err := RunBlockTest (filepath .Join (blockTestDir , "bcForkUncle.json" ), BlockSkipTests )
47
54
if err != nil {
48
55
t .Fatal (err )
49
56
}
50
57
}
51
58
52
59
func TestBcInvalidHeaderTests (t * testing.T ) {
60
+ params .HomesteadBlock = big .NewInt (1000000 )
53
61
err := RunBlockTest (filepath .Join (blockTestDir , "bcInvalidHeaderTest.json" ), BlockSkipTests )
54
62
if err != nil {
55
63
t .Fatal (err )
56
64
}
57
65
}
58
66
59
67
func TestBcInvalidRLPTests (t * testing.T ) {
68
+ params .HomesteadBlock = big .NewInt (1000000 )
60
69
err := RunBlockTest (filepath .Join (blockTestDir , "bcInvalidRLPTest.json" ), BlockSkipTests )
61
70
if err != nil {
62
71
t .Fatal (err )
63
72
}
64
73
}
65
74
66
75
func TestBcRPCAPITests (t * testing.T ) {
76
+ params .HomesteadBlock = big .NewInt (1000000 )
67
77
err := RunBlockTest (filepath .Join (blockTestDir , "bcRPC_API_Test.json" ), BlockSkipTests )
68
78
if err != nil {
69
79
t .Fatal (err )
70
80
}
71
81
}
72
82
73
83
func TestBcForkBlockTests (t * testing.T ) {
84
+ params .HomesteadBlock = big .NewInt (1000000 )
74
85
err := RunBlockTest (filepath .Join (blockTestDir , "bcForkBlockTest.json" ), BlockSkipTests )
75
86
if err != nil {
76
87
t .Fatal (err )
77
88
}
78
89
}
79
90
80
91
func TestBcForkStress (t * testing.T ) {
92
+ params .HomesteadBlock = big .NewInt (1000000 )
81
93
err := RunBlockTest (filepath .Join (blockTestDir , "bcForkStressTest.json" ), BlockSkipTests )
82
94
if err != nil {
83
95
t .Fatal (err )
84
96
}
85
97
}
86
98
87
99
func TestBcTotalDifficulty (t * testing.T ) {
100
+ // skip because these will fail due to selfish mining fix
101
+ t .Skip ()
102
+
103
+ params .HomesteadBlock = big .NewInt (1000000 )
88
104
err := RunBlockTest (filepath .Join (blockTestDir , "bcTotalDifficultyTest.json" ), BlockSkipTests )
89
105
if err != nil {
90
106
t .Fatal (err )
91
107
}
92
108
}
93
109
94
110
func TestBcWallet (t * testing.T ) {
111
+ params .HomesteadBlock = big .NewInt (1000000 )
95
112
err := RunBlockTest (filepath .Join (blockTestDir , "bcWalletTest.json" ), BlockSkipTests )
96
113
if err != nil {
97
114
t .Fatal (err )
98
115
}
99
116
}
100
117
101
118
func TestBcGasPricer (t * testing.T ) {
119
+ params .HomesteadBlock = big .NewInt (1000000 )
102
120
err := RunBlockTest (filepath .Join (blockTestDir , "bcGasPricerTest.json" ), BlockSkipTests )
103
121
if err != nil {
104
122
t .Fatal (err )
@@ -107,22 +125,117 @@ func TestBcGasPricer(t *testing.T) {
107
125
108
126
// TODO: iterate over files once we got more than a few
109
127
func TestBcRandom (t * testing.T ) {
128
+ params .HomesteadBlock = big .NewInt (1000000 )
110
129
err := RunBlockTest (filepath .Join (blockTestDir , "RandomTests/bl201507071825GO.json" ), BlockSkipTests )
111
130
if err != nil {
112
131
t .Fatal (err )
113
132
}
114
133
}
115
134
116
135
func TestBcMultiChain (t * testing.T ) {
136
+ // skip due to selfish mining
137
+ t .Skip ()
138
+
139
+ params .HomesteadBlock = big .NewInt (1000000 )
117
140
err := RunBlockTest (filepath .Join (blockTestDir , "bcMultiChainTest.json" ), BlockSkipTests )
118
141
if err != nil {
119
142
t .Fatal (err )
120
143
}
121
144
}
122
145
123
146
func TestBcState (t * testing.T ) {
147
+ params .HomesteadBlock = big .NewInt (1000000 )
124
148
err := RunBlockTest (filepath .Join (blockTestDir , "bcStateTest.json" ), BlockSkipTests )
125
149
if err != nil {
126
150
t .Fatal (err )
127
151
}
128
152
}
153
+
154
+ // Homestead tests
155
+ func TestHomesteadBcValidBlockTests (t * testing.T ) {
156
+ params .HomesteadBlock = big .NewInt (0 )
157
+ err := RunBlockTest (filepath .Join (blockTestDir , "Homestead" , "bcValidBlockTest.json" ), BlockSkipTests )
158
+ if err != nil {
159
+ t .Fatal (err )
160
+ }
161
+ }
162
+
163
+ func TestHomesteadBcUncleHeaderValidityTests (t * testing.T ) {
164
+ params .HomesteadBlock = big .NewInt (0 )
165
+ err := RunBlockTest (filepath .Join (blockTestDir , "Homestead" , "bcUncleHeaderValiditiy.json" ), BlockSkipTests )
166
+ if err != nil {
167
+ t .Fatal (err )
168
+ }
169
+ }
170
+
171
+ func TestHomesteadBcUncleTests (t * testing.T ) {
172
+ params .HomesteadBlock = big .NewInt (0 )
173
+ err := RunBlockTest (filepath .Join (blockTestDir , "Homestead" , "bcUncleTest.json" ), BlockSkipTests )
174
+ if err != nil {
175
+ t .Fatal (err )
176
+ }
177
+ }
178
+
179
+ func TestHomesteadBcInvalidHeaderTests (t * testing.T ) {
180
+ params .HomesteadBlock = big .NewInt (0 )
181
+ err := RunBlockTest (filepath .Join (blockTestDir , "Homestead" , "bcInvalidHeaderTest.json" ), BlockSkipTests )
182
+ if err != nil {
183
+ t .Fatal (err )
184
+ }
185
+ }
186
+
187
+ func TestHomesteadBcRPCAPITests (t * testing.T ) {
188
+ params .HomesteadBlock = big .NewInt (0 )
189
+ err := RunBlockTest (filepath .Join (blockTestDir , "Homestead" , "bcRPC_API_Test.json" ), BlockSkipTests )
190
+ if err != nil {
191
+ t .Fatal (err )
192
+ }
193
+ }
194
+
195
+ func TestHomesteadBcForkStress (t * testing.T ) {
196
+ params .HomesteadBlock = big .NewInt (0 )
197
+ err := RunBlockTest (filepath .Join (blockTestDir , "Homestead" , "bcForkStressTest.json" ), BlockSkipTests )
198
+ if err != nil {
199
+ t .Fatal (err )
200
+ }
201
+ }
202
+
203
+ func TestHomesteadBcTotalDifficulty (t * testing.T ) {
204
+ params .HomesteadBlock = big .NewInt (0 )
205
+ err := RunBlockTest (filepath .Join (blockTestDir , "Homestead" , "bcTotalDifficultyTest.json" ), BlockSkipTests )
206
+ if err != nil {
207
+ t .Fatal (err )
208
+ }
209
+ }
210
+
211
+ func TestHomesteadBcWallet (t * testing.T ) {
212
+ params .HomesteadBlock = big .NewInt (0 )
213
+ err := RunBlockTest (filepath .Join (blockTestDir , "Homestead" , "bcWalletTest.json" ), BlockSkipTests )
214
+ if err != nil {
215
+ t .Fatal (err )
216
+ }
217
+ }
218
+
219
+ func TestHomesteadBcGasPricer (t * testing.T ) {
220
+ params .HomesteadBlock = big .NewInt (0 )
221
+ err := RunBlockTest (filepath .Join (blockTestDir , "Homestead" , "bcGasPricerTest.json" ), BlockSkipTests )
222
+ if err != nil {
223
+ t .Fatal (err )
224
+ }
225
+ }
226
+
227
+ func TestHomesteadBcMultiChain (t * testing.T ) {
228
+ params .HomesteadBlock = big .NewInt (0 )
229
+ err := RunBlockTest (filepath .Join (blockTestDir , "Homestead" , "bcMultiChainTest.json" ), BlockSkipTests )
230
+ if err != nil {
231
+ t .Fatal (err )
232
+ }
233
+ }
234
+
235
+ func TestHomesteadBcState (t * testing.T ) {
236
+ params .HomesteadBlock = big .NewInt (0 )
237
+ err := RunBlockTest (filepath .Join (blockTestDir , "Homestead" , "bcStateTest.json" ), BlockSkipTests )
238
+ if err != nil {
239
+ t .Fatal (err )
240
+ }
241
+ }
0 commit comments