Skip to content

Commit

Permalink
Merge pull request #1398 from input-output-hk/damien/fix-mithril-clie…
Browse files Browse the repository at this point in the history
…nt-cli-genesis-verification-key-missing

Fix breaking change introduced with `mithril-client-cli` using `mithril-client` library
  • Loading branch information
dlachaume authored Dec 14, 2023
2 parents 2670a43 + 9acc854 commit 84308dd
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion mithril-client-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mithril-client-cli"
version = "0.5.9"
version = "0.5.10"
description = "A Mithril Client"
authors = { workspace = true }
edition = { workspace = true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{collections::HashMap, sync::Arc};

use mithril_client::ClientBuilder;
use mithril_client_cli::configuration::ConfigParameters;
use mithril_common::StdResult;
use mithril_common::{test_utils::fake_keys, StdResult};

/// Mithril stake distribution LIST command
#[derive(Parser, Debug, Clone)]
Expand All @@ -23,9 +23,16 @@ impl MithrilStakeDistributionListCommand {
let params = Arc::new(ConfigParameters::new(
config.try_deserialize::<HashMap<String, String>>()?,
));
// TODO: This should not be done this way.
// Now that mithril-client-cli uses the mithril-client library, the genesis verification key is required for all commands
let fallback_genesis_verification_key =
fake_keys::genesis_verification_key()[0].to_string();
let client = ClientBuilder::aggregator(
&params.require("aggregator_endpoint")?,
&params.require("genesis_verification_key")?,
&params.get_or(
"genesis_verification_key",
&fallback_genesis_verification_key,
),
)
.with_logger(logger())
.build()?;
Expand Down
10 changes: 9 additions & 1 deletion mithril-client-cli/src/commands/snapshot/list.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use clap::Parser;
use cli_table::{format::Justify, print_stdout, Cell, Table};
use config::{builder::DefaultState, ConfigBuilder};
use mithril_common::test_utils::fake_keys;
use slog_scope::logger;
use std::{collections::HashMap, sync::Arc};

Expand All @@ -22,9 +23,16 @@ impl SnapshotListCommand {
let params = Arc::new(ConfigParameters::new(
config.try_deserialize::<HashMap<String, String>>()?,
));
// TODO: This should not be done this way.
// Now that mithril-client-cli uses the mithril-client library, the genesis verification key is required for all commands
let fallback_genesis_verification_key =
fake_keys::genesis_verification_key()[0].to_string();
let client = ClientBuilder::aggregator(
&params.require("aggregator_endpoint")?,
&params.require("genesis_verification_key")?,
&params.get_or(
"genesis_verification_key",
&fallback_genesis_verification_key,
),
)
.with_logger(logger())
.build()?;
Expand Down
11 changes: 9 additions & 2 deletions mithril-client-cli/src/commands/snapshot/show.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{collections::HashMap, sync::Arc};

use mithril_client::ClientBuilder;
use mithril_client_cli::{configuration::ConfigParameters, utils::ExpanderUtils};
use mithril_common::StdResult;
use mithril_common::{test_utils::fake_keys, StdResult};

/// Clap command to show a given snapshot
#[derive(Parser, Debug, Clone)]
Expand All @@ -29,9 +29,16 @@ impl SnapshotShowCommand {
let params = Arc::new(ConfigParameters::new(
config.try_deserialize::<HashMap<String, String>>()?,
));
// TODO: This should not be done this way.
// Now that mithril-client-cli uses the mithril-client library, the genesis verification key is required for all commands
let fallback_genesis_verification_key =
fake_keys::genesis_verification_key()[0].to_string();
let client = ClientBuilder::aggregator(
&params.require("aggregator_endpoint")?,
&params.require("genesis_verification_key")?,
&params.get_or(
"genesis_verification_key",
&fallback_genesis_verification_key,
),
)
.with_logger(logger())
.build()?;
Expand Down

0 comments on commit 84308dd

Please sign in to comment.