Optionally check DB invariants at runtime (#8952)

Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com>
This commit is contained in:
Lion - dapplion
2026-03-11 01:20:02 -05:00
committed by GitHub
parent 815040dc3c
commit 6350a27031
8 changed files with 918 additions and 0 deletions

View File

@@ -3007,6 +3007,19 @@ pub fn serve<T: BeaconChainTypes>(
},
);
// GET lighthouse/database/invariants
let get_lighthouse_database_invariants = database_path
.and(warp::path("invariants"))
.and(warp::path::end())
.and(task_spawner_filter.clone())
.and(chain_filter.clone())
.then(
|task_spawner: TaskSpawner<T::EthSpec>, chain: Arc<BeaconChain<T>>| {
task_spawner
.blocking_json_task(Priority::P1, move || database::check_invariants(chain))
},
);
// POST lighthouse/database/reconstruct
let post_lighthouse_database_reconstruct = database_path
.and(warp::path("reconstruct"))
@@ -3336,6 +3349,7 @@ pub fn serve<T: BeaconChainTypes>(
.uor(get_lighthouse_validator_inclusion)
.uor(get_lighthouse_staking)
.uor(get_lighthouse_database_info)
.uor(get_lighthouse_database_invariants)
.uor(get_lighthouse_custody_info)
.uor(get_lighthouse_attestation_performance)
.uor(get_beacon_light_client_optimistic_update)