Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mithril-cardano-node-internal-database"
version = "0.1.3"
version = "0.1.4"
description = "Mechanisms that allow Mithril nodes to read the files of a Cardano node internal database and compute digests from them"
authors.workspace = true
documentation.workspace = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ impl ImmutableFile {
Ok(hasher.finalize())
}

/// List all [`ImmutableFile`] in a given directory.
/// List all [`ImmutableFile`] in a given directory by recursively searching a immutable directory.
pub fn list_all_in_dir(dir: &Path) -> Result<Vec<ImmutableFile>, ImmutableFileListingError> {
let immutable_dir = find_immutables_dir(dir).ok_or(
ImmutableFileListingError::MissingImmutableFolder(dir.to_path_buf()),
Expand Down Expand Up @@ -169,7 +169,7 @@ impl ImmutableFile {
}
}

/// Check if at least one immutable file exists in the given directory
/// Check if at least one immutable file exists in the given directory by recursively searching a immutable directory
pub fn at_least_one_immutable_files_exist_in_dir(
dir: &Path,
) -> Result<(), ImmutableFileListingError> {
Expand Down Expand Up @@ -426,6 +426,33 @@ mod tests {
);
}

#[test]
fn find_immutables_dir_returns_none_if_no_immutable_dir_found() {
let database_path = temp_dir_create!();
assert!(find_immutables_dir(&database_path).is_none());
}

#[test]
fn find_immutables_dir_returns_immutable_dir_if_found_at_root() {
let database_path = temp_dir_create!();
fs::create_dir(database_path.join(IMMUTABLE_DIR)).unwrap();

let immutable_dir =
find_immutables_dir(&database_path).expect("Immutable directory should be found");
assert_eq!(immutable_dir, database_path.join(IMMUTABLE_DIR));
}

#[test]
fn find_immutables_dir_returns_immutable_dir_if_found_at_any_depth() {
let database_path = temp_dir_create!();
let subdir = database_path.join("one/two/three");
fs::create_dir_all(subdir.join(IMMUTABLE_DIR)).unwrap();

let immutable_dir =
find_immutables_dir(&database_path).expect("Immutable directory should be found");
assert_eq!(immutable_dir, subdir.join(IMMUTABLE_DIR));
}

#[test]
fn at_least_one_immutable_files_exist_in_dir_throw_error_if_immutable_dir_is_empty() {
let database_path = temp_dir_create!();
Expand Down
2 changes: 1 addition & 1 deletion mithril-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mithril-client"
version = "0.12.24"
version = "0.12.25"
description = "Mithril client library"
authors = { workspace = true }
edition = { workspace = true }
Expand Down
2 changes: 2 additions & 0 deletions mithril-client/src/cardano_database_client/proving.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ impl InternalArtifactProver {
}

/// Compute the Merkle proof of membership for the given immutable file range.
///
/// It will recursively search for immutables directory inside the provided `database_dir`.
pub async fn compute_merkle_proof(
&self,
certificate: &CertificateMessage,
Expand Down
Loading