lighthouse/beacon_node/beacon_chain/src
Paul Hauner 8609cced0e Reset payload statuses when resuming fork choice (#3498)
## Issue Addressed

NA

## Proposed Changes

This PR is motivated by a recent consensus failure in Geth where it returned `INVALID` for an `VALID` block. Without this PR, the only way to recover is by re-syncing Lighthouse. Whilst ELs "shouldn't have consensus failures", in reality it's something that we can expect from time to time due to the complex nature of Ethereum. Being able to recover easily will help the network recover and EL devs to troubleshoot.

The risk introduced with this PR is that genuinely INVALID payloads get a "second chance" at being imported. I believe the DoS risk here is negligible since LH needs to be restarted in order to re-process the payload. Furthermore, there's no reason to think that a well-performing EL will accept a truly invalid payload the second-time-around.

## Additional Info

This implementation has the following intricacies:

1. Instead of just resetting *invalid* payloads to optimistic, we'll also reset *valid* payloads. This is an artifact of our existing implementation.
1. We will only reset payload statuses when we detect an invalid payload present in `proto_array`
    - This helps save us from forgetting that all our blocks are valid in the "best case scenario" where there are no invalid blocks.
1. If we fail to revert the payload statuses we'll log a `CRIT` and just continue with a `proto_array` that *does not* have reverted payload statuses.
    - The code to revert statuses needs to deal with balances and proposer-boost, so it's a failure point. This is a defensive measure to avoid introducing new show-stopping bugs to LH.
2022-08-29 14:34:41 +00:00
..
attestation_verification Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
schema_change Refactor op pool for speed and correctness (#3312) 2022-08-29 09:10:26 +00:00
attestation_verification.rs Refactor op pool for speed and correctness (#3312) 2022-08-29 09:10:26 +00:00
attester_cache.rs Add early attester cache (#2872) 2022-01-11 01:35:55 +00:00
beacon_chain.rs Reset payload statuses when resuming fork choice (#3498) 2022-08-29 14:34:41 +00:00
beacon_fork_choice_store.rs Remove equivocating validators from fork choice (#3371) 2022-07-28 09:43:41 +00:00
beacon_proposer_cache.rs Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
beacon_snapshot.rs Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
block_reward.rs Refactor op pool for speed and correctness (#3312) 2022-08-29 09:10:26 +00:00
block_times_cache.rs Add BlockTimesCache to allow additional block delay metrics (#2546) 2021-09-30 04:31:41 +00:00
block_verification.rs Refactor op pool for speed and correctness (#3312) 2022-08-29 09:10:26 +00:00
builder.rs Reset payload statuses when resuming fork choice (#3498) 2022-08-29 14:34:41 +00:00
canonical_head.rs Reset payload statuses when resuming fork choice (#3498) 2022-08-29 14:34:41 +00:00
chain_config.rs Reset payload statuses when resuming fork choice (#3498) 2022-08-29 14:34:41 +00:00
early_attester_cache.rs Fix some typos (#3376) 2022-07-27 00:51:06 +00:00
errors.rs Builder Specs v0.2.0 (#3134) 2022-07-30 00:22:37 +00:00
eth1_chain.rs Removed PowBlock struct that never got used (#2813) 2021-12-02 14:29:20 +11:00
events.rs Implement API for block rewards (#2628) 2022-01-27 01:06:02 +00:00
execution_payload.rs Remove INVALID_TERMINAL_BLOCK (#3385) 2022-08-10 07:52:58 +00:00
fork_choice_signal.rs Run fork choice before block proposal (#3168) 2022-05-20 05:02:11 +00:00
fork_revert.rs Realized unrealized experimentation (#3322) 2022-07-25 23:53:26 +00:00
head_tracker.rs Altair consensus changes and refactors (#2279) 2021-07-09 06:15:32 +00:00
historical_blocks.rs Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
lib.rs Pause sync when EE is offline (#3428) 2022-08-24 23:34:56 +00:00
merge_readiness.rs Increase merge-readiness lookhead (#3463) 2022-08-15 01:30:59 +00:00
metrics.rs Run fork choice before block proposal (#3168) 2022-05-20 05:02:11 +00:00
migrate.rs Avoid parallel fork choice runs during sync (#3217) 2022-05-25 03:27:30 +00:00
naive_aggregation_pool.rs Update to Rust 1.59 and 2021 edition (#3038) 2022-02-25 00:10:17 +00:00
observed_aggregates.rs v2.2.0 (#3139) 2022-04-05 02:53:09 +00:00
observed_attesters.rs Ensure doppelganger detects attestations in blocks (#2495) 2021-08-09 02:43:03 +00:00
observed_block_producers.rs Doppelganger detection (#2230) 2021-07-31 03:50:52 +00:00
observed_operations.rs Refactor op pool for speed and correctness (#3312) 2022-08-29 09:10:26 +00:00
otb_verification_service.rs Initial Commit of Retrospective OTB Verification (#3372) 2022-07-30 00:22:38 +00:00
persisted_beacon_chain.rs Fix head tracker concurrency bugs (#1771) 2020-10-19 05:58:39 +00:00
persisted_fork_choice.rs Remove equivocating validators from fork choice (#3371) 2022-07-28 09:43:41 +00:00
pre_finalization_cache.rs Separate execution payloads in the DB (#3157) 2022-05-12 00:42:17 +00:00
proposer_prep_service.rs Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
schema_change.rs Refactor op pool for speed and correctness (#3312) 2022-08-29 09:10:26 +00:00
shuffling_cache.rs Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
snapshot_cache.rs Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
state_advance_timer.rs Run per-slot fork choice at a further distance from the head (#3487) 2022-08-19 04:27:24 +00:00
sync_committee_verification.rs Update to Rust 1.59 and 2021 edition (#3038) 2022-02-25 00:10:17 +00:00
test_utils.rs Refactor op pool for speed and correctness (#3312) 2022-08-29 09:10:26 +00:00
timeout_rw_lock.rs Add flag to disable lock timeouts (#2714) 2021-10-19 00:30:40 +00:00
validator_monitor.rs Fix validator_monitor_prev_epoch_ metrics (#2911) 2022-06-20 04:06:30 +00:00
validator_pubkey_cache.rs Add support for beaconAPI in lcli functions (#3252) 2022-08-09 06:05:13 +00:00