prysm-pulse/beacon-chain/slasher
Manu NALEPA cb80d5ad32
Slasher: Reduce surrounding/surrounded attestations processing time (#13629)
* Improve package documentation.

* `processAttestations`: Improve logging.

* Add `Benchmark_checkSurroundVotes` benchmark.

* Implement `saveChunksToDisk` as remplacement of `saveUpdatedChunks`.

The idea is to open only on DB transaction for all validator chunk indexes instead of
one DB transaction per validator chunk index.

It saves the overhead due to transaction start/stop of the DB.

Result of `Benchmark_checkSurroundVotes`:
- Before this commit: 133 seconds
- After this commit: 5.05 seconds

* `LoadSlasherChunks` and `SaveSlasherChunks`: Batch.

* `loadChunks` ==> `loadChunksFromDisk`

* `updatedChunkByChunkIndex`: Don't update if `latestEpochWritten == currentEpoch `.

* `updatedChunkByChunkIndex`: Load all needed chunks once.

* `latestEpochWritten` ==> `latestEpochUpdated`.

* `checkSurroundVotes`: Dump to disk at most every `25_600` chunks.

* `SaveAttestationRecordsForValidators`: Batch.

* `batchSize`: Use as package const and add comment.
2024-02-21 15:12:37 +00:00
..
types Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
BUILD.bazel Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
chunks_test.go Slasher: Reduce cold start duration. (#13620) 2024-02-16 10:10:26 +00:00
chunks.go Slasher: Reduce cold start duration. (#13620) 2024-02-16 10:10:26 +00:00
detect_attestations_test.go Slasher: Reduce surrounding/surrounded attestations processing time (#13629) 2024-02-21 15:12:37 +00:00
detect_attestations.go Slasher: Reduce surrounding/surrounded attestations processing time (#13629) 2024-02-21 15:12:37 +00:00
detect_blocks_test.go Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
detect_blocks.go Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
doc.go Slasher: Reduce surrounding/surrounded attestations processing time (#13629) 2024-02-21 15:12:37 +00:00
helpers_test.go Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
helpers.go Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
log.go Slasher Simulator Code for Testing Optimized Slasher Behavior (#9695) 2021-09-29 02:27:21 +00:00
metrics.go Slasher Min/Max Chunk Logic (#9673) 2021-09-28 02:04:32 +00:00
params_test.go Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
params.go Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
process_slashings_test.go Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
process_slashings.go Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
queue_test.go Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
queue.go Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
receive_test.go Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
receive.go Slasher: Reduce surrounding/surrounded attestations processing time (#13629) 2024-02-21 15:12:37 +00:00
service_test.go Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
service.go Slasher: Reduce surrounding/surrounded attestations processing time (#13629) 2024-02-21 15:12:37 +00:00