Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions client/db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,11 @@ impl DatabaseSource {
/// Return dabase path for databases that are on the disk.
pub fn path(&self) -> Option<&Path> {
match self {
DatabaseSource::Auto { .. } => {
// TODO:
unimplemented!();
},
// as per https://github.com/paritytech/substrate/pull/9500#discussion_r684312550
//
// IIUC this is needed for polkadot to create its own dbs, so until it can use parity db
// I would think rocksdb, but later parity-db.
DatabaseSource::Auto { paritydb_path, .. } => Some(&paritydb_path),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this does not matter much for now. There's a separate item in #9201 to resolve polkadot db path properly.

DatabaseSource::RocksDb { path, .. } | DatabaseSource::ParityDb { path } => Some(&path),
DatabaseSource::Custom(..) => None,
}
Expand Down
7 changes: 4 additions & 3 deletions client/db/src/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub enum UpgradeError {
/// Database version comes from future version of the client.
FutureDatabaseVersion(u32),
/// Invalid justification block.
InvalidJustificationBlock,
DecodingJustificationBlock,
/// Common io error.
Io(io::Error),
}
Expand All @@ -74,7 +74,8 @@ impl fmt::Display for UpgradeError {
write!(f, "Database version no longer supported: {}", version),
UpgradeError::FutureDatabaseVersion(version) =>
write!(f, "Database version comes from future version of the client: {}", version),
UpgradeError::InvalidJustificationBlock => write!(f, "Invalid justification block"),
UpgradeError::DecodingJustificationBlock =>
write!(f, "Decodoning justification block failed"),
UpgradeError::Io(err) => write!(f, "Io error: {}", err),
}
}
Expand Down Expand Up @@ -124,7 +125,7 @@ fn migrate_2_to_3<Block: BlockT>(db_path: &Path, _db_type: DatabaseType) -> Upgr
// NOTE: when storing justifications the previous API would get a `Vec<u8>` and still
// call encode on it.
let justification = Vec::<u8>::decode(&mut &justification[..])
.map_err(|_| UpgradeError::InvalidJustificationBlock)?;
.map_err(|_| UpgradeError::DecodingJustificationBlock)?;
let justifications = sp_runtime::Justifications::from((*b"FRNK", justification));
transaction.put_vec(columns::JUSTIFICATIONS, &key, justifications.encode());
}
Expand Down