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 e6132fd commit 5cda3fe
Show file tree
Hide file tree
Showing 8 changed files with 282 additions and 278 deletions.
2 changes: 1 addition & 1 deletion accounts/abi/bind/backends/simulated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func TestNewSimulatedBackend(t *testing.T) {
func TestAdjustTime(t *testing.T) {
t.Parallel()
sim := NewSimulatedBackend(
core.GenesisAlloc{}, 10000000,
types.GenesisAlloc{}, 10000000,
)
defer sim.Close()

Expand Down
3 changes: 2 additions & 1 deletion common/leak/ignore_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ func IgnoreList() []goleak.Option {
// todo: this leaks should be fixed
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/accounts/abi/bind/backends.nullSubscription.func1"),
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/accounts/abi/bind/backends.(*filterBackend).SubscribeNewTxsEvent.func1"),
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/accounts/abi/bind/backends.(*filterBackend).SubscribePendingLogsEvent.func1"),
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/accounts/abi/bind/backends.(*filterBackend).SubscribePendingLogsEvent.nullSubscription.func1"),
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/consensus/ethash.(*remoteSealer).loop"),
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/core.(*BlockChain).updateFutureBlocks"),
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/core/state/snapshot.(*diskLayer).generate"),
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/core/state.(*subfetcher).loop"),
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/eth/filters.(*EventSystem).eventLoop"),
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/event.NewSubscription.func1"),
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/event.NewSubscription"),
Expand Down
37 changes: 20 additions & 17 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,20 +324,22 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis
log.Info("")

bc := &BlockChain{
chainConfig: chainConfig,
cacheConfig: cacheConfig,
db: db,
triedb: triedb,
triegc: prque.New[int64, common.Hash](nil),
quit: make(chan struct{}),
chainmu: syncx.NewClosableMutex(),
bodyCache: lru.NewCache[common.Hash, *types.Body](bodyCacheLimit),
bodyRLPCache: lru.NewCache[common.Hash, rlp.RawValue](bodyCacheLimit),
receiptsCache: lru.NewCache[common.Hash, []*types.Receipt](receiptsCacheLimit),
blockCache: lru.NewCache[common.Hash, *types.Block](blockCacheLimit),
txLookupCache: lru.NewCache[common.Hash, txLookup](txLookupCacheLimit),
engine: engine,
vmConfig: vmConfig,
chainConfig: chainConfig,
cacheConfig: cacheConfig,
db: db,
triedb: triedb,
triegc: prque.New[int64, common.Hash](nil),
quit: make(chan struct{}),
chainmu: syncx.NewClosableMutex(),
bodyCache: lru.NewCache[common.Hash, *types.Body](bodyCacheLimit),
bodyRLPCache: lru.NewCache[common.Hash, rlp.RawValue](bodyCacheLimit),
receiptsCache: lru.NewCache[common.Hash, []*types.Receipt](receiptsCacheLimit),
blockCache: lru.NewCache[common.Hash, *types.Block](blockCacheLimit),
txLookupCache: lru.NewCache[common.Hash, txLookup](txLookupCacheLimit),
futureBlocks: lru.NewCache[common.Hash, *types.Block](maxFutureBlocks),
engine: engine,
vmConfig: vmConfig,

borReceiptsCache: lru.NewCache[common.Hash, *types.Receipt](receiptsCacheLimit),
logger: vmConfig.Tracer,
}
Expand Down Expand Up @@ -533,11 +535,12 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis
rawdb.WriteChainConfig(db, genesisHash, chainConfig)
}

// Start tx indexer if it's enabled.
if txLookupLimit != nil {
bc.txIndexer = newTxIndexer(*txLookupLimit, bc)
if txLookupLimit == nil {
txLookupLimit = new(uint64)
}

bc.txIndexer = newTxIndexer(*txLookupLimit, bc)

return bc, nil
}

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 @@ -777,7 +777,7 @@ func testMultiProtoSync(t *testing.T, protocol uint, mode SyncMode) {
assertOwnChain(t, tester, len(chain.blocks))

// Check that no peers have been dropped off
for _, version := range []int{68, 67} {
for _, version := range []int{68} {
peer := fmt.Sprintf("peer %d", version)
if _, ok := tester.peers[peer]; !ok {
t.Errorf("%s dropped", peer)
Expand Down
4 changes: 2 additions & 2 deletions eth/gasprice/gasprice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ func newTestBackend(t *testing.T, londonBlock *big.Int, cancunBlock *big.Int, pe

if cancunBlock != nil {
// ts := gspec.Timestamp + cancunBlock.Uint64()*10 // fixed 10 sec block time in blockgen
config.ShanghaiBlock = big.NewInt(10)
config.CancunBlock = big.NewInt(10)
config.ShanghaiBlock = londonBlock
config.CancunBlock = cancunBlock
signer = types.LatestSigner(gspec.Config)
}

Expand Down
3 changes: 2 additions & 1 deletion eth/protocols/snap/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2016,7 +2016,8 @@ func verifyTrie(scheme string, db ethdb.KeyValueStore, root common.Hash, t *test
func TestSyncAccountPerformance(t *testing.T) {
// These tests must not run in parallel: they modify the
// global var accountConcurrency
// t.Parallel()
t.Parallel()

testSyncAccountPerformance(t, rawdb.HashScheme)
testSyncAccountPerformance(t, rawdb.PathScheme)
}
Expand Down
Loading

0 comments on commit 5cda3fe

Please sign in to comment.