Skip to content

Commit f3faf78

Browse files
author
Clément Turmel
committed
refactor(client-lib): moving implementations from message.rs to proving.rs
1 parent ea887ce commit f3faf78

File tree

3 files changed

+329
-28
lines changed

3 files changed

+329
-28
lines changed

mithril-client/src/cardano_database_client/api.rs

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,19 @@ use std::sync::Arc;
66
use slog::Logger;
77

88
#[cfg(feature = "fs")]
9-
use mithril_common::messages::{CardanoDatabaseSnapshotMessage, CertificateMessage};
9+
use mithril_common::{
10+
crypto_helper::MKProof,
11+
messages::{CardanoDatabaseSnapshotMessage, CertificateMessage},
12+
};
1013

1114
#[cfg(feature = "fs")]
1215
use mithril_cardano_node_internal_database::entities::ImmutableFile;
1316

1417
use crate::aggregator_client::AggregatorClient;
1518
#[cfg(feature = "fs")]
16-
use crate::cardano_database_client::VerifiedDigests;
19+
use crate::cardano_database_client::{
20+
VerifiedDigests, proving::ComputeCardanoDatabaseMessageError,
21+
};
1722
#[cfg(feature = "fs")]
1823
use crate::feedback::FeedbackSender;
1924
#[cfg(feature = "fs")]
@@ -111,6 +116,29 @@ impl CardanoDatabaseClient {
111116
.await
112117
}
113118

119+
/// Verify a local cardano database
120+
#[cfg(feature = "fs")]
121+
pub async fn verify_cardano_database(
122+
&self,
123+
certificate: &CertificateMessage,
124+
cardano_database_snapshot: &CardanoDatabaseSnapshotMessage,
125+
immutable_file_range: &ImmutableFileRange,
126+
allow_missing: bool,
127+
database_dir: &Path,
128+
verified_digests: &VerifiedDigests,
129+
) -> Result<MKProof, ComputeCardanoDatabaseMessageError> {
130+
self.artifact_prover
131+
.verify_cardano_database(
132+
certificate,
133+
cardano_database_snapshot,
134+
immutable_file_range,
135+
allow_missing,
136+
database_dir,
137+
verified_digests,
138+
)
139+
.await
140+
}
141+
114142
/// Checks if immutable directory exists with at least one immutable in it
115143
#[cfg(feature = "fs")]
116144
pub fn check_has_immutables(&self, database_dir: &Path) -> MithrilResult<()> {

0 commit comments

Comments
 (0)