sigp / lighthouse Public
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
Make API friendly to block explorers #702
Conversation
@ppratscher, I have finished implementing the endpoints you were after and I have addressed each point in the top of this PR. I will move onto unit testing next, however I have tested the endpoints by hand. If you are eager, feel free to start building off this branch. Otherwise, feel free to wait until it has been merged to master. |
@paulhauner thanks a lot for your efforts! we will be starting next week on Monday to add a compatibility layer to beaconcha.in in order to support lighthouse. Will report back in case we run into any issues. |
Just read the docs in this PR, everything looked good to me! Disappointed I couldn't find a single typo... :p |
Looks good overall, would just like to discuss some of the points raised about the /consensus
end point.
book/src/http_beacon.md
Outdated
|
||
### Returns | ||
|
||
Returns an object containing a single [`BeaconBlock`](https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/core/0_beacon-chain.md#beaconblock) and it's signed root. |
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.
its ;)
book/src/http_consensus.md
Outdated
- `previous_epoch_active_gwei`: as above, but during the previous epoch. | ||
- `current_epoch_attesting_gwei`: the total staked gwei that had one or more | ||
attestations included in a block during the current epoch (multiple | ||
attestations by the same validator does not increase this figure). |
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.
does not -> do not?
book/src/http_consensus.md
Outdated
figure must be equal to or less than `current_epoch_attesting_gwei`. | ||
- `previous_epoch_attesting_gwei`: see `current_epoch_attesting_gwei`. | ||
- `previous_epoch_target_attesting_gwei`: see `current_epoch_target_attesting_gwei`. | ||
- `previous_epoch_head_attesting_gwei`: see `previous_epoch_head_attesting_gwei`. |
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 guess this should read "see current_epoch_head_attesting_gwei
", and current_epoch_attesting_gwei
should have a description above. Would be nice to arrange all the current_
fields into one block of bullet points, and follow them with all the "see above" previous_
fields.
book/src/http_network.md
Outdated
|
||
## `/network/peers` | ||
|
||
Requests the beacon node for one `MultiAddr` for each connected peer. |
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.
Gramatically awkward, maybe:
Requests one
MultiAddr
for each peer connected to the beacon node
book/src/http_network.md
Outdated
|
||
## `network/enr` | ||
|
||
Requests the beacon node for it's listening `ENR` address. |
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.
its
book/src/http_consensus.md
Outdated
Method | GET | ||
JSON Encoding | Object | ||
Query Parameters | `epoch` |
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.
This should be a POST
method with query params None
.
book/src/http_consensus.md
Outdated
### Parameters | ||
|
||
Requires the `epoch` (`Epoch`) query parameter to determine which epoch will be | ||
considered the current epoch. |
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 think this should be a RequestBody
with epoch
and pubkeys
as parameters.
Thanks a lot for your efforts. Today we completed the integration of the lighthouse rpc api into our block explorer. Must of the calls work as expected, we just found 1 oddity: For some states calling An example would be retrieving the validators with the state root of slot 192: |
Thanks @ppratscher, I know exactly what this is and will fix it. |
All comments have been addressed :) |
Issue Addressed
Proposed Changes
Point-by-point addressing of @ppratscher's requests:
This has been done, see /beacon/block.
The
/beacon/validators
endpoint now includes the balance.The
/beacon/validators
endpoint now includes the validator index.The
/beacon/validators/all
endpoint serves this request. It's returning quite quickly on my end (40ms).The
/beacon/committees
endpoint should fulfill this request.The
consensus/global_votes
endpoint should serve this request.previous_epoch_active_gwei
previous_epoch_attesting_gwei
Notes
This is a work-in-progress.