Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dot/network: improve syncing at head #1465

Merged
merged 49 commits into from
Mar 16, 2021
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
4b269b7
allow variable size requests if near goal
noot Mar 14, 2021
edcd0f7
don't force request starts to be mod 128 at head
noot Mar 14, 2021
3719cb9
near head, sync from head+1
noot Mar 14, 2021
5f6fb1a
add block to blocktree if in db but not blocktree
noot Mar 15, 2021
d3f4960
cleanup logs
noot Mar 15, 2021
2dadf47
better logs
noot Mar 15, 2021
8337e3c
fix
noot Mar 15, 2021
cd2e6c8
lint
noot Mar 15, 2021
a4e5686
fix logs
noot Mar 15, 2021
18b2aa5
Merge branch 'development' of github.com:ChainSafe/gossamer into noot…
noot Mar 15, 2021
828485a
remove highestBlockHeader from BlockState
noot Mar 15, 2021
6aeb9b6
cleanup
noot Mar 15, 2021
9360ecc
fix network tests
noot Mar 15, 2021
bb6ad38
Merge branch 'development' of github.com:ChainSafe/gossamer into noot…
noot Mar 15, 2021
06a033a
cleanup
noot Mar 15, 2021
86c2e9d
don't set request size when near head
noot Mar 15, 2021
3c18e6c
request parent block if can't find it
noot Mar 15, 2021
c16cef8
Merge branch 'development' of github.com:ChainSafe/gossamer into noot…
noot Mar 15, 2021
e6355ab
fix tests
noot Mar 15, 2021
ffa99cb
cleanup processBlockResponses
noot Mar 15, 2021
a15bd3b
cleanup
noot Mar 15, 2021
7202608
add syncAtHead goroutine
noot Mar 15, 2021
ea0bb5f
fix
noot Mar 15, 2021
1792bab
add BlockAnnounce log
noot Mar 15, 2021
e89c8e0
fix
noot Mar 15, 2021
85808e2
fix
noot Mar 16, 2021
0b5f3f7
add more logs
noot Mar 16, 2021
fa1381b
remove request start higher than goal requirement
noot Mar 16, 2021
2b80cea
add IsUint64 check
noot Mar 16, 2021
8dca407
lint
noot Mar 16, 2021
ee14cfb
log cleanup
noot Mar 16, 2021
410293c
add checks for IsUInt64() for starting block
noot Mar 16, 2021
8148ab9
re-add empty block data err
noot Mar 16, 2021
7032632
load trie from db if root is wrong
noot Mar 16, 2021
e8daa5a
cleanup
noot Mar 16, 2021
f0d6880
Merge branch 'development' of github.com:ChainSafe/gossamer into noot…
noot Mar 16, 2021
c2bc18f
Merge branch 'development' of github.com:ChainSafe/gossamer into noot…
noot Mar 16, 2021
fc77048
fix rpc system tests
noot Mar 16, 2021
53a6193
don't ignore responses below head
noot Mar 16, 2021
053fe8f
merge w development
noot Mar 16, 2021
ef57219
don't ignore block response data below head
noot Mar 16, 2021
0352a7a
lint
noot Mar 16, 2021
595b5ef
cleanup
noot Mar 16, 2021
bbfdb45
add unit tests
noot Mar 16, 2021
3404f6d
more unit tests
noot Mar 16, 2021
23bdca2
allow retry in TestMaxPeers
noot Mar 16, 2021
13ea0fe
Merge branch 'development' of github.com:ChainSafe/gossamer into noot…
noot Mar 16, 2021
5694367
fix style errors
noot Mar 16, 2021
605a42e
Merge branch 'development' of github.com:ChainSafe/gossamer into noot…
noot Mar 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions dot/core/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ type BlockState interface {
GetBlockByHash(common.Hash) (*types.Block, error)
GenesisHash() common.Hash
GetSlotForBlock(common.Hash) (uint64, error)
HighestBlockHash() common.Hash
HighestBlockNumber() *big.Int
GetFinalizedHeader(uint64, uint64) (*types.Header, error)
GetFinalizedHash(uint64, uint64) (common.Hash, error)
SetFinalizedHash(common.Hash, uint64, uint64) error
Expand Down
4 changes: 2 additions & 2 deletions dot/core/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ func (s *mockSyncer) HandleBlockAnnounce(msg *network.BlockAnnounceMessage) erro
return nil
}

func (s *mockSyncer) ProcessBlockData(_ []*types.BlockData) error {
return nil
func (s *mockSyncer) ProcessBlockData(_ []*types.BlockData) (int, error) {
return 0, nil
}

func (s *mockSyncer) IsSynced() bool {
Expand Down
3 changes: 2 additions & 1 deletion dot/network/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type BlockState interface {
BestBlockNumber() (*big.Int, error)
GenesisHash() common.Hash
HasBlockBody(common.Hash) (bool, error)
GetFinalizedHeader(round, setID uint64) (*types.Header, error)
}

// Syncer is implemented by the syncing service
Expand All @@ -37,7 +38,7 @@ type Syncer interface {
CreateBlockResponse(*BlockRequestMessage) (*BlockResponseMessage, error)

// ProcessBlockData is called to process BlockData received in a BlockResponseMessage
ProcessBlockData(data []*types.BlockData) error
ProcessBlockData(data []*types.BlockData) (int, error)

// HandleBlockAnnounce is called upon receipt of a BlockAnnounceMessage to process it.
// If a request needs to be sent to the peer to retrieve the full block, this function will return it.
Expand Down
4 changes: 4 additions & 0 deletions dot/network/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,7 @@ func (mbs *MockBlockState) BestBlockNumber() (*big.Int, error) {
func (mbs *MockBlockState) HasBlockBody(common.Hash) (bool, error) {
return false, nil
}

func (mbs *MockBlockState) GetFinalizedHeader(_, _ uint64) (*types.Header, error) {
return mbs.BestBlockHeader()
}
Loading