mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
fix: testcases
This commit is contained in:
parent
4a9a875738
commit
b1419eb41d
6 changed files with 22 additions and 6 deletions
|
|
@ -522,6 +522,11 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis
|
||||||
}
|
}
|
||||||
bc.snaps, _ = snapshot.New(snapconfig, bc.db, bc.triedb, head.Root)
|
bc.snaps, _ = snapshot.New(snapconfig, bc.db, bc.triedb, head.Root)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Start future block processor.
|
||||||
|
// bc.wg.Add(1)
|
||||||
|
// go bc.updateFutureBlocks()
|
||||||
|
|
||||||
// Rewind the chain in case of an incompatible config upgrade.
|
// Rewind the chain in case of an incompatible config upgrade.
|
||||||
if compat, ok := genesisErr.(*params.ConfigCompatError); ok {
|
if compat, ok := genesisErr.(*params.ConfigCompatError); ok {
|
||||||
log.Warn("Rewinding chain to upgrade configuration", "err", compat)
|
log.Warn("Rewinding chain to upgrade configuration", "err", compat)
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ func newTesterWithNotification(t *testing.T, success func()) *downloadTester {
|
||||||
|
|
||||||
gspec := &core.Genesis{
|
gspec := &core.Genesis{
|
||||||
Config: params.TestChainConfig,
|
Config: params.TestChainConfig,
|
||||||
Alloc: core.GenesisAlloc{testAddress: {Balance: big.NewInt(1000000000000000)}},
|
Alloc: types.GenesisAlloc{testAddress: {Balance: big.NewInt(1000000000000000)}},
|
||||||
BaseFee: big.NewInt(params.InitialBaseFee),
|
BaseFee: big.NewInt(params.InitialBaseFee),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ func emptyBlockGenerationFunc(b *core.BlockGen) {}
|
||||||
|
|
||||||
func TestSupplyOmittedFields(t *testing.T) {
|
func TestSupplyOmittedFields(t *testing.T) {
|
||||||
var (
|
var (
|
||||||
config = *params.MergedTestChainConfig
|
config = *params.TestChainConfig
|
||||||
gspec = &core.Genesis{
|
gspec = &core.Genesis{
|
||||||
Config: &config,
|
Config: &config,
|
||||||
}
|
}
|
||||||
|
|
@ -86,7 +86,7 @@ func TestSupplyOmittedFields(t *testing.T) {
|
||||||
|
|
||||||
expected := supplyInfo{
|
expected := supplyInfo{
|
||||||
Number: 0,
|
Number: 0,
|
||||||
Hash: common.HexToHash("0x52f276d96f0afaaf2c3cb358868bdc2779c4b0cb8de3e7e5302e247c0b66a703"),
|
Hash: common.HexToHash("0xadeda0a83e337b6c073e3f0e9a17531a04009b397a9588c093b628f21b8bc5a3"),
|
||||||
ParentHash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
|
ParentHash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
|
||||||
}
|
}
|
||||||
actual := out[expected.Number]
|
actual := out[expected.Number]
|
||||||
|
|
|
||||||
|
|
@ -1856,7 +1856,7 @@ func TestRPCGetBlockOrHeader(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func setupReceiptBackend(t *testing.T, genBlocks int) (*testBackend, []common.Hash) {
|
func setupReceiptBackend(t *testing.T, genBlocks int) (*testBackend, []common.Hash) {
|
||||||
config := *params.MergedTestChainConfig
|
config := *params.TestChainConfig
|
||||||
|
|
||||||
config.ShanghaiBlock = big.NewInt(0)
|
config.ShanghaiBlock = big.NewInt(0)
|
||||||
config.CancunBlock = big.NewInt(0)
|
config.CancunBlock = big.NewInt(0)
|
||||||
|
|
@ -1891,6 +1891,10 @@ func setupReceiptBackend(t *testing.T, genBlocks int) (*testBackend, []common.Ha
|
||||||
txHashes = make([]common.Hash, genBlocks)
|
txHashes = make([]common.Hash, genBlocks)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Set the terminal total difficulty in the config
|
||||||
|
genesis.Config.TerminalTotalDifficulty = big.NewInt(0)
|
||||||
|
genesis.Config.TerminalTotalDifficultyPassed = true
|
||||||
|
|
||||||
backend := newTestBackend(t, genBlocks, genesis, beacon.New(ethash.NewFaker()), func(i int, b *core.BlockGen) {
|
backend := newTestBackend(t, genBlocks, genesis, beacon.New(ethash.NewFaker()), func(i int, b *core.BlockGen) {
|
||||||
var (
|
var (
|
||||||
tx *types.Transaction
|
tx *types.Transaction
|
||||||
|
|
|
||||||
|
|
@ -129,8 +129,8 @@ func TestExpDecaySample(t *testing.T) {
|
||||||
// The priority becomes +Inf quickly after starting if this is done,
|
// The priority becomes +Inf quickly after starting if this is done,
|
||||||
// effectively freezing the set of samples until a rescale step happens.
|
// effectively freezing the set of samples until a rescale step happens.
|
||||||
func TestExpDecaySampleNanosecondRegression(t *testing.T) {
|
func TestExpDecaySampleNanosecondRegression(t *testing.T) {
|
||||||
sw := NewExpDecaySample(1000, 0.99)
|
sw := NewExpDecaySample(100, 0.99)
|
||||||
for i := 0; i < 1000; i++ {
|
for i := 0; i < 100; i++ {
|
||||||
sw.Update(10)
|
sw.Update(10)
|
||||||
}
|
}
|
||||||
time.Sleep(1 * time.Millisecond)
|
time.Sleep(1 * time.Millisecond)
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,12 @@ func TestValidatorsBlockProduction(t *testing.T) {
|
||||||
// Iterate over all the nodes and start mining
|
// Iterate over all the nodes and start mining
|
||||||
time.Sleep(3 * time.Second)
|
time.Sleep(3 * time.Second)
|
||||||
|
|
||||||
|
for _, node := range nodes {
|
||||||
|
if node.PeerCount() == 0 {
|
||||||
|
panic("Node is not connected to any peers")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for _, node := range nodes {
|
for _, node := range nodes {
|
||||||
if err := node.StartMining(); err != nil {
|
if err := node.StartMining(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
@ -117,6 +123,7 @@ func TestValidatorsBlockProduction(t *testing.T) {
|
||||||
// check block 7 miner ; expected author is node0 signer
|
// check block 7 miner ; expected author is node0 signer
|
||||||
blockHeaderVal0 := nodes[0].BlockChain().GetHeaderByNumber(7)
|
blockHeaderVal0 := nodes[0].BlockChain().GetHeaderByNumber(7)
|
||||||
blockHeaderVal1 := nodes[1].BlockChain().GetHeaderByNumber(7)
|
blockHeaderVal1 := nodes[1].BlockChain().GetHeaderByNumber(7)
|
||||||
|
|
||||||
authorVal0, err := nodes[0].Engine().Author(blockHeaderVal0)
|
authorVal0, err := nodes[0].Engine().Author(blockHeaderVal0)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue