-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Improve blobs Beacon API endpoint #14845
base: develop
Are you sure you want to change the base?
Conversation
for k, v := range m { | ||
if v { | ||
if k >= len(commitments) { | ||
return nil, &core.RpcError{ | ||
Err: fmt.Errorf("blob index %d is more than blob kzg commitment count %d for block %#x", k, len(commitments), root), | ||
Reason: core.Internal, | ||
} | ||
} | ||
if !indicesRequested { | ||
indices = append(indices, uint64(k)) | ||
} | ||
} else if indicesRequested { | ||
for _, ix := range indices { | ||
if uint64(k) == ix { | ||
return nil, &core.RpcError{Err: fmt.Errorf("no blob at index %d found for block %#x", k, root), Reason: core.NotFound} | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestions for making this more straightforward/readable welcome
blobs := make([]*blocks.VerifiedROBlob, len(indices)) | ||
for i, index := range indices { | ||
vblob, err := p.BlobStorage.Get(bytesutil.ToBytes32(root), index) | ||
if err != nil { | ||
log.WithFields(log.Fields{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this log and one more log because I don't see the point of logging out one specific thing from the whole function. As a matter of fact, I don't think we log out anything else from the whole Beacon API (note that this file is in beacon-chain/rpc
, so it's limited to APIs). In my opinion if we find such logs useful, we should write a middleware that will log out every error from httputil.HandleError
(most likely on the Debug
level)
What type of PR is this?
Other
What does this PR do? Why is it needed?
500 InternalServerError
when a blob for a requested index is not found. It would be more useful to return a 404 instead, letting the user know that we don't have the blob, not that something went wrong when trying to fetch it.Acknowledgements