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

Add GetBodiesFromPeerTask #8040

Open
wants to merge 208 commits into
base: main
Choose a base branch
from

Conversation

Matilda-Clerke
Copy link
Contributor

@Matilda-Clerke Matilda-Clerke commented Dec 17, 2024

PR description

Adds GetBodiesFromPeerTask for use with the peer task system to help move away from the cumbersome EthTask class hierarchy. Includes work from both myself (@Matilda-Clerke) and @pinges

Matilda-Clerke and others added 30 commits September 17, 2024 13:22
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…e available

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…tantiation

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…en initializing PeerTaskFeatureToggle multiple times

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…peertask-system' into 7311-add-cli-feature-toggle-for-peertask-system
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Matilda-Clerke and others added 29 commits October 28, 2024 08:53
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
… update unit test to test for this functionality

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…PoS, remove new usages of currentProtocolSpecSupplier

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…sPeerTask

# Conflicts:
#	ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/checkpointsync/CheckpointDownloadBlockStep.java
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: stefan.pingel@consensys.net <stefan.pingel@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
… spotless

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
return protocolSchedule.getByBlockHeader(header).getWithdrawalsProcessor().isPresent();
}

public List<Block> getBlocks() {
Copy link
Contributor

Choose a reason for hiding this comment

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

The method name doesn't make it clear this is downloading blocks when called, it looks like a getter.

Maybe downloadBlocks would be better?

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class GetBodiesFromPeerTask implements PeerTask<List<Block>> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add Javadoc description to this class like the other GetBodiesFromPeerTask

private final List<BlockHeader> headersToGet = new ArrayList<>();
private final PeerTaskExecutor peerTaskExecutor;

private final Block[] result;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is an array being used to hold the results instead of a List?

remainingBlocks--;
result[nextIndex] = block;
headersToGet.removeFirst();
nextIndex = findNextIndex(nextIndex + 1);
Copy link
Contributor

@jframe jframe Dec 20, 2024

Choose a reason for hiding this comment

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

Why is findNextIndex needed here? Is this to skip prepopulated empty headers?

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.

4 participants