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

Beacon API: get blob fix retention cases #13585

Merged
merged 6 commits into from
Feb 6, 2024

Conversation

james-prysm
Copy link
Contributor

What type of PR is this?

Bug fix

What does this PR do? Why is it needed?

fixes the /eth/v1/beacon/blob_sidecars/{block_id} endpoint to handl the additional cases below correctly without a 500 error. currently, we will try to use the root even if the block doesn't exist which doesn't correctly handle all our cases.

  • block exists, no commitment, 200 w/ empty list

  • block exists, has commitments, inside retention period (greater of protocol- or user-specified) serve then w/ 200 unless we hit an error reading them. we are technically not supposed to import a block to forkchoice unless we have the blobs, so the nuance here is if we can't find the file and we are inside the protocol-defined retention period, then it's actually a 500.

Which issues(s) does this PR fix?

related to #13134

@james-prysm james-prysm requested a review from a team as a code owner February 5, 2024 21:15
@james-prysm james-prysm added Bug Something isn't working API Api related tasks Deneb PRs or issues for the Deneb upgrade labels Feb 5, 2024
@@ -207,7 +215,25 @@ func (p *BeaconDbBlocker) Blobs(ctx context.Context, id string, indices []uint64
}
}
}

if !p.BeaconDB.HasBlock(ctx, bytesutil.ToBytes32(root)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe this isn't needed if i just use p.BeaconDB.Block()

@james-prysm james-prysm changed the title fixing the handling for certain cases Beacon API: get blob fix retention cases Feb 5, 2024
beacon-chain/rpc/eth/blob/handlers_test.go Outdated Show resolved Hide resolved
moc := &mockChain.ChainService{FinalizedCheckPoint: &eth.Checkpoint{Root: blockRoot[:]}}
blocker := &lookup.BeaconDbBlocker{
ChainInfoFetcher: moc,
GenesisTimeFetcher: moc, // max slot
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the meaning of the max slot comment? I don't think genesis time is set to max slot - it's set to zero.

@james-prysm james-prysm added this pull request to the merge queue Feb 6, 2024
Merged via the queue into develop with commit 1383546 Feb 6, 2024
17 checks passed
@james-prysm james-prysm deleted the blob-api-handle-retention branch February 6, 2024 22:37
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Api related tasks Bug Something isn't working Deneb PRs or issues for the Deneb upgrade
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants