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

Add Debug Block Endpoint + Return SSZ-Encoded #5926

Merged
merged 11 commits into from May 21, 2020
Merged

Conversation

rauljordan
Copy link
Contributor

What type of PR is this?

Feature

What does this PR do? Why is it needed?

This PR adds /eth/v1alpha1/debug/state and /eth/v1alpha1/debug/block to return an ssz-encoded response. It also allows the ability to get a beacon block by its root.

Which issues(s) does this PR fix?

Fixes #5918

@rauljordan rauljordan requested a review from a team as a code owner May 20, 2020 14:46
@rauljordan rauljordan self-assigned this May 20, 2020
@rauljordan rauljordan added API Api related tasks Ready For Review A pull request ready for code review labels May 20, 2020
if err != nil {
return nil, status.Errorf(codes.Internal, "Could not retrieve block by root: %v", err)
}
encoded, err := ssz.Marshal(signedBlock.Block)
Copy link
Member

Choose a reason for hiding this comment

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

don't you want to Marshal the whole thing including signature?

req *pbrpc.BlockRequest,
) (*pbrpc.SSZResponse, error) {
root := bytesutil.ToBytes32(req.BlockRoot)
signedBlock, err := ds.BeaconDB.Block(ctx, root)
Copy link
Member

Choose a reason for hiding this comment

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

what happens if it's nil?

@codecov
Copy link

codecov bot commented May 20, 2020

Codecov Report

Merging #5926 into master will increase coverage by 0.21%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #5926      +/-   ##
==========================================
+ Coverage   59.40%   59.61%   +0.21%     
==========================================
  Files         318      319       +1     
  Lines       26796    26862      +66     
==========================================
+ Hits        15917    16015      +98     
+ Misses       8720     8686      -34     
- Partials     2159     2161       +2     

@rauljordan rauljordan merged commit 881ad77 into master May 21, 2020
@rauljordan rauljordan deleted the debug-state-ssz branch May 21, 2020 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Api related tasks Ready For Review A pull request ready for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow States To Be Returned as SSZ Objects
2 participants