From dbb03fe9893dd19f6b1de1ee3b768317f22fd135 Mon Sep 17 00:00:00 2001
From: Martin Holst Swende <martin@swende.se>
Date: Thu, 15 Aug 2019 14:59:46 +0200
Subject: tests: update from ethereum/tests (#19945)

---
 tests/block_test.go | 33 +++++++++++++++++----------------
 tests/init.go       | 10 ++++++++++
 tests/state_test.go | 12 ++++++------
 tests/testdata      |  2 +-
 4 files changed, 34 insertions(+), 23 deletions(-)

(limited to 'tests')

diff --git a/tests/block_test.go b/tests/block_test.go
index 711a3f869..33eaed1e1 100644
--- a/tests/block_test.go
+++ b/tests/block_test.go
@@ -25,24 +25,25 @@ func TestBlockchain(t *testing.T) {
 
 	bt := new(testMatcher)
 	// General state tests are 'exported' as blockchain tests, but we can run them natively.
-	bt.skipLoad(`^GeneralStateTests/`)
+	bt.skipLoad(`^ValidBlocks/bcStateTests/`)
 	// Skip random failures due to selfish mining test.
-	bt.skipLoad(`^bcForgedTest/bcForkUncle\.json`)
-	bt.skipLoad(`^bcMultiChainTest/(ChainAtoChainB_blockorder|CallContractFromNotBestBlock)`)
-	bt.skipLoad(`^bcTotalDifficultyTest/(lotsOfLeafs|lotsOfBranches|sideChainWithMoreTransactions)`)
-	// Slow tests
-	bt.slow(`^bcExploitTest/DelegateCallSpam.json`)
-	bt.slow(`^bcExploitTest/ShanghaiLove.json`)
-	bt.slow(`^bcExploitTest/SuicideIssue.json`)
-	bt.slow(`^bcForkStressTest/`)
-	bt.slow(`^bcGasPricerTest/RPC_API_Test.json`)
-	bt.slow(`^bcWalletTest/`)
+	bt.skipLoad(`.*bcForgedTest/bcForkUncle\.json`)
+	bt.skipLoad(`.*bcMultiChainTest/(ChainAtoChainB_blockorder|CallContractFromNotBestBlock)`)
+	bt.skipLoad(`.*bcTotalDifficultyTest/(lotsOfLeafs|lotsOfBranches|sideChainWithMoreTransactions)`)
+
+	// These are not formatted like the rest -- due to the large postState, the postState
+	// was replaced by a hash, instead of a genesisAlloc map
+	// See https://github.com/ethereum/tests/pull/616
+	bt.skipLoad(`.*bcExploitTest/ShanghaiLove.json`)
+	bt.skipLoad(`.*bcExploitTest/SuicideIssue.json`)
 
-	// Still failing tests that we need to look into
-	//bt.fails(`^bcStateTests/suicideThenCheckBalance.json/suicideThenCheckBalance_Constantinople`, "TODO: investigate")
-	//bt.fails(`^bcStateTests/suicideStorageCheckVCreate2.json/suicideStorageCheckVCreate2_Constantinople`, "TODO: investigate")
-	//bt.fails(`^bcStateTests/suicideStorageCheckVCreate.json/suicideStorageCheckVCreate_Constantinople`, "TODO: investigate")
-	//bt.fails(`^bcStateTests/suicideStorageCheck.json/suicideStorageCheck_Constantinople`, "TODO: investigate")
+	// Slow tests
+	bt.slow(`.*bcExploitTest/DelegateCallSpam.json`)
+	bt.slow(`.*bcExploitTest/ShanghaiLove.json`)
+	bt.slow(`.*bcExploitTest/SuicideIssue.json`)
+	bt.slow(`.*/bcForkStressTest/`)
+	bt.slow(`.*/bcGasPricerTest/RPC_API_Test.json`)
+	bt.slow(`.*/bcWalletTest/`)
 
 	bt.walk(t, blockTestDir, func(t *testing.T, name string, test *BlockTest) {
 		if err := bt.checkFailure(t, name, test.Run()); err != nil {
diff --git a/tests/init.go b/tests/init.go
index 188cdffe9..f9af5c0ca 100644
--- a/tests/init.go
+++ b/tests/init.go
@@ -107,6 +107,16 @@ var Forks = map[string]*params.ChainConfig{
 		ByzantiumBlock:      big.NewInt(0),
 		ConstantinopleBlock: big.NewInt(5),
 	},
+	"ByzantiumToConstantinopleFixAt5": {
+		ChainID:             big.NewInt(1),
+		HomesteadBlock:      big.NewInt(0),
+		EIP150Block:         big.NewInt(0),
+		EIP155Block:         big.NewInt(0),
+		EIP158Block:         big.NewInt(0),
+		ByzantiumBlock:      big.NewInt(0),
+		ConstantinopleBlock: big.NewInt(5),
+		PetersburgBlock:     big.NewInt(5),
+	},
 }
 
 // UnsupportedForkError is returned when a test requests a fork that isn't implemented.
diff --git a/tests/state_test.go b/tests/state_test.go
index 8b69da91f..0cf124d72 100644
--- a/tests/state_test.go
+++ b/tests/state_test.go
@@ -46,12 +46,12 @@ func TestState(t *testing.T) {
 	st.skipLoad(`^stTransactionTest/OverflowGasRequire\.json`) // gasLimit > 256 bits
 	st.skipLoad(`^stTransactionTest/zeroSigTransa[^/]*\.json`) // EIP-86 is not supported yet
 	// Expected failures:
-	st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Byzantium/0`, "bug in test")
-	st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Byzantium/3`, "bug in test")
-	st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Constantinople/0`, "bug in test")
-	st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Constantinople/3`, "bug in test")
-	st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/ConstantinopleFix/0`, "bug in test")
-	st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/ConstantinopleFix/3`, "bug in test")
+	//st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Byzantium/0`, "bug in test")
+	//st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Byzantium/3`, "bug in test")
+	//st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Constantinople/0`, "bug in test")
+	//st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Constantinople/3`, "bug in test")
+	//st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/ConstantinopleFix/0`, "bug in test")
+	//st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/ConstantinopleFix/3`, "bug in test")
 
 	st.walk(t, stateTestDir, func(t *testing.T, name string, test *StateTest) {
 		for _, subtest := range test.Subtests() {
diff --git a/tests/testdata b/tests/testdata
index 6b85703b5..553c0ea76 160000
--- a/tests/testdata
+++ b/tests/testdata
@@ -1 +1 @@
-Subproject commit 6b85703b568f4456582a00665d8a3e5c3b20b484
+Subproject commit 553c0ea76c739dbb97a8af9fb81c51510bf7493d
-- 
cgit v1.2.3