Skip to content

ligth sync: download difflayer#2

Merged
unclezoro merged 4 commits intounclezoro:light_syncfrom
kyrie-yl:downloader_light_sync
Sep 2, 2021
Merged

ligth sync: download difflayer#2
unclezoro merged 4 commits intounclezoro:light_syncfrom
kyrie-yl:downloader_light_sync

Conversation

@kyrie-yl
Copy link
Copy Markdown

@kyrie-yl kyrie-yl commented Sep 2, 2021

Signed-off-by: kyrie-yl lei.y@binance.com

@kyrie-yl kyrie-yl force-pushed the downloader_light_sync branch from 1781a17 to cbd10bf Compare September 2, 2021 08:32
}
}

func (d *Downloader) SetBodyFetchHook(hook func(SyncMode, string, []*types.Header)) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

方法不要暴露,=> setBodyFetchHook

receiptFetchHook func([]*types.Header) // Method to call upon starting a receipt fetch
chainInsertHook func([]*fetchResult) // Method to call upon inserting a chain of blocks (possibly in multiple invocations)
syncInitHook func(uint64, uint64) // Method to call upon initiating a new sync run
bodyFetchHook func(SyncMode, string, []*types.Header) // Method to call upon starting a block body fetch
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will break a lot of testcase

eth/peerset.go Outdated
closed bool
}

func DiffBodiesFetchOption(peers *peerSet) downloader.DownloadOption {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is not good to defineDiffBodiesFetchOption in peerSet.go

eth/peer.go Outdated
*eth.Peer
snapExt *snapPeer // Satellite `snap` connection
diffExt *diffPeer
DiffExt *diffPeer
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why upper?

kyrie-yl added 3 commits September 2, 2021 19:58
Signed-off-by: kyrie-yl <lei.y@binance.com>
Signed-off-by: kyrie-yl <lei.y@binance.com>
Signed-off-by: kyrie-yl <lei.y@binance.com>
func DiffBodiesFetchOption(peers IPeerSet) DownloadOption {
return func(dl *Downloader) *Downloader {
var hook = func(headers []*types.Header, options ...interface{}) {
if len(options) < 2 {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

options ==> args

eth/peerset.go Outdated

import (
"errors"
"github.com/ethereum/go-ethereum/eth/downloader"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import order

Signed-off-by: kyrie-yl <lei.y@binance.com>
@kyrie-yl kyrie-yl force-pushed the downloader_light_sync branch from c91de18 to cd49920 Compare September 2, 2021 12:05
@unclezoro unclezoro merged commit f9bb1c5 into unclezoro:light_sync Sep 2, 2021
unclezoro pushed a commit that referenced this pull request Sep 2, 2021
* ligth sync: download difflayer

Signed-off-by: kyrie-yl <lei.y@binance.com>

* download diff layer: fix according to the comments

Signed-off-by: kyrie-yl <lei.y@binance.com>

* download diff layer: update

Signed-off-by: kyrie-yl <lei.y@binance.com>

* download diff layer: fix accroding comments

Signed-off-by: kyrie-yl <lei.y@binance.com>

Co-authored-by: kyrie-yl <lei.y@binance.com>
unclezoro pushed a commit that referenced this pull request Sep 7, 2021
* ligth sync: download difflayer

Signed-off-by: kyrie-yl <lei.y@binance.com>

* download diff layer: fix according to the comments

Signed-off-by: kyrie-yl <lei.y@binance.com>

* download diff layer: update

Signed-off-by: kyrie-yl <lei.y@binance.com>

* download diff layer: fix accroding comments

Signed-off-by: kyrie-yl <lei.y@binance.com>

Co-authored-by: kyrie-yl <lei.y@binance.com>
unclezoro added a commit that referenced this pull request Oct 12, 2021
* implement block process part of light sync

* add difflayer protocol

* handle difflayer and refine light processor

* add testcase for diff protocol

* make it faster

* allow validator to light sync

* change into diff sync

* ligth sync: download difflayer (#2)

* ligth sync: download difflayer

Signed-off-by: kyrie-yl <lei.y@binance.com>

* download diff layer: fix according to the comments

Signed-off-by: kyrie-yl <lei.y@binance.com>

* download diff layer: update

Signed-off-by: kyrie-yl <lei.y@binance.com>

* download diff layer: fix accroding comments

Signed-off-by: kyrie-yl <lei.y@binance.com>

Co-authored-by: kyrie-yl <lei.y@binance.com>

* update light sync to diff sync

* raise the max diff limit

* add switcher of snap protocol

* fix test case

* make commit concurrently

* remove peer for diff cache when peer closed

* consensus tuning

* add test code

* remove extra message

* fix testcase and lint

make diff block configable

wait code write

fix testcase

resolve comments

resolve comment

* resolve comments

* resolve comments

* resolve comment

* fix mistake

Co-authored-by: kyrie-yl <83150977+kyrie-yl@users.noreply.github.com>
Co-authored-by: kyrie-yl <lei.y@binance.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants