mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-19 13:58:28 +00:00
Remove schema migrations for v28 and earlier (#9031)
With LH v8.1.3 supporting Fulu-on-Gnosis, we no longer need these DB migrations. All Lighthouse nodes running in prod will soon be updated to LH v8.0.0+ and schema v28+. This PR helps with Gloas fork choice changes, by allowing us to avoid updating old schema migrations when adding V29 for Gloas: - https://github.com/sigp/lighthouse/pull/9025 Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
This commit is contained in:
@@ -1,52 +1,19 @@
|
||||
use crate::{
|
||||
beacon_fork_choice_store::{PersistedForkChoiceStoreV17, PersistedForkChoiceStoreV28},
|
||||
metrics,
|
||||
};
|
||||
use crate::{beacon_fork_choice_store::PersistedForkChoiceStoreV28, metrics};
|
||||
use ssz::{Decode, Encode};
|
||||
use ssz_derive::{Decode, Encode};
|
||||
use store::{DBColumn, Error, KeyValueStoreOp, StoreConfig, StoreItem};
|
||||
use store::{DBColumn, Error, KeyValueStoreOp, StoreConfig};
|
||||
use superstruct::superstruct;
|
||||
use types::Hash256;
|
||||
|
||||
// If adding a new version you should update this type alias and fix the breakages.
|
||||
pub type PersistedForkChoice = PersistedForkChoiceV28;
|
||||
|
||||
#[superstruct(
|
||||
variants(V17, V28),
|
||||
variant_attributes(derive(Encode, Decode)),
|
||||
no_enum
|
||||
)]
|
||||
#[superstruct(variants(V28), variant_attributes(derive(Encode, Decode)), no_enum)]
|
||||
pub struct PersistedForkChoice {
|
||||
#[superstruct(only(V17))]
|
||||
pub fork_choice_v17: fork_choice::PersistedForkChoiceV17,
|
||||
#[superstruct(only(V28))]
|
||||
pub fork_choice: fork_choice::PersistedForkChoiceV28,
|
||||
#[superstruct(only(V17))]
|
||||
pub fork_choice_store_v17: PersistedForkChoiceStoreV17,
|
||||
#[superstruct(only(V28))]
|
||||
pub fork_choice_store: PersistedForkChoiceStoreV28,
|
||||
}
|
||||
|
||||
macro_rules! impl_store_item {
|
||||
($type:ty) => {
|
||||
impl StoreItem for $type {
|
||||
fn db_column() -> DBColumn {
|
||||
DBColumn::ForkChoice
|
||||
}
|
||||
|
||||
fn as_store_bytes(&self) -> Vec<u8> {
|
||||
self.as_ssz_bytes()
|
||||
}
|
||||
|
||||
fn from_store_bytes(bytes: &[u8]) -> std::result::Result<Self, Error> {
|
||||
Self::from_ssz_bytes(bytes).map_err(Into::into)
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
impl_store_item!(PersistedForkChoiceV17);
|
||||
|
||||
impl PersistedForkChoiceV28 {
|
||||
pub fn from_bytes(bytes: &[u8], store_config: &StoreConfig) -> Result<Self, Error> {
|
||||
let decompressed_bytes = store_config
|
||||
|
||||
Reference in New Issue
Block a user