Use schema v20 for tree-states

This commit is contained in:
Michael Sproul
2022-05-24 10:37:39 +10:00
parent 3d295b4eb3
commit b774a1c3f1
3 changed files with 7 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
//! Utilities for managing database schema changes.
mod migration_schema_v10;
mod migration_schema_v20;
mod migration_schema_v6;
mod migration_schema_v7;
mod migration_schema_v8;
@@ -129,10 +129,10 @@ pub fn migrate_schema<T: BeaconChainTypes>(
db.store_schema_version(to)
}
// Upgrade for tree-states database changes.
(SchemaVersion(9), SchemaVersion(10)) => migration_schema_v10::upgrade_to_v10::<T>(db, log),
(SchemaVersion(9), SchemaVersion(20)) => migration_schema_v20::upgrade_to_v20::<T>(db, log),
// Downgrade for tree-states database changes.
(SchemaVersion(10), SchemaVersion(9)) => {
migration_schema_v10::downgrade_from_v10::<T>(db, log)
(SchemaVersion(20), SchemaVersion(9)) => {
migration_schema_v20::downgrade_from_v20::<T>(db, log)
}
// Anything else is an error.
(_, _) => Err(HotColdDBError::UnsupportedSchemaVersion {

View File

@@ -41,7 +41,7 @@ fn get_state_by_replay<T: BeaconChainTypes>(
db.replay_blocks(epoch_boundary_state, blocks, slot, std::iter::empty())
}
pub fn upgrade_to_v10<T: BeaconChainTypes>(
pub fn upgrade_to_v20<T: BeaconChainTypes>(
db: Arc<HotColdDB<T::EthSpec, T::HotStore, T::ColdStore>>,
log: Logger,
) -> Result<(), Error> {
@@ -192,7 +192,7 @@ pub fn upgrade_to_v10<T: BeaconChainTypes>(
db.store_schema_version_atomically(SchemaVersion(10), ops)
}
pub fn downgrade_from_v10<T: BeaconChainTypes>(
pub fn downgrade_from_v20<T: BeaconChainTypes>(
db: Arc<HotColdDB<T::EthSpec, T::HotStore, T::ColdStore>>,
log: Logger,
) -> Result<(), Error> {

View File

@@ -4,7 +4,7 @@ use ssz::{Decode, Encode};
use ssz_derive::{Decode, Encode};
use types::{Checkpoint, Hash256, Slot};
pub const CURRENT_SCHEMA_VERSION: SchemaVersion = SchemaVersion(10);
pub const CURRENT_SCHEMA_VERSION: SchemaVersion = SchemaVersion(20);
// All the keys that get stored under the `BeaconMeta` column.
//