-
Notifications
You must be signed in to change notification settings - Fork 897
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
Optimize pivot block selector on PoS networks #4488
Conversation
Renaming to make clear everywhere that the forkchoice is not verified, so it will be clear in case there will be a future event for a verified forkchoice. Finalized block hash no more optional. Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
On PoS network we use a pivot block sent by the Consensus Layer, so we do not need peers, and so all the logic for selecting the pivot block from peers has been moved from FastSyncActions to PivotSelectorFromPeers. We do not need anymore the TransictionPeerSelector, and the --fast-sync-min-peers applies only to PoW networks. Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
# Conflicts: # CHANGELOG.md # besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
# Conflicts: # besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java
Renaming to make clear everywhere that the forkchoice is not verified, so it will be clear in case there will be a future event for a verified forkchoice. Finalized block hash no more optional. Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
…ze-snap-sync3 Signed-off-by: garyschulte <garyschulte@gmail.com>
01279f0
to
ecc7a8a
Compare
Signed-off-by: Justin Florentine <justin+github@florentine.us>
ecc7a8a
to
d350adc
Compare
Signed-off-by: Justin Florentine <justin+github@florentine.us>
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.
non-blocking feedback, in light of the fact that this PR fixes the mostly broken post-merge fast sync behavior
.waitForSuitablePeers(FastSyncState.EMPTY_SYNC_STATE) | ||
CompletableFuture.completedFuture(FastSyncState.EMPTY_SYNC_STATE) | ||
.thenCompose(syncActions::selectPivotBlock) |
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.
nit, but rather than composing a static completed future, couldn't this be reduced to
fastSyncActions.selectPivotBlock(fastSyncState)
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.
I did this way to avoid that an exception threw from fastSyncActions.selectPivotBlock(fastSyncState)
escape the future chain, so I can handle all the exception in the same place, instead of putting an extra try...catch
around fastSyncActions.selectPivotBlock(fastSyncState)
, do you have another idea on how to improve this?
.waitForSuitablePeers(fastSyncState) | ||
CompletableFuture.completedFuture(fastSyncState) |
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.
same comment about unnecessary compose
.whenComplete( | ||
(blockHeader, throwable) -> { | ||
if (throwable != null) { | ||
LOG.debug("Error downloading block header by hash {}", hash); |
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 might be useful to log the throwable too
ethContext, | ||
metricsSystem, | ||
currentState.getPivotBlockNumber().getAsLong(), | ||
syncConfig.getFastSyncMinimumPeerCount(), |
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 is going to default to 5 since we no longer override this value to 1 for PoS networks?
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.
on PoS this is never called, since we always have the pivot block hash
* Refactor to optimize pivot block selector on PoS networks On PoS network we use a pivot block sent by the Consensus Layer, so we do not need peers, and so all the logic for selecting the pivot block from peers has been moved from FastSyncActions to PivotSelectorFromPeers. We do not need anymore the TransictionPeerSelector, and the --fast-sync-min-peers applies only to PoW networks. Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
PR description
This PR is built on top of #4487 so check it first
This is the 3rd PR of a series to optimize the initial sync on PoS networks, that is ongoing here #4462, but since it is quite big, I am splitting it in smaller PRs to simplify the code review.
On PoS network we use as pivot block, the last finalized block sent by the Consensus Layer, so we do
not need peers, and so all the logic for selecting the pivot block from peers
has been moved from
FastSyncActions
toPivotSelectorFromPeers
.We do not need anymore the
TransictionPeerSelector
, and the--fast-sync-min-peers
applies only to PoW networks.
Fixed Issue(s)
Documentation
doc-change-required
label to this PR ifupdates are required.
Changelog