mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
tests: update tests, implement no-pow blocks
This commit is contained in:
parent
f951e23fb5
commit
ec5cc95039
4 changed files with 28 additions and 26 deletions
|
|
@ -30,8 +30,6 @@ func TestBlockchain(t *testing.T) {
|
|||
bt.skipLoad(`^bcForgedTest/bcForkUncle\.json`)
|
||||
bt.skipLoad(`^bcMultiChainTest/(ChainAtoChainB_blockorder|CallContractFromNotBestBlock)`)
|
||||
bt.skipLoad(`^bcTotalDifficultyTest/(lotsOfLeafs|lotsOfBranches|sideChainWithMoreTransactions)`)
|
||||
// This test is broken
|
||||
bt.fails(`blockhashNonConstArg_Constantinople`, "Broken test")
|
||||
// Slow tests
|
||||
bt.slow(`^bcExploitTest/DelegateCallSpam.json`)
|
||||
bt.slow(`^bcExploitTest/ShanghaiLove.json`)
|
||||
|
|
@ -40,6 +38,14 @@ func TestBlockchain(t *testing.T) {
|
|||
bt.slow(`^bcGasPricerTest/RPC_API_Test.json`)
|
||||
bt.slow(`^bcWalletTest/`)
|
||||
|
||||
|
||||
// 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")
|
||||
|
||||
|
||||
bt.walk(t, blockTestDir, func(t *testing.T, name string, test *BlockTest) {
|
||||
if err := bt.checkFailure(t, name, test.Run()); err != nil {
|
||||
t.Error(err)
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import (
|
|||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/ethereum/go-ethereum/consensus"
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
|
@ -48,12 +49,13 @@ func (t *BlockTest) UnmarshalJSON(in []byte) error {
|
|||
}
|
||||
|
||||
type btJSON struct {
|
||||
Blocks []btBlock `json:"blocks"`
|
||||
Genesis btHeader `json:"genesisBlockHeader"`
|
||||
Pre core.GenesisAlloc `json:"pre"`
|
||||
Post core.GenesisAlloc `json:"postState"`
|
||||
BestBlock common.UnprefixedHash `json:"lastblockhash"`
|
||||
Network string `json:"network"`
|
||||
Blocks []btBlock `json:"blocks"`
|
||||
Genesis btHeader `json:"genesisBlockHeader"`
|
||||
Pre core.GenesisAlloc `json:"pre"`
|
||||
Post core.GenesisAlloc `json:"postState"`
|
||||
BestBlock common.UnprefixedHash `json:"lastblockhash"`
|
||||
Network string `json:"network"`
|
||||
SealEngine string `json:"sealEngine"`
|
||||
}
|
||||
|
||||
type btBlock struct {
|
||||
|
|
@ -110,8 +112,13 @@ func (t *BlockTest) Run() error {
|
|||
if gblock.Root() != t.json.Genesis.StateRoot {
|
||||
return fmt.Errorf("genesis block state root does not match test: computed=%x, test=%x", gblock.Root().Bytes()[:6], t.json.Genesis.StateRoot[:6])
|
||||
}
|
||||
|
||||
chain, err := core.NewBlockChain(db, nil, config, ethash.NewShared(), vm.Config{}, nil)
|
||||
var engine consensus.Engine
|
||||
if t.json.SealEngine == "NoProof" {
|
||||
engine = ethash.NewFaker()
|
||||
} else {
|
||||
engine = ethash.NewShared()
|
||||
}
|
||||
chain, err := core.NewBlockChain(db, nil, config, engine, vm.Config{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,20 +36,6 @@ var (
|
|||
EIP158Block: big.NewInt(2675000),
|
||||
ByzantiumBlock: big.NewInt(4370000),
|
||||
}
|
||||
|
||||
// Ropsten without the Constantinople bump in bomb delay
|
||||
RopstenNoConstantinople = params.ChainConfig{
|
||||
ChainID: big.NewInt(3),
|
||||
HomesteadBlock: big.NewInt(0),
|
||||
DAOForkBlock: nil,
|
||||
DAOForkSupport: true,
|
||||
EIP150Block: big.NewInt(0),
|
||||
EIP150Hash: common.HexToHash("0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d"),
|
||||
EIP155Block: big.NewInt(10),
|
||||
EIP158Block: big.NewInt(10),
|
||||
ByzantiumBlock: big.NewInt(1700000),
|
||||
ConstantinopleBlock: nil,
|
||||
}
|
||||
)
|
||||
|
||||
func TestDifficulty(t *testing.T) {
|
||||
|
|
@ -69,7 +55,7 @@ func TestDifficulty(t *testing.T) {
|
|||
dt.skipLoad("difficultyMorden\\.json")
|
||||
dt.skipLoad("difficultyOlimpic\\.json")
|
||||
|
||||
dt.config("Ropsten", RopstenNoConstantinople)
|
||||
dt.config("Ropsten", *params.TestnetChainConfig)
|
||||
dt.config("Morden", *params.TestnetChainConfig)
|
||||
dt.config("Frontier", params.ChainConfig{})
|
||||
|
||||
|
|
@ -84,6 +70,9 @@ func TestDifficulty(t *testing.T) {
|
|||
dt.config("Frontier", *params.TestnetChainConfig)
|
||||
dt.config("MainNetwork", mainnetChainConfig)
|
||||
dt.config("CustomMainNetwork", mainnetChainConfig)
|
||||
dt.config("Constantinople", params.ChainConfig{
|
||||
ConstantinopleBlock: big.NewInt(0),
|
||||
})
|
||||
dt.config("difficulty.json", mainnetChainConfig)
|
||||
|
||||
dt.walk(t, difficultyTestDir, func(t *testing.T, name string, test *DifficultyTest) {
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit ad2184adca367c0b68c65b44519dba16e1d0b9e2
|
||||
Subproject commit 95a309203890e6244c6d4353ca411671973c13b5
|
||||
Loading…
Reference in a new issue