lighthouse-pulse/beacon_node
Mac L 80359d8ddb Fix attestation performance API InvalidValidatorIndex error (#3503)
## Issue Addressed

When requesting an index which is not active during `start_epoch`, Lighthouse returns: 
```
curl "http://localhost:5052/lighthouse/analysis/attestation_performance/999999999?start_epoch=100000&end_epoch=100000"
```
```json
{
  "code": 500,
  "message": "INTERNAL_SERVER_ERROR: ParticipationCache(InvalidValidatorIndex(999999999))",
  "stacktraces": []
}
```

This error occurs even when the index in question becomes active before `end_epoch` which is undesirable as it can prevent larger queries from completing.

## Proposed Changes

In the event the index is out-of-bounds (has not yet been activated), simply return all fields as `false`:

```
-> curl "http://localhost:5052/lighthouse/analysis/attestation_performance/999999999?start_epoch=100000&end_epoch=100000"
```
```json
[
  {
    "index": 999999999,
    "epochs": {
      "100000": {
        "active": false,
        "head": false,
        "target": false,
        "source": false
      }
    }
  }
]
```

By doing this, we cover the case where a validator becomes active sometime between `start_epoch` and `end_epoch`.

## Additional Info

Note that this error only occurs for epochs after the Altair hard fork.
2022-09-05 04:50:45 +00:00
..
beacon_chain Add more logging for invalid payloads (#3515) 2022-08-29 14:34:42 +00:00
builder_client Builder Specs v0.2.0 (#3134) 2022-07-30 00:22:37 +00:00
client Separate committee subscriptions queue (#3508) 2022-08-30 05:47:31 +00:00
eth1 Tidy eth1/deposit contract logging (#3397) 2022-08-01 07:20:43 +00:00
execution_layer Pause sync when EE is offline (#3428) 2022-08-24 23:34:56 +00:00
genesis Unify execution layer endpoints (#3214) 2022-06-29 09:07:09 +00:00
http_api Fix attestation performance API InvalidValidatorIndex error (#3503) 2022-09-05 04:50:45 +00:00
http_metrics Support IPv6 in BN and VC HTTP APIs (#3104) 2022-03-24 00:04:49 +00:00
lighthouse_network Subscribe to subnets only when needed (#3419) 2022-09-05 00:22:48 +00:00
network Subscribe to subnets only when needed (#3419) 2022-09-05 00:22:48 +00:00
operation_pool Refactor op pool for speed and correctness (#3312) 2022-08-29 09:10:26 +00:00
src Reset payload statuses when resuming fork choice (#3498) 2022-08-29 14:34:41 +00:00
store Refactor op pool for speed and correctness (#3312) 2022-08-29 09:10:26 +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 v3.1.0 (#3525) 2022-08-31 22:21:55 +00:00