mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
* Start extracting freezer changes for tree-states * Remove unused config args * Add comments * Remove unwraps * Subjective more clear implementation * Clean up hdiff * Update xdelta3 * Tree states archive metrics (#6040) * Add store cache size metrics * Add compress timer metrics * Add diff apply compute timer metrics * Add diff buffer cache hit metrics * Add hdiff buffer load times * Add blocks replayed metric * Move metrics to store * Future proof some metrics --------- Co-authored-by: Michael Sproul <michael@sigmaprime.io> * Port and clean up forwards iterator changes * Add and polish hierarchy-config flag * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Cleaner errors * Fix beacon_chain test compilation * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Patch a few more freezer block roots * Fix genesis block root bug * Fix test failing due to pending updates * Beacon chain tests passing * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Fix doc lint * Implement DB schema upgrade for hierarchical state diffs (#6193) * DB upgrade * Add flag * Delete RestorePointHash * Update docs * Update docs * Implement hierarchical state diffs config migration (#6245) * Implement hierarchical state diffs config migration * Review PR * Remove TODO * Set CURRENT_SCHEMA_VERSION correctly * Fix genesis state loading * Re-delete some PartialBeaconState stuff --------- Co-authored-by: Michael Sproul <michael@sigmaprime.io> * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Fix test compilation * Update schema downgrade test * Fix tests * Fix null anchor migration * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Fix tree states upgrade migration (#6328) * Towards crash safety * Fix compilation * Move cold summaries and state roots to new columns * Rename StateRoots chunked field * Update prune states * Clean hdiff CLI flag and metrics * Fix "staged reconstruction" * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Fix alloy issues * Fix staged reconstruction logic * Prevent weird slot drift * Remove "allow" flag * Update CLI help * Remove FIXME about downgrade * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Remove some unnecessary error variants * Fix new test * Tree states archive - review comments and metrics (#6386) * Review PR comments and metrics * Comments * Add anchor metrics * drop prev comment * Update metadata.rs * Apply suggestions from code review --------- Co-authored-by: Michael Sproul <micsproul@gmail.com> * Update beacon_node/store/src/hot_cold_store.rs Co-authored-by: Lion - dapplion <35266934+dapplion@users.noreply.github.com> * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Clarify comment and remove anchor_slot garbage * Simplify database anchor (#6397) * Simplify database anchor * Update beacon_node/store/src/reconstruct.rs * Add migration for anchor * Fix and simplify light_client store tests * Fix incompatible config test * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * More metrics * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * New historic state cache (#6475) * New historic state cache * Add more metrics * State cache hit rate metrics * Fix store metrics * More logs and metrics * Fix logger * Ensure cached states have built caches :O * Replay blocks in preference to diffing * Two separate caches * Distribute cache build time to next slot * Re-plumb historic-state-cache flag * Clean up metrics * Update book * Update beacon_node/store/src/hdiff.rs Co-authored-by: Lion - dapplion <35266934+dapplion@users.noreply.github.com> * Update beacon_node/store/src/historic_state_cache.rs Co-authored-by: Lion - dapplion <35266934+dapplion@users.noreply.github.com> --------- Co-authored-by: Lion - dapplion <35266934+dapplion@users.noreply.github.com> * Update database docs * Update diagram * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Update lockbud to work with bindgen/etc * Correct pkg name for Debian * Remove vestigial epochs_per_state_diff * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Markdown lint * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Address Jimmy's review comments * Simplify ReplayFrom case * Fix and document genesis_state_root * Typo Co-authored-by: Jimmy Chen <jchen.tc@gmail.com> * Merge branch 'unstable' into tree-states-archive * Compute diff of validators list manually (#6556) * Split hdiff computation * Dedicated logic for historical roots and summaries * Benchmark against real states * Mutated source? * Version the hdiff * Add lighthouse DB config for hierarchy exponents * Tidy up hierarchy exponents flag * Apply suggestions from code review Co-authored-by: Michael Sproul <micsproul@gmail.com> * Address PR review * Remove hardcoded paths in benchmarks * Delete unused function in benches * lint --------- Co-authored-by: Michael Sproul <michael@sigmaprime.io> * Test hdiff binary format stability (#6585) * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Add deprecation warning for SPRP * Update xdelta to get rid of duplicate deps * Document test
459 lines
11 KiB
Markdown
459 lines
11 KiB
Markdown
## beacon.watch
|
|
|
|
>beacon.watch is pre-MVP and still under active development and subject to change.
|
|
|
|
beacon.watch is an Ethereum Beacon Chain monitoring platform whose goal is to provide fast access to
|
|
data which is:
|
|
1. Not already stored natively in the Beacon Chain
|
|
2. Too specialized for Block Explorers
|
|
3. Too sensitive for public Block Explorers
|
|
|
|
|
|
### Requirements
|
|
- `git`
|
|
- `rust` : https://rustup.rs/
|
|
- `libpq` : https://www.postgresql.org/download/
|
|
- `diesel_cli` :
|
|
```
|
|
cargo install diesel_cli --no-default-features --features postgres
|
|
```
|
|
- `docker` : https://docs.docker.com/engine/install/
|
|
- `docker-compose` : https://docs.docker.com/compose/install/
|
|
|
|
### Setup
|
|
1. Setup the database:
|
|
```
|
|
cd postgres_docker_compose
|
|
docker-compose up
|
|
```
|
|
|
|
1. Ensure the tests pass:
|
|
```
|
|
cargo test --release
|
|
```
|
|
|
|
1. Drop the database (if it already exists) and run the required migrations:
|
|
```
|
|
diesel database reset --database-url postgres://postgres:postgres@localhost/dev
|
|
```
|
|
|
|
1. Ensure a synced Lighthouse beacon node with historical states is available
|
|
at `localhost:5052`.
|
|
|
|
1. Run the updater daemon:
|
|
```
|
|
cargo run --release -- run-updater
|
|
```
|
|
|
|
1. Start the HTTP API server:
|
|
```
|
|
cargo run --release -- serve
|
|
```
|
|
|
|
1. Ensure connectivity:
|
|
```
|
|
curl "http://localhost:5059/v1/slots/highest"
|
|
```
|
|
|
|
> Functionality on MacOS has not been tested. Windows is not supported.
|
|
|
|
|
|
### Configuration
|
|
beacon.watch can be configured through the use of a config file.
|
|
Available options can be seen in `config.yaml.default`.
|
|
|
|
You can specify a config file during runtime:
|
|
```
|
|
cargo run -- run-updater --config path/to/config.yaml
|
|
cargo run -- serve --config path/to/config.yaml
|
|
```
|
|
|
|
You can specify only the parts of the config file which you need changed.
|
|
Missing values will remain as their defaults.
|
|
|
|
For example, if you wish to run with default settings but only wish to alter `log_level`
|
|
your config file would be:
|
|
```yaml
|
|
# config.yaml
|
|
log_level = "info"
|
|
```
|
|
|
|
### Available Endpoints
|
|
As beacon.watch continues to develop, more endpoints will be added.
|
|
|
|
> In these examples any data containing information from blockprint has either been redacted or fabricated.
|
|
|
|
#### `/v1/slots/{slot}`
|
|
```bash
|
|
curl "http://localhost:5059/v1/slots/4635296"
|
|
```
|
|
```json
|
|
{
|
|
"slot": "4635296",
|
|
"root": "0xf7063a9d6c663682e59bd0b41d29ce80c3ff0b089049ff8676d6f9ee79622c62",
|
|
"skipped": false,
|
|
"beacon_block": "0xf7063a9d6c663682e59bd0b41d29ce80c3ff0b089049ff8676d6f9ee79622c62"
|
|
}
|
|
```
|
|
|
|
#### `/v1/slots?start_slot={}&end_slot={}`
|
|
```bash
|
|
curl "http://localhost:5059/v1/slots?start_slot=4635296&end_slot=4635297"
|
|
```
|
|
```json
|
|
[
|
|
{
|
|
"slot": "4635297",
|
|
"root": "0x04ad2e963811207e344bebeba5b1217805bcc3a9e2ed9fcf2205d491778c6182",
|
|
"skipped": false,
|
|
"beacon_block": "0x04ad2e963811207e344bebeba5b1217805bcc3a9e2ed9fcf2205d491778c6182"
|
|
},
|
|
{
|
|
"slot": "4635296",
|
|
"root": "0xf7063a9d6c663682e59bd0b41d29ce80c3ff0b089049ff8676d6f9ee79622c62",
|
|
"skipped": false,
|
|
"beacon_block": "0xf7063a9d6c663682e59bd0b41d29ce80c3ff0b089049ff8676d6f9ee79622c62"
|
|
}
|
|
]
|
|
```
|
|
|
|
#### `/v1/slots/lowest`
|
|
```bash
|
|
curl "http://localhost:5059/v1/slots/lowest"
|
|
```
|
|
```json
|
|
{
|
|
"slot": "4635296",
|
|
"root": "0xf7063a9d6c663682e59bd0b41d29ce80c3ff0b089049ff8676d6f9ee79622c62",
|
|
"skipped": false,
|
|
"beacon_block": "0xf7063a9d6c663682e59bd0b41d29ce80c3ff0b089049ff8676d6f9ee79622c62"
|
|
}
|
|
```
|
|
|
|
#### `/v1/slots/highest`
|
|
```bash
|
|
curl "http://localhost:5059/v1/slots/highest"
|
|
```
|
|
```json
|
|
{
|
|
"slot": "4635358",
|
|
"root": "0xe9eff13560688f1bf15cf07b60c84963d4d04a4a885ed0eb19ceb8450011894b",
|
|
"skipped": false,
|
|
"beacon_block": "0xe9eff13560688f1bf15cf07b60c84963d4d04a4a885ed0eb19ceb8450011894b"
|
|
}
|
|
```
|
|
|
|
#### `v1/slots/{slot}/block`
|
|
```bash
|
|
curl "http://localhost:5059/v1/slots/4635296/block"
|
|
```
|
|
```json
|
|
{
|
|
"slot": "4635296",
|
|
"root": "0xf7063a9d6c663682e59bd0b41d29ce80c3ff0b089049ff8676d6f9ee79622c62",
|
|
"parent_root": "0x7c4860b420a23de9d126da71f9043b3744af98c847efd9e1440f2da8fbf7f31b"
|
|
}
|
|
```
|
|
|
|
#### `/v1/blocks/{block_id}`
|
|
```bash
|
|
curl "http://localhost:5059/v1/blocks/4635296"
|
|
# OR
|
|
curl "http://localhost:5059/v1/blocks/0xf7063a9d6c663682e59bd0b41d29ce80c3ff0b089049ff8676d6f9ee79622c62"
|
|
```
|
|
```json
|
|
{
|
|
"slot": "4635296",
|
|
"root": "0xf7063a9d6c663682e59bd0b41d29ce80c3ff0b089049ff8676d6f9ee79622c62",
|
|
"parent_root": "0x7c4860b420a23de9d126da71f9043b3744af98c847efd9e1440f2da8fbf7f31b"
|
|
}
|
|
```
|
|
|
|
#### `/v1/blocks?start_slot={}&end_slot={}`
|
|
```bash
|
|
curl "http://localhost:5059/v1/blocks?start_slot=4635296&end_slot=4635297"
|
|
```
|
|
```json
|
|
[
|
|
{
|
|
"slot": "4635297",
|
|
"root": "0x04ad2e963811207e344bebeba5b1217805bcc3a9e2ed9fcf2205d491778c6182",
|
|
"parent_root": "0xf7063a9d6c663682e59bd0b41d29ce80c3ff0b089049ff8676d6f9ee79622c62"
|
|
},
|
|
{
|
|
"slot": "4635296",
|
|
"root": "0xf7063a9d6c663682e59bd0b41d29ce80c3ff0b089049ff8676d6f9ee79622c62",
|
|
"parent_root": "0x7c4860b420a23de9d126da71f9043b3744af98c847efd9e1440f2da8fbf7f31b"
|
|
}
|
|
]
|
|
```
|
|
|
|
#### `/v1/blocks/{block_id}/previous`
|
|
```bash
|
|
curl "http://localhost:5059/v1/blocks/4635297/previous"
|
|
# OR
|
|
curl "http://localhost:5059/v1/blocks/0x04ad2e963811207e344bebeba5b1217805bcc3a9e2ed9fcf2205d491778c6182/previous"
|
|
```
|
|
```json
|
|
{
|
|
"slot": "4635296",
|
|
"root": "0xf7063a9d6c663682e59bd0b41d29ce80c3ff0b089049ff8676d6f9ee79622c62",
|
|
"parent_root": "0x7c4860b420a23de9d126da71f9043b3744af98c847efd9e1440f2da8fbf7f31b"
|
|
}
|
|
```
|
|
|
|
#### `/v1/blocks/{block_id}/next`
|
|
```bash
|
|
curl "http://localhost:5059/v1/blocks/4635296/next"
|
|
# OR
|
|
curl "http://localhost:5059/v1/blocks/0xf7063a9d6c663682e59bd0b41d29ce80c3ff0b089049ff8676d6f9ee79622c62/next"
|
|
```
|
|
```json
|
|
{
|
|
"slot": "4635297",
|
|
"root": "0x04ad2e963811207e344bebeba5b1217805bcc3a9e2ed9fcf2205d491778c6182",
|
|
"parent_root": "0xf7063a9d6c663682e59bd0b41d29ce80c3ff0b089049ff8676d6f9ee79622c62"
|
|
}
|
|
```
|
|
|
|
#### `/v1/blocks/lowest`
|
|
```bash
|
|
curl "http://localhost:5059/v1/blocks/lowest"
|
|
```
|
|
```json
|
|
{
|
|
"slot": "4635296",
|
|
"root": "0xf7063a9d6c663682e59bd0b41d29ce80c3ff0b089049ff8676d6f9ee79622c62",
|
|
"parent_root": "0x7c4860b420a23de9d126da71f9043b3744af98c847efd9e1440f2da8fbf7f31b"
|
|
}
|
|
```
|
|
|
|
#### `/v1/blocks/highest`
|
|
```bash
|
|
curl "http://localhost:5059/v1/blocks/highest"
|
|
```
|
|
```json
|
|
{
|
|
"slot": "4635358",
|
|
"root": "0xe9eff13560688f1bf15cf07b60c84963d4d04a4a885ed0eb19ceb8450011894b",
|
|
"parent_root": "0xb66e05418bb5b1d4a965c994e1f0e5b5f0d7b780e0df12f3f6321510654fa1d2"
|
|
}
|
|
```
|
|
|
|
#### `/v1/blocks/{block_id}/proposer`
|
|
```bash
|
|
curl "http://localhost:5059/v1/blocks/4635296/proposer"
|
|
# OR
|
|
curl "http://localhost:5059/v1/blocks/0xf7063a9d6c663682e59bd0b41d29ce80c3ff0b089049ff8676d6f9ee79622c62/proposer"
|
|
|
|
```
|
|
```json
|
|
{
|
|
"slot": "4635296",
|
|
"proposer_index": 223126,
|
|
"graffiti": ""
|
|
}
|
|
```
|
|
|
|
#### `/v1/blocks/{block_id}/rewards`
|
|
```bash
|
|
curl "http://localhost:5059/v1/blocks/4635296/reward"
|
|
# OR
|
|
curl "http://localhost:5059/v1/blocks/0xf7063a9d6c663682e59bd0b41d29ce80c3ff0b089049ff8676d6f9ee79622c62/reward"
|
|
|
|
```
|
|
```json
|
|
{
|
|
"slot": "4635296",
|
|
"total": 25380059,
|
|
"attestation_reward": 24351867,
|
|
"sync_committee_reward": 1028192
|
|
}
|
|
```
|
|
|
|
#### `/v1/blocks/{block_id}/packing`
|
|
```bash
|
|
curl "http://localhost:5059/v1/blocks/4635296/packing"
|
|
# OR
|
|
curl "http://localhost:5059/v1/blocks/0xf7063a9d6c663682e59bd0b41d29ce80c3ff0b089049ff8676d6f9ee79622c62/packing"
|
|
|
|
```
|
|
```json
|
|
{
|
|
"slot": "4635296",
|
|
"available": 16152,
|
|
"included": 13101,
|
|
"prior_skip_slots": 0
|
|
}
|
|
```
|
|
|
|
#### `/v1/validators/{validator}`
|
|
```bash
|
|
curl "http://localhost:5059/v1/validators/1"
|
|
# OR
|
|
curl "http://localhost:5059/v1/validators/0xa1d1ad0714035353258038e964ae9675dc0252ee22cea896825c01458e1807bfad2f9969338798548d9858a571f7425c"
|
|
```
|
|
```json
|
|
{
|
|
"index": 1,
|
|
"public_key": "0xa1d1ad0714035353258038e964ae9675dc0252ee22cea896825c01458e1807bfad2f9969338798548d9858a571f7425c",
|
|
"status": "active_ongoing",
|
|
"client": null,
|
|
"activation_epoch": 0,
|
|
"exit_epoch": null
|
|
}
|
|
```
|
|
|
|
#### `/v1/validators/{validator}/attestation/{epoch}`
|
|
```bash
|
|
curl "http://localhost:5059/v1/validators/1/attestation/144853"
|
|
# OR
|
|
curl "http://localhost:5059/v1/validators/0xa1d1ad0714035353258038e964ae9675dc0252ee22cea896825c01458e1807bfad2f9969338798548d9858a571f7425c/attestation/144853"
|
|
```
|
|
```json
|
|
{
|
|
"index": 1,
|
|
"epoch": "144853",
|
|
"source": true,
|
|
"head": true,
|
|
"target": true
|
|
}
|
|
```
|
|
|
|
#### `/v1/validators/missed/{vote}/{epoch}`
|
|
```bash
|
|
curl "http://localhost:5059/v1/validators/missed/head/144853"
|
|
```
|
|
```json
|
|
[
|
|
63,
|
|
67,
|
|
98,
|
|
...
|
|
]
|
|
```
|
|
|
|
#### `/v1/validators/missed/{vote}/{epoch}/graffiti`
|
|
```bash
|
|
curl "http://localhost:5059/v1/validators/missed/head/144853/graffiti"
|
|
```
|
|
```json
|
|
{
|
|
"Mr F was here": 3,
|
|
"Lighthouse/v3.1.0-aa022f4": 5,
|
|
...
|
|
}
|
|
```
|
|
|
|
#### `/v1/clients/missed/{vote}/{epoch}`
|
|
```bash
|
|
curl "http://localhost:5059/v1/clients/missed/source/144853"
|
|
```
|
|
```json
|
|
{
|
|
"Lighthouse": 100,
|
|
"Lodestar": 100,
|
|
"Nimbus": 100,
|
|
"Prysm": 100,
|
|
"Teku": 100,
|
|
"Unknown": 100
|
|
}
|
|
```
|
|
|
|
#### `/v1/clients/missed/{vote}/{epoch}/percentages`
|
|
Note that this endpoint expresses the following:
|
|
```
|
|
What percentage of each client implementation missed this vote?
|
|
```
|
|
|
|
```bash
|
|
curl "http://localhost:5059/v1/clients/missed/target/144853/percentages"
|
|
```
|
|
```json
|
|
{
|
|
"Lighthouse": 0.51234567890,
|
|
"Lodestar": 0.51234567890,
|
|
"Nimbus": 0.51234567890,
|
|
"Prysm": 0.09876543210,
|
|
"Teku": 0.09876543210,
|
|
"Unknown": 0.05647382910
|
|
}
|
|
```
|
|
|
|
#### `/v1/clients/missed/{vote}/{epoch}/percentages/relative`
|
|
Note that this endpoint expresses the following:
|
|
```
|
|
For the validators which did miss this vote, what percentage of them were from each client implementation?
|
|
```
|
|
You can check these values against the output of `/v1/clients/percentages` to see any discrepancies.
|
|
|
|
```bash
|
|
curl "http://localhost:5059/v1/clients/missed/target/144853/percentages/relative"
|
|
```
|
|
```json
|
|
{
|
|
"Lighthouse": 11.11111111111111,
|
|
"Lodestar": 11.11111111111111,
|
|
"Nimbus": 11.11111111111111,
|
|
"Prysm": 16.66666666666667,
|
|
"Teku": 16.66666666666667,
|
|
"Unknown": 33.33333333333333
|
|
}
|
|
|
|
```
|
|
|
|
#### `/v1/clients`
|
|
```bash
|
|
curl "http://localhost:5059/v1/clients"
|
|
```
|
|
```json
|
|
{
|
|
"Lighthouse": 5000,
|
|
"Lodestar": 5000,
|
|
"Nimbus": 5000,
|
|
"Prysm": 5000,
|
|
"Teku": 5000,
|
|
"Unknown": 5000
|
|
}
|
|
```
|
|
|
|
#### `/v1/clients/percentages`
|
|
```bash
|
|
curl "http://localhost:5059/v1/clients/percentages"
|
|
```
|
|
```json
|
|
{
|
|
"Lighthouse": 16.66666666666667,
|
|
"Lodestar": 16.66666666666667,
|
|
"Nimbus": 16.66666666666667,
|
|
"Prysm": 16.66666666666667,
|
|
"Teku": 16.66666666666667,
|
|
"Unknown": 16.66666666666667
|
|
}
|
|
```
|
|
|
|
### Future work
|
|
- New tables
|
|
- `skip_slots`?
|
|
|
|
|
|
- More API endpoints
|
|
- `/v1/proposers?start_epoch={}&end_epoch={}` and similar
|
|
- `/v1/validators/{status}/count`
|
|
|
|
|
|
- Concurrently backfill and forwards fill, so forwards fill is not bottlenecked by large backfills.
|
|
|
|
|
|
- Better/prettier (async?) logging.
|
|
|
|
|
|
- Connect to a range of beacon_nodes to sync different components concurrently.
|
|
Generally, processing certain api queries such as `block_packing` and `attestation_performance` take the longest to sync.
|
|
|
|
|
|
### Architecture
|
|
Connection Pooling:
|
|
- 1 Pool for Updater (read and write)
|
|
- 1 Pool for HTTP Server (should be read only, although not sure if we can enforce this)
|