Custody persist fix (#7661)

N/A


  Persist the epoch -> cgc values. This is to ensure that `ValidatorRegistrations::latest_validator_custody_requirement` always returns a `Some` value post restart assuming the `epoch_validator_custody_requirements` map has been updated in the previous runs.
This commit is contained in:
Pawan Dhananjay
2025-06-30 23:06:37 -07:00
committed by GitHub
parent 257d270718
commit e305cb1b92
7 changed files with 131 additions and 12 deletions

View File

@@ -2,6 +2,7 @@
mod migration_schema_v23;
mod migration_schema_v24;
mod migration_schema_v25;
mod migration_schema_v26;
use crate::beacon_chain::BeaconChainTypes;
use std::sync::Arc;
@@ -58,6 +59,14 @@ pub fn migrate_schema<T: BeaconChainTypes>(
let ops = migration_schema_v25::downgrade_from_v25()?;
db.store_schema_version_atomically(to, ops)
}
(SchemaVersion(25), SchemaVersion(26)) => {
let ops = migration_schema_v26::upgrade_to_v26::<T>(db.clone())?;
db.store_schema_version_atomically(to, ops)
}
(SchemaVersion(26), SchemaVersion(25)) => {
let ops = migration_schema_v26::downgrade_from_v26::<T>(db.clone())?;
db.store_schema_version_atomically(to, ops)
}
// Anything else is an error.
(_, _) => Err(HotColdDBError::UnsupportedSchemaVersion {
target_version: to,