Skip to content

Commit

Permalink
chore: address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
EclesioMeloJunior committed Aug 16, 2023
1 parent c2bdb93 commit e5b97c1
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 18 deletions.
11 changes: 1 addition & 10 deletions chain/westend/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ var (
// defaultID Default chain ID
defaultID = "westend2"
// defaultBasePath Default node base directory path
defaultBasePath = "/Volumes/SDD01/gossamer/westend"
//defaultBasePath = "~/.gossamer/westend"
defaultBasePath = "~/.gossamer/westend"
// defaultChainSpec is the default chain specification path
defaultChainSpec = "./chain/westend/genesis.json"
)
Expand All @@ -30,14 +29,6 @@ func DefaultConfig() *cfg.Config {
config.Core.GrandpaAuthority = false
config.Core.Role = 1
config.Network.NoMDNS = false
config.Network.MaxPeers = 128
config.PrometheusExternal = true
config.PrometheusPort = 9876

config.Log.Sync = "trace"
config.Log.Digest = "trace"

config.Pprof.Enabled = true
config.Pprof.ListeningAddress = "0.0.0.0:6060"
return config
}
3 changes: 1 addition & 2 deletions dot/node_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func TestNewNode(t *testing.T) {
assert.NoError(t, err)

mockServiceRegistry := NewMockServiceRegisterer(ctrl)
mockServiceRegistry.EXPECT().RegisterService(gomock.Any()).Times(9)
mockServiceRegistry.EXPECT().RegisterService(gomock.Any()).Times(8)

m := NewMocknodeBuilderIface(ctrl)
m.EXPECT().isNodeInitialised(initConfig.BasePath).Return(nil)
Expand Down Expand Up @@ -324,7 +324,6 @@ func TestStartStopNode(t *testing.T) {
config.ChainSpec = genFile
config.Core.GrandpaAuthority = false
config.Core.BabeAuthority = false
config.Network.MinPeers = 0

err := InitNode(config)
require.NoError(t, err)
Expand Down
4 changes: 2 additions & 2 deletions dot/state/block_finalisation.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ func (bs *BlockState) SetFinalisedHash(hash common.Hash, round, setID uint64) er
}

pruned := bs.bt.Prune(hash)
for _, prunedHash := range pruned {
blockHeader := bs.unfinalisedBlocks.delete(prunedHash)
for _, hash := range pruned {
blockHeader := bs.unfinalisedBlocks.delete(hash)
if blockHeader == nil {
continue
}
Expand Down
2 changes: 2 additions & 0 deletions dot/sync/chain_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,13 @@ func (cs *chainSync) waitEnoughPeersAndTarget() <-chan struct{} {

cs.workerPool.useConnectedPeers()
_, err := cs.getTarget()

totalAvailable := cs.workerPool.totalWorkers()
if totalAvailable >= uint(cs.minPeers) && err == nil {
return
}

// TODO: https://github.com/ChainSafe/gossamer/issues/3402
time.Sleep(100 * time.Millisecond)
}
}()
Expand Down
1 change: 1 addition & 0 deletions dot/sync/chain_sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ func TestChainSync_BootstrapSync_SuccessfulSync_WithOneWorker(t *testing.T) {
mockStorageState := NewMockStorageState(ctrl)
mockImportHandler := NewMockBlockImportHandler(ctrl)
mockTelemetry := NewMockTelemetry(ctrl)

const announceBlock = false
// setup mocks for new synced blocks that doesn't exists in our local database
ensureSuccessfulBlockImportFlow(t, mockedGenesisHeader, totalBlockResponse.BlockData, mockedBlockState,
Expand Down
4 changes: 0 additions & 4 deletions lib/trie/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ func (t *Trie) loadNode(db DBGetter, n *Node) error {
}

nodeHash := merkleValue
if len(nodeHash) < 1 {
fmt.Printf(">>>>>>>>>> trie loadNode, empty node hash\n")
}

encodedNode, err := db.Get(nodeHash)
if err != nil {
return fmt.Errorf("cannot find child node key 0x%x in database: %w", nodeHash, err)
Expand Down

0 comments on commit e5b97c1

Please sign in to comment.