From 4f4d2b647488eaa056613fa6f026229ac91f066a Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Tue, 19 Jan 2016 23:48:50 +0100 Subject: tests: updated homestead tests --- tests/block_test.go | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) (limited to 'tests/block_test.go') diff --git a/tests/block_test.go b/tests/block_test.go index 827c5ed1d..71dcc4615 100644 --- a/tests/block_test.go +++ b/tests/block_test.go @@ -17,11 +17,15 @@ package tests import ( + "math/big" "path/filepath" "testing" + + "github.com/ethereum/go-ethereum/params" ) func TestBcValidBlockTests(t *testing.T) { + params.HomesteadBlock = big.NewInt(1000000) err := RunBlockTest(filepath.Join(blockTestDir, "bcValidBlockTest.json"), BlockSkipTests) if err != nil { t.Fatal(err) @@ -29,6 +33,7 @@ func TestBcValidBlockTests(t *testing.T) { } func TestBcUncleHeaderValidityTests(t *testing.T) { + params.HomesteadBlock = big.NewInt(1000000) err := RunBlockTest(filepath.Join(blockTestDir, "bcUncleHeaderValiditiy.json"), BlockSkipTests) if err != nil { t.Fatal(err) @@ -36,6 +41,7 @@ func TestBcUncleHeaderValidityTests(t *testing.T) { } func TestBcUncleTests(t *testing.T) { + params.HomesteadBlock = big.NewInt(1000000) err := RunBlockTest(filepath.Join(blockTestDir, "bcUncleTest.json"), BlockSkipTests) if err != nil { t.Fatal(err) @@ -43,6 +49,7 @@ func TestBcUncleTests(t *testing.T) { } func TestBcForkUncleTests(t *testing.T) { + params.HomesteadBlock = big.NewInt(1000000) err := RunBlockTest(filepath.Join(blockTestDir, "bcForkUncle.json"), BlockSkipTests) if err != nil { t.Fatal(err) @@ -50,6 +57,7 @@ func TestBcForkUncleTests(t *testing.T) { } func TestBcInvalidHeaderTests(t *testing.T) { + params.HomesteadBlock = big.NewInt(1000000) err := RunBlockTest(filepath.Join(blockTestDir, "bcInvalidHeaderTest.json"), BlockSkipTests) if err != nil { t.Fatal(err) @@ -57,6 +65,7 @@ func TestBcInvalidHeaderTests(t *testing.T) { } func TestBcInvalidRLPTests(t *testing.T) { + params.HomesteadBlock = big.NewInt(1000000) err := RunBlockTest(filepath.Join(blockTestDir, "bcInvalidRLPTest.json"), BlockSkipTests) if err != nil { t.Fatal(err) @@ -64,6 +73,7 @@ func TestBcInvalidRLPTests(t *testing.T) { } func TestBcRPCAPITests(t *testing.T) { + params.HomesteadBlock = big.NewInt(1000000) err := RunBlockTest(filepath.Join(blockTestDir, "bcRPC_API_Test.json"), BlockSkipTests) if err != nil { t.Fatal(err) @@ -71,6 +81,7 @@ func TestBcRPCAPITests(t *testing.T) { } func TestBcForkBlockTests(t *testing.T) { + params.HomesteadBlock = big.NewInt(1000000) err := RunBlockTest(filepath.Join(blockTestDir, "bcForkBlockTest.json"), BlockSkipTests) if err != nil { t.Fatal(err) @@ -78,6 +89,7 @@ func TestBcForkBlockTests(t *testing.T) { } func TestBcForkStress(t *testing.T) { + params.HomesteadBlock = big.NewInt(1000000) err := RunBlockTest(filepath.Join(blockTestDir, "bcForkStressTest.json"), BlockSkipTests) if err != nil { t.Fatal(err) @@ -85,6 +97,10 @@ func TestBcForkStress(t *testing.T) { } func TestBcTotalDifficulty(t *testing.T) { + // skip because these will fail due to selfish mining fix + t.Skip() + + params.HomesteadBlock = big.NewInt(1000000) err := RunBlockTest(filepath.Join(blockTestDir, "bcTotalDifficultyTest.json"), BlockSkipTests) if err != nil { t.Fatal(err) @@ -92,6 +108,7 @@ func TestBcTotalDifficulty(t *testing.T) { } func TestBcWallet(t *testing.T) { + params.HomesteadBlock = big.NewInt(1000000) err := RunBlockTest(filepath.Join(blockTestDir, "bcWalletTest.json"), BlockSkipTests) if err != nil { t.Fatal(err) @@ -99,6 +116,7 @@ func TestBcWallet(t *testing.T) { } func TestBcGasPricer(t *testing.T) { + params.HomesteadBlock = big.NewInt(1000000) err := RunBlockTest(filepath.Join(blockTestDir, "bcGasPricerTest.json"), BlockSkipTests) if err != nil { t.Fatal(err) @@ -107,6 +125,7 @@ func TestBcGasPricer(t *testing.T) { // TODO: iterate over files once we got more than a few func TestBcRandom(t *testing.T) { + params.HomesteadBlock = big.NewInt(1000000) err := RunBlockTest(filepath.Join(blockTestDir, "RandomTests/bl201507071825GO.json"), BlockSkipTests) if err != nil { t.Fatal(err) @@ -114,6 +133,10 @@ func TestBcRandom(t *testing.T) { } func TestBcMultiChain(t *testing.T) { + // skip due to selfish mining + t.Skip() + + params.HomesteadBlock = big.NewInt(1000000) err := RunBlockTest(filepath.Join(blockTestDir, "bcMultiChainTest.json"), BlockSkipTests) if err != nil { t.Fatal(err) @@ -121,8 +144,98 @@ func TestBcMultiChain(t *testing.T) { } func TestBcState(t *testing.T) { + params.HomesteadBlock = big.NewInt(1000000) err := RunBlockTest(filepath.Join(blockTestDir, "bcStateTest.json"), BlockSkipTests) if err != nil { t.Fatal(err) } } + +// Homestead tests +func TestHomesteadBcValidBlockTests(t *testing.T) { + params.HomesteadBlock = big.NewInt(0) + err := RunBlockTest(filepath.Join(blockTestDir, "Homestead", "bcValidBlockTest.json"), BlockSkipTests) + if err != nil { + t.Fatal(err) + } +} + +func TestHomesteadBcUncleHeaderValidityTests(t *testing.T) { + params.HomesteadBlock = big.NewInt(0) + err := RunBlockTest(filepath.Join(blockTestDir, "Homestead", "bcUncleHeaderValiditiy.json"), BlockSkipTests) + if err != nil { + t.Fatal(err) + } +} + +func TestHomesteadBcUncleTests(t *testing.T) { + params.HomesteadBlock = big.NewInt(0) + err := RunBlockTest(filepath.Join(blockTestDir, "Homestead", "bcUncleTest.json"), BlockSkipTests) + if err != nil { + t.Fatal(err) + } +} + +func TestHomesteadBcInvalidHeaderTests(t *testing.T) { + params.HomesteadBlock = big.NewInt(0) + err := RunBlockTest(filepath.Join(blockTestDir, "Homestead", "bcInvalidHeaderTest.json"), BlockSkipTests) + if err != nil { + t.Fatal(err) + } +} + +func TestHomesteadBcRPCAPITests(t *testing.T) { + params.HomesteadBlock = big.NewInt(0) + err := RunBlockTest(filepath.Join(blockTestDir, "Homestead", "bcRPC_API_Test.json"), BlockSkipTests) + if err != nil { + t.Fatal(err) + } +} + +func TestHomesteadBcForkStress(t *testing.T) { + params.HomesteadBlock = big.NewInt(0) + err := RunBlockTest(filepath.Join(blockTestDir, "Homestead", "bcForkStressTest.json"), BlockSkipTests) + if err != nil { + t.Fatal(err) + } +} + +func TestHomesteadBcTotalDifficulty(t *testing.T) { + params.HomesteadBlock = big.NewInt(0) + err := RunBlockTest(filepath.Join(blockTestDir, "Homestead", "bcTotalDifficultyTest.json"), BlockSkipTests) + if err != nil { + t.Fatal(err) + } +} + +func TestHomesteadBcWallet(t *testing.T) { + params.HomesteadBlock = big.NewInt(0) + err := RunBlockTest(filepath.Join(blockTestDir, "Homestead", "bcWalletTest.json"), BlockSkipTests) + if err != nil { + t.Fatal(err) + } +} + +func TestHomesteadBcGasPricer(t *testing.T) { + params.HomesteadBlock = big.NewInt(0) + err := RunBlockTest(filepath.Join(blockTestDir, "Homestead", "bcGasPricerTest.json"), BlockSkipTests) + if err != nil { + t.Fatal(err) + } +} + +func TestHomesteadBcMultiChain(t *testing.T) { + params.HomesteadBlock = big.NewInt(0) + err := RunBlockTest(filepath.Join(blockTestDir, "Homestead", "bcMultiChainTest.json"), BlockSkipTests) + if err != nil { + t.Fatal(err) + } +} + +func TestHomesteadBcState(t *testing.T) { + params.HomesteadBlock = big.NewInt(0) + err := RunBlockTest(filepath.Join(blockTestDir, "Homestead", "bcStateTest.json"), BlockSkipTests) + if err != nil { + t.Fatal(err) + } +} -- cgit v1.2.3