Skip to content

Commit

Permalink
fix: testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
anshalshukla committed Aug 13, 2024
1 parent 4a9a875 commit b1419eb
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 6 deletions.
5 changes: 5 additions & 0 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,11 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis
}
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.
if compat, ok := genesisErr.(*params.ConfigCompatError); ok {
log.Warn("Rewinding chain to upgrade configuration", "err", compat)
Expand Down
2 changes: 1 addition & 1 deletion eth/downloader/bor_downloader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func newTesterWithNotification(t *testing.T, success func()) *downloadTester {

gspec := &core.Genesis{
Config: params.TestChainConfig,
Alloc: core.GenesisAlloc{testAddress: {Balance: big.NewInt(1000000000000000)}},
Alloc: types.GenesisAlloc{testAddress: {Balance: big.NewInt(1000000000000000)}},
BaseFee: big.NewInt(params.InitialBaseFee),
}

Expand Down
4 changes: 2 additions & 2 deletions eth/tracers/internal/tracetest/supply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func emptyBlockGenerationFunc(b *core.BlockGen) {}

func TestSupplyOmittedFields(t *testing.T) {
var (
config = *params.MergedTestChainConfig
config = *params.TestChainConfig
gspec = &core.Genesis{
Config: &config,
}
Expand All @@ -86,7 +86,7 @@ func TestSupplyOmittedFields(t *testing.T) {

expected := supplyInfo{
Number: 0,
Hash: common.HexToHash("0x52f276d96f0afaaf2c3cb358868bdc2779c4b0cb8de3e7e5302e247c0b66a703"),
Hash: common.HexToHash("0xadeda0a83e337b6c073e3f0e9a17531a04009b397a9588c093b628f21b8bc5a3"),
ParentHash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
}
actual := out[expected.Number]
Expand Down
6 changes: 5 additions & 1 deletion internal/ethapi/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1856,7 +1856,7 @@ func TestRPCGetBlockOrHeader(t *testing.T) {
}

func setupReceiptBackend(t *testing.T, genBlocks int) (*testBackend, []common.Hash) {
config := *params.MergedTestChainConfig
config := *params.TestChainConfig

config.ShanghaiBlock = big.NewInt(0)
config.CancunBlock = big.NewInt(0)
Expand Down Expand Up @@ -1891,6 +1891,10 @@ func setupReceiptBackend(t *testing.T, genBlocks int) (*testBackend, []common.Ha
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) {
var (
tx *types.Transaction
Expand Down
4 changes: 2 additions & 2 deletions metrics/sample_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ func TestExpDecaySample(t *testing.T) {
// The priority becomes +Inf quickly after starting if this is done,
// effectively freezing the set of samples until a rescale step happens.
func TestExpDecaySampleNanosecondRegression(t *testing.T) {
sw := NewExpDecaySample(1000, 0.99)
for i := 0; i < 1000; i++ {
sw := NewExpDecaySample(100, 0.99)
for i := 0; i < 100; i++ {
sw.Update(10)
}
time.Sleep(1 * time.Millisecond)
Expand Down
7 changes: 7 additions & 0 deletions tests/bor/bor_sprint_length_change_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ func TestValidatorsBlockProduction(t *testing.T) {
// Iterate over all the nodes and start mining
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 {
if err := node.StartMining(); err != nil {
panic(err)
Expand All @@ -117,6 +123,7 @@ func TestValidatorsBlockProduction(t *testing.T) {
// check block 7 miner ; expected author is node0 signer
blockHeaderVal0 := nodes[0].BlockChain().GetHeaderByNumber(7)
blockHeaderVal1 := nodes[1].BlockChain().GetHeaderByNumber(7)

authorVal0, err := nodes[0].Engine().Author(blockHeaderVal0)

if err != nil {
Expand Down

0 comments on commit b1419eb

Please sign in to comment.