-
Notifications
You must be signed in to change notification settings - Fork 2
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
ligth sync: download difflayer #2
ligth sync: download difflayer #2
Conversation
1781a17
to
cbd10bf
Compare
eth/downloader/downloader.go
Outdated
@@ -290,6 +297,10 @@ func (d *Downloader) Progress() ethereum.SyncProgress { | |||
} | |||
} | |||
|
|||
func (d *Downloader) SetBodyFetchHook(hook func(SyncMode, string, []*types.Header)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
方法不要暴露,=> setBodyFetchHook
eth/downloader/downloader.go
Outdated
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 |
There was a problem hiding this comment.
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
@@ -66,6 +68,24 @@ type peerSet struct { | |||
closed bool | |||
} | |||
|
|||
func DiffBodiesFetchOption(peers *peerSet) downloader.DownloadOption { |
There was a problem hiding this comment.
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
@@ -38,7 +38,7 @@ type ethPeerInfo struct { | |||
type ethPeer struct { | |||
*eth.Peer | |||
snapExt *snapPeer // Satellite `snap` connection | |||
diffExt *diffPeer | |||
DiffExt *diffPeer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why upper?
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>
eth/downloader/downloader.go
Outdated
func DiffBodiesFetchOption(peers IPeerSet) DownloadOption { | ||
return func(dl *Downloader) *Downloader { | ||
var hook = func(headers []*types.Header, options ...interface{}) { | ||
if len(options) < 2 { |
There was a problem hiding this comment.
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
@@ -18,6 +18,7 @@ package eth | |||
|
|||
import ( | |||
"errors" | |||
"github.com/ethereum/go-ethereum/eth/downloader" |
There was a problem hiding this comment.
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>
c91de18
to
cd49920
Compare
* 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>
* 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>
* 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>
Signed-off-by: kyrie-yl lei.y@binance.com