Fix v10/v20 mixup

This commit is contained in:
Michael Sproul
2022-05-25 09:11:06 +10:00
parent 30b031da32
commit f30f17bf36
2 changed files with 4 additions and 1 deletions

View File

@@ -28,6 +28,8 @@ pub fn migrate_schema<T: BeaconChainTypes>(
(_, _) if from == to && to == CURRENT_SCHEMA_VERSION => Ok(()),
// Upgrade for tree-states database changes.
(SchemaVersion(9), SchemaVersion(20)) => migration_schema_v20::upgrade_to_v20::<T>(db, log),
// FIXME(sproul): this is a temporary patch remove it before merging
(SchemaVersion(10), SchemaVersion(20)) => db.store_schema_version(to),
// Downgrade for tree-states database changes.
(SchemaVersion(20), SchemaVersion(9)) => {
migration_schema_v20::downgrade_from_v20::<T>(db, log)

View File

@@ -100,6 +100,7 @@ pub fn upgrade_to_v20<T: BeaconChainTypes>(
let prev_state_root = *current_state.get_state_root(slot - 1)?;
let epoch_boundary_state_root = *current_state.get_state_root(epoch_boundary_slot)?;
// FIXME(sproul): rename V10 variant
let summary = HotStateSummaryV10 {
slot,
latest_block_root,
@@ -189,7 +190,7 @@ pub fn upgrade_to_v20<T: BeaconChainTypes>(
ops.push(summary.as_kv_store_op(state_root)?);
}
db.store_schema_version_atomically(SchemaVersion(10), ops)
db.store_schema_version_atomically(SchemaVersion(20), ops)
}
pub fn downgrade_from_v20<T: BeaconChainTypes>(