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

Introduces BlobSidecarPool with block-blobs tracking #7026

Merged
merged 23 commits into from
Apr 26, 2023

Conversation

tbenr
Copy link
Contributor

@tbenr tbenr commented Apr 12, 2023

The basic idea is to have a pool of trackers for each blockRoot we see (coming from a block or from a sidecar)

  • each tracker have the responsibility to signal when a block-blobs bundle is completed

  • the pool is currently responsible of signal to fetchers (block and blobs) to retrieve missing content. This logic is triggered only when dealing with object related to current slot (following the head, content coming from gossip)

  • the pool implements a fetch delay logic. There are three constants:

    • TARGET_WAIT_MILLIS: ideal delay before fetching (currently set to 1s)
    • MIN_WAIT_MILLIS: minimum delay before fetching (currently set to 0.5s). The rationale is that we don't want to issue fetches if we are most probably still receiving block and blobs.
    • MAX_WAIT_RELATIVE_TO_ATT_DUE_MILLIS: maximum "distance" from attestation due (4s) when we really want to have block and blobs to process (currently set to 1.5s). The rationale is that, if we are close to attestation due, even if we may still receive something from gossip, we are in rush and we can waste some bandwidth to have more chance to import before the 4s mark (and attest to correct head)
  • currently if we try to fetch blobsidecars and we don't have the corresponding block yet, we try to fetch all possible sidecars (considering maxBlobsPerBlock). If we receive the block after fetch occurs, we drop the (eventually) non existing blobs.

fixes #6849

Documentation

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

Changelog

  • I thought about adding a changelog entry, and added one if I deemed necessary.

@tbenr tbenr force-pushed the BlobSidecarPoolAndTrackers branch from 4fd019d to ccb1e54 Compare April 14, 2023 17:04
@tbenr tbenr force-pushed the BlobSidecarPoolAndTrackers branch from 9444a29 to b220675 Compare April 18, 2023 17:10
@tbenr tbenr marked this pull request as ready for review April 19, 2023 14:24
@tbenr tbenr changed the title Introduces BlobSidecarPool with block-blocs tracking Introduces BlobSidecarPool with block-blobs tracking Apr 19, 2023
Copy link
Contributor

@zilm13 zilm13 left a comment

Choose a reason for hiding this comment

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

Looks good, but I'm a bit paranoid on synchronization pattern. I think we have some difference here with other pending pools which may lead to dead locks or slow behaviour. I will take a look again tomorrow with a fresh head

final UInt64 finalTime =
targetMillis.min(upperLimitRelativeToAttDue).max(nowMillis.plus(MIN_WAIT_MILLIS));

return Optional.of(Duration.ofMillis(finalTime.minus(nowMillis).intValue()));
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure on all this logic if we take Gnosis. Do you know their plans for Blobs?

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 point... I think at the end it may hold even in gnosis timings.. i'll think about it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think for fast slot networks, we would end up being always on the MIN_WAIT_MILLIS which makes sense to me.
And I think it is acceptable that value being constant instead of being dependant by slot time, since that number is more related to network latency than actual slot time. We could argue that on fast nets, blocks (and blobs?) could be smaller so the expected latency could be lower on average, but for now seems like we can leave with a constant.

@tbenr
Copy link
Contributor Author

tbenr commented Apr 19, 2023

@zilm13 yes you're right, I promised my self to review synchronization. I'll do a second pass tomorrow

@tbenr tbenr force-pushed the BlobSidecarPoolAndTrackers branch from aa019f0 to a691d5f Compare April 24, 2023 09:08
@tbenr tbenr force-pushed the BlobSidecarPoolAndTrackers branch from b09dee6 to 16670a5 Compare April 26, 2023 12:46
@tbenr tbenr mentioned this pull request Apr 26, 2023
2 tasks
Copy link
Contributor

@zilm13 zilm13 left a comment

Choose a reason for hiding this comment

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

LGTM

blockBody.getAndSet(
Optional.of(BeaconBlockBodyDeneb.required(block.getMessage().getBody())));
if (oldBlock.isPresent()) {
LOG.debug("block was already set!");
Copy link
Contributor

Choose a reason for hiding this comment

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

It's useless without any extra info (block info or whatever), and we could hit it very often. I'd remove it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

going to remove it for now, will put it in the debugging PR to show timings

@tbenr tbenr merged commit 284e12f into Consensys:master Apr 26, 2023
@tbenr tbenr deleted the BlobSidecarPoolAndTrackers branch April 26, 2023 20:11
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.

Implement BlobSidecar pooling
2 participants