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

@@ -2,6 +2,7 @@ use beacon_chain::store::metadata::CURRENT_SCHEMA_VERSION;
use beacon_chain::{BeaconChain, BeaconChainTypes};
use serde::Serialize;
use std::sync::Arc;
use store::invariants::InvariantCheckResult;
use store::{AnchorInfo, BlobInfo, Split, StoreConfig};
#[derive(Debug, Serialize)]
@@ -30,3 +31,11 @@ pub fn info<T: BeaconChainTypes>(
blob_info,
})
}
pub fn check_invariants<T: BeaconChainTypes>(
chain: Arc<BeaconChain<T>>,
) -> Result<InvariantCheckResult, warp::Rejection> {
chain.check_database_invariants().map_err(|e| {
warp_utils::reject::custom_bad_request(format!("error checking database invariants: {e:?}"))
})
}