Skip to content

Commit

Permalink
fix bugs: blockmeta changes into latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
jackzhhuang committed Aug 8, 2024
1 parent a798940 commit bfc6f6b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,12 @@ pub enum StorageVersion {
V3 = 3,
V4 = 4,
V5 = 5,
V6 = 6,
}

impl StorageVersion {
pub fn current_version() -> Self {
Self::V5
Self::V6
}

pub fn get_column_family_names(&self) -> &'static [ColumnFamilyName] {
Expand All @@ -226,6 +227,7 @@ impl StorageVersion {
Self::V3 => &VEC_PREFIX_NAME_V3,
Self::V4 => &VEC_PREFIX_NAME_V4,
Self::V5 => &VEC_PREFIX_NAME_V5,
Self::V6 => &VEC_PREFIX_NAME_V5,
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions storage/src/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ impl DBUpgrade {
(StorageVersion::V4, StorageVersion::V5) => {
Self::db_upgrade_v4_v5(instance)?;
}
(StorageVersion::V5, StorageVersion::V6) => {
Self::db_upgrade_v5_v6(instance)?;
}
_ => bail!(
"Can not upgrade db from {:?} to {:?}",
version_in_db,
Expand Down Expand Up @@ -338,6 +341,10 @@ impl DBUpgrade {
}
Ok(())
}

fn db_upgrade_v5_v6(_instance: &mut StorageInstance) -> Result<()> {
Ok(())
}
}

fn upgrade_store<K, V1, V2, T1, T2>(old_store: T1, store: T2, batch_size: usize) -> Result<usize>
Expand Down
2 changes: 1 addition & 1 deletion vm/types/src/block_metadata/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl From<BlockMetadata> for super::BlockMetadata {
number: value.number,
chain_id: value.chain_id,
parent_gas_used: value.parent_gas_used,
parents_hash: Some(vec![]),
parents_hash: None,
}
}
}
Expand Down

0 comments on commit bfc6f6b

Please sign in to comment.