lighthouse/beacon_node/http_api/src
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
..
attestation_performance.rs Fix attestation performance API InvalidValidatorIndex error (#3503) 2022-09-05 04:50:45 +00:00
attester_duties.rs Indicate that invalid blocks are optimistic (#3383) 2022-07-30 05:08:57 +00:00
block_id.rs Fix lints for Rust 1.63 (#3459) 2022-08-12 00:56:39 +00:00
block_packing_efficiency.rs Separate execution payloads in the DB (#3157) 2022-05-12 00:42:17 +00:00
block_rewards.rs Refactor op pool for speed and correctness (#3312) 2022-08-29 09:10:26 +00:00
database.rs Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
lib.rs Separate committee subscriptions queue (#3508) 2022-08-30 05:47:31 +00:00
metrics.rs Metrics and DEBG log for late gossip blocks (#2533) 2021-08-23 00:59:14 +00:00
proposer_duties.rs Indicate that invalid blocks are optimistic (#3383) 2022-07-30 05:08:57 +00:00
publish_blocks.rs Don't return errors on HTTP API for already-known messages (#3341) 2022-08-10 07:52:57 +00:00
state_id.rs Indicate that invalid blocks are optimistic (#3383) 2022-07-30 05:08:57 +00:00
sync_committees.rs Don't return errors on HTTP API for already-known messages (#3341) 2022-08-10 07:52:57 +00:00
validator_inclusion.rs Add execution_optimistic flag to HTTP responses (#3070) 2022-07-25 08:23:00 +00:00
version.rs Add execution_optimistic flag to HTTP responses (#3070) 2022-07-25 08:23:00 +00:00