lighthouse/beacon_node/beacon_chain/tests
Michael Sproul ca42ef2e5a Prune finalized execution payloads (#3565)
## Issue Addressed

Closes https://github.com/sigp/lighthouse/issues/3556

## Proposed Changes

Delete finalized execution payloads from the database in two places:

1. When running the finalization migration in `migrate_database`. We delete the finalized payloads between the last split point and the new updated split point. _If_ payloads are already pruned prior to this then this is sufficient to prune _all_ payloads as non-canonical payloads are already deleted by the head pruner, and all canonical payloads prior to the previous split will already have been pruned.
2. To address the fact that users will update to this code _after_ the merge on mainnet (and testnets), we need a one-off scan to delete the finalized payloads from the canonical chain. This is implemented in `try_prune_execution_payloads` which runs on startup and scans the chain back to the Bellatrix fork or the anchor slot (if checkpoint synced after Bellatrix). In the case where payloads are already pruned this check only imposes a single state load for the split state, which shouldn't be _too slow_. Even so, a flag `--prepare-payloads-on-startup=false` is provided to turn this off after it has run the first time, which provides faster start-up times.

There is also a new `lighthouse db prune_payloads` subcommand for users who prefer to run the pruning manually.

## Additional Info

The tests have been updated to not rely on finalized payloads in the database, instead using the `MockExecutionLayer` to reconstruct them. Additionally a check was added to `check_chain_dump` which asserts the non-existence or existence of payloads on disk depending on their slot.
2022-09-17 02:27:01 +00:00
..
attestation_production.rs Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
attestation_verification.rs Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
block_verification.rs Prune finalized execution payloads (#3565) 2022-09-17 02:27:01 +00:00
main.rs Retrospective invalidation of exec. payloads for opt. sync (#2837) 2022-02-28 22:07:48 +00:00
merge.rs Don't create a execution payload with same timestamp as terminal block (#3331) 2022-07-18 23:15:41 +00:00
op_verification.rs Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
payload_invalidation.rs Remove INVALID_TERMINAL_BLOCK (#3385) 2022-08-10 07:52:58 +00:00
store_tests.rs Prune finalized execution payloads (#3565) 2022-09-17 02:27:01 +00:00
sync_committee_verification.rs Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
tests.rs Don't return errors when fork choice fails (#3370) 2022-07-28 13:57:09 +00:00