Skip to content

Commit 0a7d0da

Browse files
committed
feat: print in Cardano DB v1 and v2 client-cli if ancillary files not included
1 parent 8b40a70 commit 0a7d0da

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed

mithril-client-cli/src/commands/cardano_db/download.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ use crate::{
1313
commands::{client_builder, SharedArgs},
1414
configuration::{ConfigError, ConfigSource},
1515
utils::{
16-
self, CardanoDbDownloadChecker, CardanoDbUtils, ExpanderUtils, IndicatifFeedbackReceiver,
17-
ProgressOutputType, ProgressPrinter,
16+
self, AncillaryLogMessage, CardanoDbDownloadChecker, CardanoDbUtils, ExpanderUtils,
17+
IndicatifFeedbackReceiver, ProgressOutputType, ProgressPrinter,
1818
},
1919
CommandContext,
2020
};
@@ -67,6 +67,12 @@ impl CardanoDbDownloadCommand {
6767

6868
/// Command execution
6969
pub async fn execute(&self, context: CommandContext) -> MithrilResult<()> {
70+
if self.include_ancillary {
71+
AncillaryLogMessage::warn_ancillary_not_signed_by_mithril();
72+
} else {
73+
AncillaryLogMessage::warn_fast_bootstrap_not_available();
74+
}
75+
7076
let params = context.config_parameters()?.add_source(self)?;
7177
let download_dir: &String = &params.require("download_dir")?;
7278
let db_dir = Path::new(download_dir).join("db");

mithril-client-cli/src/commands/cardano_db_v2/download.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ use crate::{
2020
commands::{client_builder, SharedArgs},
2121
configuration::{ConfigError, ConfigSource},
2222
utils::{
23-
self, CardanoDbDownloadChecker, CardanoDbUtils, ExpanderUtils, IndicatifFeedbackReceiver,
24-
ProgressOutputType, ProgressPrinter,
23+
self, AncillaryLogMessage, CardanoDbDownloadChecker, CardanoDbUtils, ExpanderUtils,
24+
IndicatifFeedbackReceiver, ProgressOutputType, ProgressPrinter,
2525
},
2626
CommandContext,
2727
};
@@ -107,6 +107,12 @@ impl CardanoDbV2DownloadCommand {
107107

108108
/// Command execution
109109
pub async fn execute(&self, context: CommandContext) -> MithrilResult<()> {
110+
if self.include_ancillary {
111+
AncillaryLogMessage::warn_ancillary_not_signed_by_mithril();
112+
} else {
113+
AncillaryLogMessage::warn_fast_bootstrap_not_available();
114+
}
115+
110116
let params = context.config_parameters()?.add_source(self)?;
111117
let download_dir: &String = &params.require("download_dir")?;
112118
let restoration_options = RestorationOptions {

mithril-client-cli/src/utils/cardano_db.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,24 @@ impl CardanoDbUtils {
4747
}
4848
}
4949

50+
pub struct AncillaryLogMessage {}
51+
52+
impl AncillaryLogMessage {
53+
/// This method provides guidance on how to enable fast bootstrap by including ancillary files
54+
pub fn warn_fast_bootstrap_not_available() {
55+
println!("The fast bootstrap of the Cardano node is not available with the current parameters used in this command: this means that the ledger state will be recomputed from genesis at startup of the Cardano node.
56+
57+
In order to activate the fast bootstrap of the Cardano node, add the following parameters to the command:
58+
59+
--include-ancillary
60+
and --ancillary-verification-key (or environment variable ANCILLARY_VERIFICATION_KEY). Caution: The ancillary files, including the ledger state, are not currently signed by Mithril. As a mitigation, IOG owned keys are used to sign these files. For more information, please refer to the network configuration page of the documentation (https://mithril.network/doc/manual/getting-started/network-configurations).");
61+
}
62+
63+
pub fn warn_ancillary_not_signed_by_mithril() {
64+
println!("Ancillary verification does not use the Mithril certification: as a mitigation, IOG owned keys are used to sign these files.");
65+
}
66+
}
67+
5068
#[cfg(test)]
5169
mod test {
5270
use super::*;

0 commit comments

Comments
 (0)