Skip to content

Commit e97b301

Browse files
committed
[release/1.4.16] tests: update test files from github.com/ethereum/tests @ 45bc1d21d3c1
Two new tests are skipped because they're buggy. Making some newer random state tests work required implementing the 'compressed return value encoding'. (cherry picked from commit 1b7b2ba)
1 parent 438efda commit e97b301

File tree

746 files changed

+188445
-65642
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

746 files changed

+188445
-65642
lines changed

core/database_util_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func (d *diffTest) UnmarshalJSON(b []byte) (err error) {
6262
return nil
6363
}
6464

65-
func TestDifficultyFrontier(t *testing.T) {
65+
func TestCalcDifficulty(t *testing.T) {
6666
file, err := os.Open("../tests/files/BasicTests/difficulty.json")
6767
if err != nil {
6868
t.Fatal(err)
@@ -75,9 +75,10 @@ func TestDifficultyFrontier(t *testing.T) {
7575
t.Fatal(err)
7676
}
7777

78+
config := &ChainConfig{HomesteadBlock: big.NewInt(1150000)}
7879
for name, test := range tests {
7980
number := new(big.Int).Sub(test.CurrentBlocknumber, big.NewInt(1))
80-
diff := calcDifficultyFrontier(test.CurrentTimestamp, test.ParentTimestamp, number, test.ParentDifficulty)
81+
diff := CalcDifficulty(config, test.CurrentTimestamp, test.ParentTimestamp, number, test.ParentDifficulty)
8182
if diff.Cmp(test.CurrentDifficulty) != 0 {
8283
t.Error(name, "failed. Expected", test.CurrentDifficulty, "and calculated", diff)
8384
}

tests/block_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,3 +219,22 @@ func TestDAOBcTheDao(t *testing.T) {
219219
t.Fatal(err)
220220
}
221221
}
222+
223+
func TestHomesteadBcExploit(t *testing.T) {
224+
err := RunBlockTest(big.NewInt(0), nil, filepath.Join(blockTestDir, "Homestead", "bcExploitTest.json"), BlockSkipTests)
225+
if err != nil {
226+
t.Fatal(err)
227+
}
228+
}
229+
func TestHomesteadBcShanghaiLove(t *testing.T) {
230+
err := RunBlockTest(big.NewInt(0), nil, filepath.Join(blockTestDir, "Homestead", "bcShanghaiLove.json"), BlockSkipTests)
231+
if err != nil {
232+
t.Fatal(err)
233+
}
234+
}
235+
func TestHomesteadBcSuicideIssue(t *testing.T) {
236+
err := RunBlockTest(big.NewInt(0), nil, filepath.Join(blockTestDir, "Homestead", "bcSuicideIssue.json"), BlockSkipTests)
237+
if err != nil {
238+
t.Fatal(err)
239+
}
240+
}

0 commit comments

Comments
 (0)