From f30f17bf36feb1edda31d80168a0d29dbbbdd48b Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Wed, 25 May 2022 09:11:06 +1000 Subject: [PATCH] Fix v10/v20 mixup --- beacon_node/beacon_chain/src/schema_change.rs | 2 ++ .../beacon_chain/src/schema_change/migration_schema_v20.rs | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/beacon_node/beacon_chain/src/schema_change.rs b/beacon_node/beacon_chain/src/schema_change.rs index 7a00f9b877..5a8d7e1c52 100644 --- a/beacon_node/beacon_chain/src/schema_change.rs +++ b/beacon_node/beacon_chain/src/schema_change.rs @@ -28,6 +28,8 @@ pub fn migrate_schema( (_, _) if from == to && to == CURRENT_SCHEMA_VERSION => Ok(()), // Upgrade for tree-states database changes. (SchemaVersion(9), SchemaVersion(20)) => migration_schema_v20::upgrade_to_v20::(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::(db, log) diff --git a/beacon_node/beacon_chain/src/schema_change/migration_schema_v20.rs b/beacon_node/beacon_chain/src/schema_change/migration_schema_v20.rs index d3538d163e..252f79baea 100644 --- a/beacon_node/beacon_chain/src/schema_change/migration_schema_v20.rs +++ b/beacon_node/beacon_chain/src/schema_change/migration_schema_v20.rs @@ -100,6 +100,7 @@ pub fn upgrade_to_v20( 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( 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(