lighthouse/beacon_node
Paul Hauner 25f0e261cb Don't return errors when fork choice fails (#3370)
## Issue Addressed

NA

## Proposed Changes

There are scenarios where the only viable head will have an invalid execution payload, in this scenario the `get_head` function on `proto_array` will return an error. We must recover from this scenario by importing blocks from the network.

This PR stops `BeaconChain::recompute_head` from returning an error so that we can't accidentally start down-scoring peers or aborting block import just because the current head has an invalid payload.

## Reviewer Notes

The following changes are included:

1. Allow `fork_choice.get_head` to fail gracefully in `BeaconChain::process_block` when trying to update the `early_attester_cache`; simply don't add the block to the cache rather than aborting the entire process.
1. Don't return an error from `BeaconChain::recompute_head_at_current_slot` and `BeaconChain::recompute_head` to defensively prevent calling functions from aborting any process just because the fork choice function failed to run.
    - This should have practically no effect, since most callers were still continuing if recomputing the head failed.
    - The outlier is that the API will return 200 rather than a 500 when fork choice fails.
1. Add the `ProtoArrayForkChoice::set_all_blocks_to_optimistic` function to recover from the scenario where we've rebooted and the persisted fork choice has an invalid head.
2022-07-28 13:57:09 +00:00
..
beacon_chain Don't return errors when fork choice fails (#3370) 2022-07-28 13:57:09 +00:00
builder_client Remove builder redundancy (#3294) 2022-07-01 01:15:19 +00:00
client Merge readiness endpoint (#3349) 2022-07-21 05:45:39 +00:00
eth1 Fix Block Cache Range Math for Faster Syncing (#3358) 2022-07-26 02:17:21 +00:00
execution_layer Strict fee recipient (#3363) 2022-07-26 02:17:24 +00:00
genesis Unify execution layer endpoints (#3214) 2022-06-29 09:07:09 +00:00
http_api Don't return errors when fork choice fails (#3370) 2022-07-28 13:57:09 +00:00
http_metrics Support IPv6 in BN and VC HTTP APIs (#3104) 2022-03-24 00:04:49 +00:00
lighthouse_network Return ResourceUnavailable if we are unable to reconstruct execution payloads (#3365) 2022-07-27 03:20:00 +00:00
network Don't return errors when fork choice fails (#3370) 2022-07-28 13:57:09 +00:00
operation_pool Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
src Realized unrealized experimentation (#3322) 2022-07-25 23:53:26 +00:00
store Remove equivocating validators from fork choice (#3371) 2022-07-28 09:43:41 +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.4.0 (#3360) 2022-07-21 22:02:36 +00:00