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

Return HTTP 404 for pruned blob requests #6331

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

michaelsproul
Copy link
Member

@michaelsproul michaelsproul commented Aug 30, 2024

Issue Addressed

Closes:

Proposed Changes

  • Return a 404 if blob sidecars are requested and they do not exist in the database.
  • Return a 400 if blob sidecars are requested for a pre-Deneb block.

This resolves both cases of ambiguity where we currently return an empty list of blobs. Now, the empty blobs response is reserved exclusively for post-Deneb blocks that actually do not have any blobs.

This is motivated in part by the above issue, but also by the growing desire to allow importing/exporting blobs. In this case, some extra checks on the responses from the database are prudent in case a partial set of blobs is imported (something which may be quite desirable).

This is a breaking change to Lighthouse's behaviour, but IMO is still in keeping with the spec, which allows 404s for blocks that are not found.

Additional Info

I've added 2 new tests to confirm the new behaviour.

One oddity is that we will return [] for blocks without blobs even if the blobs in that range have been pruned. E.g. if we make a request at slot == 12 and oldest_blob_slot == 32 and the block from slot 12 is post-Deneb with 0 blobs, then we will return []. As long as we have the block stored we are capable of responding correctly, so we may as well. The alternative would be to artificially limit empty blob responses to just slots >= oldest_blob_slot.

.get_blobs(&root)
.map_err(|e| warp_utils::reject::beacon_chain_error(e.into()))?
.ok_or_else(|| {
warp_utils::reject::custom_not_found(format!(
Copy link
Member

Choose a reason for hiding this comment

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

This looks like a good change to me.

I'm not sure if we want to introduce new status codes, but there's also 410 Gone which would allow us to differentiate between block not found and expired blobs, without having to parse response message - but I'm also happy with 404.

In PeerDAS we'd also need a error response for nodes that are not capable of serving blobs data (custody columns < 64), and I think we might be returning 404 too? 😅

Copy link
Member Author

Choose a reason for hiding this comment

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

410 sounds good, but we would need to add it to the spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=dev#/Beacon/getBlobSidecars.

Maybe we can advocate for that, while returning 404 in the meantime?

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good!

Copy link
Member

@jimmygchen jimmygchen left a comment

Choose a reason for hiding this comment

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

Minor comment but looks good to me! Feel free to merge

@jimmygchen jimmygchen added ready-for-merge This PR is ready to merge. and removed ready-for-review The code is ready for review labels Aug 30, 2024
@michaelsproul
Copy link
Member Author

@mergify queue

Copy link

mergify bot commented Aug 30, 2024

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at e3d2d38

mergify bot added a commit that referenced this pull request Aug 30, 2024
@mergify mergify bot merged commit e3d2d38 into sigp:unstable Aug 30, 2024
28 checks passed
AgeManning pushed a commit to AgeManning/lighthouse that referenced this pull request Sep 3, 2024
* Return HTTP 404 for pruned blob requests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backwards-incompat Backwards-incompatible API change HTTP-API ready-for-merge This PR is ready to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants