Skip to content

BlobSidecarsByRange rpc handler#12499

Merged
prylabs-bulldozer[bot] merged 1 commit intointegrate-blobs-by-rootfrom
integrate-blobs-by-range
Jun 15, 2023
Merged

BlobSidecarsByRange rpc handler#12499
prylabs-bulldozer[bot] merged 1 commit intointegrate-blobs-by-rootfrom
integrate-blobs-by-range

Conversation

@kasey
Copy link
Collaborator

@kasey kasey commented Jun 6, 2023

What type of PR is this?

Feature

What does this PR do? Why is it needed?

This PR adds support for the deneb BlobSidecarsByRange RPC

@kasey kasey requested a review from a team as a code owner June 6, 2023 19:28
@kasey kasey requested review from james-prysm, prestonvanloon and saolyn and removed request for a team, james-prysm, prestonvanloon and saolyn June 6, 2023 19:28
@kasey kasey force-pushed the integrate-blobs-by-range branch 2 times, most recently from beb95d1 to a4678c7 Compare June 7, 2023 00:11
@kasey kasey force-pushed the integrate-blobs-by-root branch from 7f09ac3 to 4e74b03 Compare June 7, 2023 18:03
@kasey kasey force-pushed the integrate-blobs-by-range branch 2 times, most recently from f66fa03 to 93249d5 Compare June 7, 2023 19:15
}

var err error
rp.end, err = rp.start.SafeAdd((rp.size - 1))
Copy link
Collaborator

Choose a reason for hiding this comment

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

underflow if rp.size is 0?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added this validation: e84e08a

@kasey kasey force-pushed the integrate-blobs-by-range branch from 146f15f to 4c8d4ed Compare June 8, 2023 15:39
@kasey kasey changed the title WIP BlobSidecarsByRange rpc handler BlobSidecarsByRange rpc handler Jun 8, 2023
}
totalWrites += writes
// once we have written MAX_REQUEST_BLOB_SIDECARS, we're done serving the request
if totalWrites >= params.BeaconNetworkConfig().MaxRequestBlobsSidecars {
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed this is checked after we have streamed the batch, would it be an issue if we streamed an excessive number of sidecars to the peer (beyond the limit).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch. I rewrote the bookkeeping code to stop streaming results as soon as we hit the limit: 8055521

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There was a compile error in the above commit because hadn't updated this branch after changing the signature of readChunkEncodedBlobs - added a validator for range requests here: b18a055

maxRequest := params.BeaconNetworkConfig().MaxRequestBlocksDeneb
// Allow some wiggle room, up to double the MaxRequestBlocks past the current slot,
// to give nodes syncing close to the head of the chain some margin for error.
maxStart, err := current.SafeAdd(maxRequest * 2)
Copy link
Contributor

Choose a reason for hiding this comment

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

does this limit apply for blobs too ? I noticed that blobs aren't to be served until a minimum threshold is reached, unlike blocks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updating this discussion from our chat elsewhere - the reasoning here is that we should use the same start slot validation logic as BeaconBlocksByRange so that we don't penalize clients who try to sync blobs in parallel with blocks (and potentially overshoot current slot for both). Ultimately we won't serve any results when the start slot is > current, but we also won't treat a request like this as an error and penalize clients for aggressively seeking past this point, within the maxRequest * 2 margin of error.

@kasey kasey force-pushed the integrate-blobs-by-root branch from 58bd57a to f8a1c0b Compare June 10, 2023 15:59
@kasey kasey force-pushed the integrate-blobs-by-range branch 2 times, most recently from d34ce37 to e532b40 Compare June 12, 2023 21:41
}

func blobBatchLimit() uint64 {
return uint64(flags.Get().BlockBatchLimit / fieldparams.MaxBlobsPerBlock)
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't seem right. Shouldn't it be the maximum of the two?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ultimately this value controls how many blocks we'll process in a batch, ie this is rate limiting blocks/sec that we query and stream. In the context of BeaconBlocksByRange, we stream batch.size values (1 blocks for each item in the batch), but for BlobSidecarsByRange, we'll stream up to batch.size * MaxBlobsPerBlock values (blobs). We want both requests to serve roughly the same number of values per cycle, so we divide the block limit by the number of blobs per block to arrive at roughly the same number of values written to the wire per batch / same interval of time. I should add a comment to better explain what this is for.

@kasey kasey force-pushed the integrate-blobs-by-root branch from 8055521 to d716dc8 Compare June 12, 2023 23:59
@kasey kasey force-pushed the integrate-blobs-by-range branch from b18a055 to 9df7f6b Compare June 12, 2023 23:59
Copy link
Contributor

@nisdas nisdas left a comment

Choose a reason for hiding this comment

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

LGTM

@kasey kasey force-pushed the integrate-blobs-by-range branch 5 times, most recently from 0046681 to 99ff163 Compare June 14, 2023 22:06
@kasey kasey force-pushed the integrate-blobs-by-range branch from 258c49d to 107ae03 Compare June 15, 2023 19:30
@prylabs-bulldozer prylabs-bulldozer bot merged commit b87acf9 into integrate-blobs-by-root Jun 15, 2023
@prylabs-bulldozer prylabs-bulldozer bot deleted the integrate-blobs-by-range branch June 15, 2023 19:33
prylabs-bulldozer bot pushed a commit that referenced this pull request Jun 15, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
terencechain pushed a commit that referenced this pull request Jun 16, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
terencechain pushed a commit that referenced this pull request Jun 27, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
terencechain pushed a commit that referenced this pull request Jul 7, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
terencechain pushed a commit that referenced this pull request Jul 9, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
kasey added a commit that referenced this pull request Jul 20, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
james-prysm pushed a commit that referenced this pull request Aug 4, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
terencechain pushed a commit that referenced this pull request Aug 16, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
kasey added a commit that referenced this pull request Aug 21, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
kasey added a commit that referenced this pull request Aug 22, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
kasey added a commit that referenced this pull request Aug 22, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
kasey added a commit that referenced this pull request Aug 22, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
kasey added a commit that referenced this pull request Aug 23, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
kasey added a commit that referenced this pull request Aug 23, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
kasey added a commit that referenced this pull request Aug 23, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
kasey added a commit that referenced this pull request Aug 24, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
kasey added a commit that referenced this pull request Aug 24, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
prestonvanloon pushed a commit that referenced this pull request Aug 24, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
prestonvanloon pushed a commit that referenced this pull request Aug 24, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
prestonvanloon pushed a commit that referenced this pull request Aug 24, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
prestonvanloon pushed a commit that referenced this pull request Aug 24, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
prestonvanloon pushed a commit that referenced this pull request Aug 24, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
prestonvanloon pushed a commit that referenced this pull request Aug 24, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
prestonvanloon pushed a commit that referenced this pull request Aug 30, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
prestonvanloon pushed a commit that referenced this pull request Aug 30, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
prestonvanloon pushed a commit that referenced this pull request Aug 31, 2023
* BlobSidecarsByRoot RPC handler

* BlobSidecarsByRange rpc handler (#12499)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
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