lighthouse-pulse/beacon_node
Michael Sproul 61ed5f0ec6 Optimize historic committee calculation for the HTTP API (#3272)
## Issue Addressed

Closes https://github.com/sigp/lighthouse/issues/3270

## Proposed Changes

Optimize the calculation of historic beacon committees in the HTTP API.

This is achieved by allowing committee caches to be constructed for historic epochs, and constructing these committee caches on the fly in the API. This is much faster than reconstructing the state at the requested epoch, which usually takes upwards of 20s, and sometimes minutes with SPRP=8192. The depth of the `randao_mixes` array allows us to look back 64K epochs/0.8 years from a single state, which is pretty awesome!

We always use the `state_id` provided by the caller, but will return a nice 400 error if the epoch requested is out of range for the state requested, e.g.

```bash
# Prater
curl "http://localhost:5052/eth/v1/beacon/states/3170304/committees?epoch=33538"
```

```json
{"code":400,"message":"BAD_REQUEST: epoch out of bounds, try state at slot 1081344","stacktraces":[]}
```

Queries will be fastest when aligned to `slot % SPRP == 0`, so the hint suggests a slot that is 0 mod 8192.
2022-07-04 02:56:11 +00:00
..
beacon_chain Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
builder_client Remove builder redundancy (#3294) 2022-07-01 01:15:19 +00:00
client Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
eth1 Unify execution layer endpoints (#3214) 2022-06-29 09:07:09 +00:00
execution_layer Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
genesis Unify execution layer endpoints (#3214) 2022-06-29 09:07:09 +00:00
http_api Optimize historic committee calculation for the HTTP API (#3272) 2022-07-04 02:56:11 +00:00
http_metrics Support IPv6 in BN and VC HTTP APIs (#3104) 2022-03-24 00:04:49 +00:00
lighthouse_network Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
network Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
operation_pool Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
src Remove builder redundancy (#3294) 2022-07-01 01:15:19 +00:00
store Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
tests Altair consensus changes and refactors (#2279) 2021-07-09 06:15:32 +00:00
timer Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
Cargo.toml v2.3.2-rc.0 (#3289) 2022-06-28 03:03:30 +00:00