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

Etcm 1030 #1069

Merged
merged 4 commits into from
Jul 30, 2021
Merged

Etcm 1030 #1069

merged 4 commits into from
Jul 30, 2021

Conversation

AnastasiiaL
Copy link
Contributor

@AnastasiiaL AnastasiiaL commented Jul 16, 2021

Description

ExecutionSync is gonna be orchestrating the whole regular sync process and is gonna replace current RegularSync class.

Note: tests will be added in a separate PR


//not used atm, a part of the future ExecutionSync
class FetcherService(validator: BlockValidator, blockchainReader: BlockchainReader, syncConfig: SyncConfig) {
val batchSize = syncConfig.blockHeadersPerRequest
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that this is an unfortunate pattern. the class does not depend on the whole sysconfig class - it depends on one field from that class. how can we better express such dependencies?
if it's one field perhaps a tagged number would be good enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure I know what's a tagged number🤔

val endNumber: Option[BigInt] =
fetchUntilBlock.fold(Some(_), blockchainReader.getBlockHeaderByHash(_).map(_.number))
val startNumber: Option[BigInt] =
startFromBlock.fold(Some(_), blockchainReader.getBlockHeaderByHash(_).map(_.number))
Copy link
Contributor

Choose a reason for hiding this comment

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

correct me if I'm wrong but wouldn't it be beneficial to request a block by hash from a peer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually thinking more on that - we wouldn't know the hash of the block we want to fetch from the peer if we don't have that block ourselves. And the point of fetching from multiple peers is exactly to get alternative chains, so we do need to fetch by number here

Copy link
Contributor

@dzajkowski dzajkowski left a comment

Choose a reason for hiding this comment

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

I think that this one merits some discussion. maybe we can address it on the synch meeting?

@AnastasiiaL AnastasiiaL force-pushed the ETCM-1030 branch 3 times, most recently from f8dcd4e to a51b6c8 Compare July 27, 2021 12:40
@AurelienRichez AurelienRichez merged commit 4db8224 into develop Jul 30, 2021
@AurelienRichez AurelienRichez deleted the ETCM-1030 branch July 30, 2021 13:09
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.

6 participants