mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 09:16:00 +00:00
Use schema v20 for tree-states
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//! Utilities for managing database schema changes.
|
//! Utilities for managing database schema changes.
|
||||||
mod migration_schema_v10;
|
mod migration_schema_v20;
|
||||||
mod migration_schema_v6;
|
mod migration_schema_v6;
|
||||||
mod migration_schema_v7;
|
mod migration_schema_v7;
|
||||||
mod migration_schema_v8;
|
mod migration_schema_v8;
|
||||||
@@ -129,10 +129,10 @@ pub fn migrate_schema<T: BeaconChainTypes>(
|
|||||||
db.store_schema_version(to)
|
db.store_schema_version(to)
|
||||||
}
|
}
|
||||||
// Upgrade for tree-states database changes.
|
// 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.
|
// Downgrade for tree-states database changes.
|
||||||
(SchemaVersion(10), SchemaVersion(9)) => {
|
(SchemaVersion(20), SchemaVersion(9)) => {
|
||||||
migration_schema_v10::downgrade_from_v10::<T>(db, log)
|
migration_schema_v20::downgrade_from_v20::<T>(db, log)
|
||||||
}
|
}
|
||||||
// Anything else is an error.
|
// Anything else is an error.
|
||||||
(_, _) => Err(HotColdDBError::UnsupportedSchemaVersion {
|
(_, _) => Err(HotColdDBError::UnsupportedSchemaVersion {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ fn get_state_by_replay<T: BeaconChainTypes>(
|
|||||||
db.replay_blocks(epoch_boundary_state, blocks, slot, std::iter::empty())
|
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>>,
|
db: Arc<HotColdDB<T::EthSpec, T::HotStore, T::ColdStore>>,
|
||||||
log: Logger,
|
log: Logger,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
@@ -192,7 +192,7 @@ pub fn upgrade_to_v10<T: BeaconChainTypes>(
|
|||||||
db.store_schema_version_atomically(SchemaVersion(10), ops)
|
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>>,
|
db: Arc<HotColdDB<T::EthSpec, T::HotStore, T::ColdStore>>,
|
||||||
log: Logger,
|
log: Logger,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
@@ -4,7 +4,7 @@ use ssz::{Decode, Encode};
|
|||||||
use ssz_derive::{Decode, Encode};
|
use ssz_derive::{Decode, Encode};
|
||||||
use types::{Checkpoint, Hash256, Slot};
|
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.
|
// All the keys that get stored under the `BeaconMeta` column.
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user