Skip to content

Commit

Permalink
tests: update from ethereum/tests (ethereum#19945)
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman authored and fjl committed Aug 15, 2019
1 parent 2c50b2c commit dbb03fe
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 23 deletions.
33 changes: 17 additions & 16 deletions tests/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 10 additions & 0 deletions tests/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 6 additions & 6 deletions tests/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion tests/testdata

0 comments on commit dbb03fe

Please sign in to comment.