lighthouse/consensus/state_processing/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
..
common Refactor op pool for speed and correctness (#3312) 2022-08-29 09:10:26 +00:00
per_block_processing Add test for exits spanning epochs (#3476) 2022-08-17 02:36:40 +00:00
per_epoch_processing Fix attestation performance API InvalidValidatorIndex error (#3503) 2022-09-05 04:50:45 +00:00
upgrade Refactor op pool for speed and correctness (#3312) 2022-08-29 09:10:26 +00:00
block_replayer.rs Separate execution payloads in the DB (#3157) 2022-05-12 00:42:17 +00:00
genesis.rs Update to spec v1.1.8 (#2893) 2022-01-19 00:24:19 +00:00
lib.rs Update to Rust 1.59 and 2021 edition (#3038) 2022-02-25 00:10:17 +00:00
macros.rs Directory Restructure (#1163) 2020-05-18 21:24:23 +10:00
metrics.rs Cache participating indices for Altair epoch processing (#2416) 2021-07-27 07:01:01 +00:00
per_block_processing.rs Add support for beaconAPI in lcli functions (#3252) 2022-08-09 06:05:13 +00:00
per_epoch_processing.rs Realized unrealized experimentation (#3322) 2022-07-25 23:53:26 +00:00
per_slot_processing.rs Update to spec v1.1.8 (#2893) 2022-01-19 00:24:19 +00:00
state_advance.rs Altair consensus changes and refactors (#2279) 2021-07-09 06:15:32 +00:00
upgrade.rs Update to spec v1.1.8 (#2893) 2022-01-19 00:24:19 +00:00
verify_operation.rs Refactor op pool for speed and correctness (#3312) 2022-08-29 09:10:26 +00:00