Update book with missing Lighthouse endpoints (#3769)

## Proposed Changes


Adds docs for the following endpoints:
- `/lighthouse/analysis/attestation_performance`
- `/lighthouse/analysis/block_packing_efficiency`
This commit is contained in:
Mac L 2022-12-09 09:20:10 +00:00
parent 8cb9b5e126
commit 80dd615fff
2 changed files with 132 additions and 14 deletions

View File

@ -501,6 +501,102 @@ The endpoint will return immediately. See the beacon node logs for an indication
Manually provide `SignedBeaconBlock`s to backfill the database. This is intended Manually provide `SignedBeaconBlock`s to backfill the database. This is intended
for use by Lighthouse developers during testing only. for use by Lighthouse developers during testing only.
### `/lighthouse/merge_readiness`
```bash
curl -X GET "http://localhost:5052/lighthouse/merge_readiness" | jq
```
```
{
"data":{
"type":"ready",
"config":{
"terminal_total_difficulty":"6400"
},
"current_difficulty":"4800"
}
}
```
### `/lighthouse/analysis/attestation_performance/{index}`
Fetch information about the attestation performance of a validator index or all validators for a
range of consecutive epochs.
Two query parameters are required:
* `start_epoch` (inclusive): the first epoch to compute attestation performance for.
* `end_epoch` (inclusive): the final epoch to compute attestation performance for.
Example:
```bash
curl -X GET "http://localhost:5052/lighthouse/analysis/attestation_performance/1?start_epoch=1&end_epoch=1" | jq
```
```json
[
{
"index": 1,
"epochs": {
"1": {
"active": true,
"head": true,
"target": true,
"source": true,
"delay": 1
}
}
}
]
```
Instead of specifying a validator index, you can specify the entire validator set by using `global`:
```bash
curl -X GET "http://localhost:5052/lighthouse/analysis/attestation_performance/global?start_epoch=1&end_epoch=1" | jq
```
```json
[
{
"index": 0,
"epochs": {
"1": {
"active": true,
"head": true,
"target": true,
"source": true,
"delay": 1
}
}
},
{
"index": 1,
"epochs": {
"1": {
"active": true,
"head": true,
"target": true,
"source": true,
"delay": 1
}
}
},
{
..
}
]
```
Caveats:
* For maximum efficiency the start_epoch should satisfy `(start_epoch * slots_per_epoch) % slots_per_restore_point == 1`.
This is because the state _prior_ to the `start_epoch` needs to be loaded from the database,
and loading a state on a boundary is most efficient.
### `/lighthouse/analysis/block_rewards` ### `/lighthouse/analysis/block_rewards`
Fetch information about the block rewards paid to proposers for a range of consecutive blocks. Fetch information about the block rewards paid to proposers for a range of consecutive blocks.
@ -513,7 +609,7 @@ Two query parameters are required:
Example: Example:
```bash ```bash
curl "http://localhost:5052/lighthouse/analysis/block_rewards?start_slot=1&end_slot=32" | jq curl -X GET "http://localhost:5052/lighthouse/analysis/block_rewards?start_slot=1&end_slot=32" | jq
``` ```
```json ```json
@ -541,21 +637,43 @@ Caveats:
[block_reward_src]: [block_reward_src]:
https://github.com/sigp/lighthouse/tree/unstable/common/eth2/src/lighthouse/block_rewards.rs https://github.com/sigp/lighthouse/tree/unstable/common/eth2/src/lighthouse/block_rewards.rs
### `/lighthouse/analysis/block_packing`
### `/lighthouse/merge_readiness` Fetch information about the block packing efficiency of blocks for a range of consecutive
epochs.
Two query parameters are required:
* `start_epoch` (inclusive): the epoch of the first block to compute packing efficiency for.
* `end_epoch` (inclusive): the epoch of the last block to compute packing efficiency for.
```bash ```bash
curl -X GET "http://localhost:5052/lighthouse/merge_readiness" curl -X GET "http://localhost:5052/lighthouse/analysis/block_packing_efficiency?start_epoch=1&end_epoch=1" | jq
``` ```
``` ```json
[
{ {
"data":{ "slot": "33",
"type":"ready", "block_hash": "0xb20970bb97c6c6de6b1e2b689d6381dd15b3d3518fbaee032229495f963bd5da",
"config":{ "proposer_info": {
"terminal_total_difficulty":"6400" "validator_index": 855,
"graffiti": "poapZoJ7zWNfK7F3nWjEausWVBvKa6gA"
}, },
"current_difficulty":"4800" "available_attestations": 3805,
} "included_attestations": 1143,
"prior_skip_slots": 1
},
{
..
} }
]
``` ```
Caveats:
* `start_epoch` must not be `0`.
* For maximum efficiency the `start_epoch` should satisfy `(start_epoch * slots_per_epoch) % slots_per_restore_point == 1`.
This is because the state _prior_ to the `start_epoch` needs to be loaded from the database, and
loading a state on a boundary is most efficient.

View File

@ -6,4 +6,4 @@ RESTful HTTP/JSON APIs.
There are two APIs served by Lighthouse: There are two APIs served by Lighthouse:
- [Beacon Node API](./api-bn.md) - [Beacon Node API](./api-bn.md)
- [Validator Client API](./api-vc.md) (not yet released). - [Validator Client API](./api-vc.md)