Skip to content

7311: add GetReceiptsFromPeerTask#7638

Merged
jframe merged 185 commits intobesu-eth:mainfrom
Matilda-Clerke:7311-add-GetReceiptsFromPeerTask
Oct 30, 2024
Merged

7311: add GetReceiptsFromPeerTask#7638
jframe merged 185 commits intobesu-eth:mainfrom
Matilda-Clerke:7311-add-GetReceiptsFromPeerTask

Conversation

@Matilda-Clerke
Copy link
Copy Markdown
Contributor

PR description

This PR adds the GetReceiptsFromPeerTask PeerTask for all places the existing related EthTask is used and sets up addition and removal of peers for PeerManager

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>
*/
protected DefaultSynchronizer createSynchronizer(
final ProtocolSchedule protocolSchedule,
final Supplier<ProtocolSpec> currentProtocolSpecSupplier,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This shouldn't be needed we can just use the protocol schedule to get a ProtocolSpec

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I thought so too, but in order to get the ProtocolSpec from a ProtocolSchedule, you need a BlockHeader. The currentProtocolSpecSupplier always grabs the ProtocolSpec for the highest block we have.

Maybe it would make sense for this to be encapsulated in ProtocolSchedule with a getCurrentProtocolSpec method?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As it turns out, trying to include this in the ProtocolSchedule ends up with even more code touched, and cyclic dependencies that make it very difficult to achieve

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Another way would be just to check that any forks are using POS in the protocol spec, no need to check every block header could do something like what I did the block import to check whether we are on a post merge chain https://github.com/hyperledger/besu/blob/main/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncDownloadPipelineFactory.java#L122.

"Unexpectedly got receipts for block header already populated!");
}));
}
// remove all the headers we found receipts for
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The completion logic would be better in GetReceiptsFromPeerTask

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This code can only exist in the calling code as it's used to determine if we need to do another GetReceiptsFromPeerTask. When we discussed moving this logic into the GetReceiptsFromPeerTask, we realised that it would result in more confusing, recursive calls to the PeerTaskExecutor.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I can see how that would make it more complex. This might be the best place to repeat the task for now.

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

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
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>
*/
protected DefaultSynchronizer createSynchronizer(
final ProtocolSchedule protocolSchedule,
final Supplier<ProtocolSpec> currentProtocolSpecSupplier,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Another way would be just to check that any forks are using POS in the protocol spec, no need to check every block header could do something like what I did the block import to check whether we are on a post merge chain https://github.com/hyperledger/besu/blob/main/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncDownloadPipelineFactory.java#L122.

"Unexpectedly got receipts for block header already populated!");
}));
}
// remove all the headers we found receipts for
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I can see how that would make it more complex. This might be the best place to repeat the task for now.

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>
@jframe jframe merged commit db29df7 into besu-eth:main Oct 30, 2024
JanetMo pushed a commit to JanetMo/besu that referenced this pull request Nov 17, 2024
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Marlene Marz <m.marz@kabelmail.de>
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