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

Fix empty body concept after shanghai #5174

Merged

Conversation

gfukushima
Copy link
Contributor

@gfukushima gfukushima commented Mar 6, 2023

PR description

This PR adds withdrawals to the method that checks for empty block bodies in CompleteBlocksTask.java
Adding withdrawals allows Besu to be able to distinguish empty blocks after shanghai skiping the block body download when body is empty.
Prior to this PR Besu would understand blocks like (0txs, 0 ommers, x ws) as an empty block, during the sync process. (x > 0)

Fixed Issue(s)

Fixes #4976

This PR has performed the following tests:

  • Recreated and tested fix on zhejiang-testnet using FAST sync
  • Successfully synced Sepolia (starting from checkpoint and transitioning to Shanghai)
  • Successfully synced Goerli
  • Successfully synced Mainnet

Documentation

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

Acceptance Tests (Non Mainnet)

  • I have considered running ./gradlew acceptanceTestNonMainnet locally if my PR affects non-mainnet modules.

Changelog

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
@gfukushima gfukushima added bug Something isn't working TeamGroot GH issues worked on by Groot Team mainnet labels Mar 6, 2023
…mpty block check

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
}

@Test
public void shouldCompleteWhenBlocksAreEmptyExceptForWithdrawals() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this testing that when blocks are empty but have withdrawals they are still downloaded? i.e. that they are considered empty blocks. Was a bit confused from the test name

Copy link
Contributor

@siladu siladu Mar 7, 2023

Choose a reason for hiding this comment

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

Is this testing that when blocks are empty but have withdrawals they are still downloaded?

yes, i.e. that they are not considered empty blocks like they were being before.

Any name suggestion? This was an modification of the existing test's name: shouldCompleteWithoutPeersWhenAllBlocksAreEmpty. Agree the new one could be better

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
@gfukushima gfukushima marked this pull request as ready for review March 7, 2023 09:25
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
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.

LGTM

Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
@gfukushima gfukushima enabled auto-merge (squash) March 7, 2023 21:33
@gfukushima gfukushima merged commit 3a3cca9 into hyperledger:main Mar 7, 2023
@gfukushima gfukushima deleted the fix-empty-block-on-CompleteBlocksTask branch March 23, 2023 22:58
garyschulte added a commit to garyschulte/besu that referenced this pull request Apr 10, 2023
* Fix empty body concept after shanghai

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>

* Check protocolSchedule to create empty block and add withdrawals to empty block check

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>

* Add unit tests

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>

* Extract block creation into a private method

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>

* Nit changes

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>

* Refactor test names
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>

---------

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Co-authored-by: garyschulte <garyschulte@gmail.com>
Co-authored-by: Simon Dudley <simon.dudley@consensys.net>
elenduuche pushed a commit to elenduuche/besu that referenced this pull request Aug 16, 2023
* Fix empty body concept after shanghai

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>

* Check protocolSchedule to create empty block and add withdrawals to empty block check

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>

* Add unit tests

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>

* Extract block creation into a private method

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>

* Nit changes

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>

* Refactor test names
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>

---------

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Co-authored-by: garyschulte <garyschulte@gmail.com>
Co-authored-by: Simon Dudley <simon.dudley@consensys.net>
eum602 pushed a commit to lacchain/besu that referenced this pull request Nov 3, 2023
* Fix empty body concept after shanghai

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>

* Check protocolSchedule to create empty block and add withdrawals to empty block check

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>

* Add unit tests

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>

* Extract block creation into a private method

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>

* Nit changes

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>

* Refactor test names
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>

---------

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Co-authored-by: garyschulte <garyschulte@gmail.com>
Co-authored-by: Simon Dudley <simon.dudley@consensys.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mainnet TeamGroot GH issues worked on by Groot Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Withdrawals to handle filling empty blocks when syncing
5 participants