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

Do not require a minimum block height when downloading headers or blocks #3911

Merged
merged 5 commits into from
Jun 17, 2022

Conversation

fab-10
Copy link
Contributor

@fab-10 fab-10 commented May 27, 2022

After The Merge, there will be no more broadcating of the following messages:

  • NewBlock
  • NewBlockHashes

and we used these messages to update the status (height and difficulty) of a peer.
The status of a peer is set at the beginning of the connection, and then update using the above messages, but after the switch to PoS, since there messages are no longer sent, the status of a peer will remain the same for the duration of the connection, and this could mean that Besu is not able to query for block headers or blocks anymore, since some of the messages currently enforce that a peer has minimum height before we send them.

This PR address this issue, removing the constraint that a peer must have a minimum height, before sending block header or block requests, since we actually do not known which is the current status of the peer, and also try to parse peer responses for information that could be useful to update the peer status.

Even if the removal of the constraint is mandatory for the Merge, it could also benefit PoW networks, since assuming that the records keep for any peer is always up-to-date, but this could not be the case, since the peer could send some messages only to a subset of its peers, or some messages could not be processed.
This shold not introduce too much overhead, because Besu tries first with the best peers, the one that should be able to respond to our request.

Signed-off-by: Fabio Di Fabio [email protected]

PR description

Fixed Issue(s)

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if
    updates are required.

Changelog

@fab-10 fab-10 force-pushed the update-chain-state-post-merge branch 6 times, most recently from 7ca3017 to 18f7c53 Compare June 14, 2022 14:15
@fab-10 fab-10 changed the title If needed update peer chain state when processing the block headers r… Do not require a minimum block height when downloading headers or blocks Jun 14, 2022
@fab-10 fab-10 marked this pull request as ready for review June 14, 2022 15:27
@fab-10 fab-10 force-pushed the update-chain-state-post-merge branch from 18f7c53 to e21382e Compare June 14, 2022 16:52
Copy link
Contributor

@macfarla macfarla left a comment

Choose a reason for hiding this comment

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

Looks ok to me. minor comment

@@ -48,7 +47,6 @@
final MetricsSystem metricsSystem) {
super(ethContext, 3, List::isEmpty, metricsSystem);
this.protocolSchedule = protocolSchedule;
this.minimumRequiredBlockNumber = minimumRequiredBlockNumber;
Copy link
Contributor

Choose a reason for hiding this comment

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

should minimumRequiredBlockNumber be removed from the constructor also? L47

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, removed

@fab-10 fab-10 force-pushed the update-chain-state-post-merge branch from e21382e to 8bdeadb Compare June 16, 2022 08:49
Peers could have that header, bacause our internal record about the
status of the peer could not always be up-to-date, so it is better
to avoid setting that constraint when selecting peers to download block
headers.

Signed-off-by: Fabio Di Fabio <[email protected]>
Signed-off-by: Fabio Di Fabio <[email protected]>
@fab-10 fab-10 force-pushed the update-chain-state-post-merge branch from 8bdeadb to a57c70f Compare June 16, 2022 12:37
@macfarla macfarla merged commit 261b1e0 into hyperledger:main Jun 17, 2022
@fab-10 fab-10 deleted the update-chain-state-post-merge branch June 20, 2022 13:37
@fab-10 fab-10 added the mainnet label Jun 28, 2022
garyschulte pushed a commit that referenced this pull request Jul 7, 2022
…cks (#3911)

* If needed update peer chain state when processing the block headers response

Signed-off-by: Fabio Di Fabio <[email protected]>

* Do not require a minimum block height when downloading headers or blocks

Peers could have that header, bacause our internal record about the
status of the peer could not always be up-to-date, so it is better
to avoid setting that constraint when selecting peers to download block
headers.

Signed-off-by: Fabio Di Fabio <[email protected]>

* Add CHANGELOG

Signed-off-by: Fabio Di Fabio <[email protected]>

* Complete the removal of minimumRequiredBlockNumber from constructors

Signed-off-by: Fabio Di Fabio <[email protected]>

Co-authored-by: Sally MacFarlane <[email protected]>
garyschulte added a commit that referenced this pull request Jul 7, 2022
49e4fd8 -> worldstate not avail (#4069)
6aa8812 -> stateroot mismatch (#4041)
043191a -> jwt auth on websockets (#4039)
90f891b -> do not move head on exec and propose (#4013)
3baa4da -> upgrade for websockets (#4019)
5024c07 -> sepolia TTD (#4024)
5ee9be8 -> heal step in snap (#3920)
261b1e0 -> remove peer block height requirements (#3911)

Signed-off-by: garyschulte <[email protected]>
garyschulte added a commit that referenced this pull request Jul 7, 2022
49e4fd8 -> worldstate not avail (#4069)
6aa8812 -> stateroot mismatch (#4041)
043191a -> jwt auth on websockets (#4039)
90f891b -> do not move head on exec and propose (#4013)
b5fa62c -> sync check before processing remote transactions (4035)
3baa4da -> upgrade for websockets (#4019)
5024c07 -> sepolia TTD (#4024)
5ee9be8 -> heal step in snap (#3920)
261b1e0 -> remove peer block height requirements (#3911)

Signed-off-by: garyschulte <[email protected]>
@garyschulte garyschulte mentioned this pull request Jul 8, 2022
eum602 pushed a commit to lacchain/besu that referenced this pull request Nov 3, 2023
…cks (hyperledger#3911)

* If needed update peer chain state when processing the block headers response

Signed-off-by: Fabio Di Fabio <[email protected]>

* Do not require a minimum block height when downloading headers or blocks

Peers could have that header, bacause our internal record about the
status of the peer could not always be up-to-date, so it is better
to avoid setting that constraint when selecting peers to download block
headers.

Signed-off-by: Fabio Di Fabio <[email protected]>

* Add CHANGELOG

Signed-off-by: Fabio Di Fabio <[email protected]>

* Complete the removal of minimumRequiredBlockNumber from constructors

Signed-off-by: Fabio Di Fabio <[email protected]>

Co-authored-by: Sally MacFarlane <[email protected]>
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.

2 participants