lighthouse/beacon_node
Michael Sproul 7d644103c6 Tweak slasher DB schema and pruning (#1948)
## Issue Addressed

Resolves #1890

## Proposed Changes

Change the slasher database schema to key indexed attestations by `(target_epoch, indexed_attestation_root)` instead of just `indexed_attestation_root`. This allows more straight-forward pruning (linear scan), that is also "re-entrant". By re-entrant, we mean that a pruning pass that gets stuck because of a `MapFull` error can attempt to commit midway, and be resumed later without issue. The previous pruning strategy for indexed attestations did not have this property. There was also a flaw in the previous pruning that could leave "zombie" indexed attestations in the database (ones not referenced by any attester record), which could build up and contribute to bloat (although in practice I think they occur quite infrequently).

## Additional Info

During testing I noticed that a `MapFull` error can still occur during the commit of the transaction itself, which is irritating, but not unbearable. This PR should at least reduce the frequency with which users need to manually resize their DB, and if the `MapFull` on commit rears its ugly head too often we could use a dynamic strategy (temporarily increase the size of the map until the transaction commits).

The extra bytes for the epoch make the database a bit heavier, so the size estimate docs have been updated to reflect this. This is also a breaking schema change, so anyone using a v0 database from a few hours ago will need to drop it and update 😅
2020-11-23 21:33:51 +00:00
..
beacon_chain Implement slasher (#1567) 2020-11-23 03:43:22 +00:00
client Implement slasher (#1567) 2020-11-23 03:43:22 +00:00
eth1 Expand eth1 block cache, add more logs (#1938) 2020-11-21 00:26:15 +00:00
eth2_libp2p Add flag to import all attestations (#1941) 2020-11-22 23:58:25 +00:00
genesis Return eth1-related data via the API (#1797) 2020-11-02 00:37:30 +00:00
http_api Improve UX whilst VC is waiting for genesis (#1915) 2020-11-23 01:00:22 +00:00
http_metrics Support pre-flight CORS check (#1772) 2020-10-22 04:47:27 +00:00
network Implement slasher (#1567) 2020-11-23 03:43:22 +00:00
operation_pool Update pool/attestations and committees endpoints (#1899) 2020-11-18 23:31:39 +00:00
src Tweak slasher DB schema and pruning (#1948) 2020-11-23 21:33:51 +00:00
store Implement slasher (#1567) 2020-11-23 03:43:22 +00:00
tests Implement standard eth2.0 API (#1569) 2020-10-01 11:12:36 +10:00
timer Upgrade discovery and restructure task execution (#1693) 2020-10-05 18:45:54 +11:00
websocket_server Update external deps (#1711) 2020-10-05 08:22:19 +00:00
Cargo.toml Implement slasher (#1567) 2020-11-23 03:43:22 +00:00