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

polygon/sync: implement header downloader #9030

Merged
merged 20 commits into from
Dec 22, 2023
Merged

polygon/sync: implement header downloader #9030

merged 20 commits into from
Dec 22, 2023

Conversation

taratorio
Copy link
Member

No description provided.

@taratorio taratorio marked this pull request as draft December 19, 2023 16:27
@taratorio taratorio changed the title polygon/blocksyncer: v1 implementation polygon/blocksync: v1 implementation Dec 19, 2023
}
}

type BlockDownloader struct {
Copy link
Member Author

Choose a reason for hiding this comment

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

pending unit tests: wip

@battlmonstr battlmonstr changed the base branch from devel to pr/astrid_sync December 20, 2023 08:17
polygon/blocksync/block_downloader.go Outdated Show resolved Hide resolved
polygon/blocksync/block_downloader.go Outdated Show resolved Hide resolved
polygon/blocksync/db_layer.go Outdated Show resolved Hide resolved
polygon/blocksync/heimdall_layer.go Outdated Show resolved Hide resolved
polygon/blocksync/p2p_layer.go Outdated Show resolved Hide resolved
polygon/blocksync/block_downloader.go Outdated Show resolved Hide resolved
polygon/blocksync/block_downloader.go Outdated Show resolved Hide resolved
polygon/blocksync/block_downloader.go Outdated Show resolved Hide resolved
polygon/blocksync/block_downloader.go Outdated Show resolved Hide resolved
polygon/blocksync/block_downloader.go Outdated Show resolved Hide resolved
Base automatically changed from pr/astrid_sync to devel December 20, 2023 15:48
@taratorio taratorio changed the title polygon/blocksync: v1 implementation polygon/sync: implement header downloader Dec 20, 2023
@taratorio taratorio requested a review from mh0lt December 21, 2023 18:30
@taratorio taratorio marked this pull request as ready for review December 21, 2023 18:31
peers := hd.choosePeers(allPeers, statePoints)
if len(peers) == 0 {
hd.logger.Warn(
fmt.Sprintf("[%s] can't use any peers to sync, will try again", headerDownloaderLogPrefix),
Copy link
Member Author

Choose a reason for hiding this comment

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

@battlmonstr if this ever happens, ie we have all 100 max peers but all are not synced enough (highly unlikely I suppose but possible) we can add a sentry function to temporarily disconnect them for some time interval so we can connect to others that may be synced further ahead - what do you think? would a disconnect be the same as penalize in this case or penalized means we will never connect to the penalized peer again in the future?

Copy link
Member Author

Choose a reason for hiding this comment

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

work for a future PR regardless


import "github.com/ledgerwatch/erigon/core/types"

type HeaderVerifier func(statePoint *statePoint, headers []*types.Header) error
Copy link
Member Author

Choose a reason for hiding this comment

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

will implement in subsequent PR

@mh0lt mh0lt merged commit 64072ce into devel Dec 22, 2023
7 checks passed
@mh0lt mh0lt deleted the astrid-download-blocks branch December 22, 2023 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants