Skip to content

Commit

Permalink
fix: make Mithril dependency optional
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega committed Dec 16, 2023
1 parent eb3113d commit e9f33ad
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ tokio-stream = { version = "0.1.14", features = ["sync"] }
futures-util = "0.3.28"
async-stream = "0.3.5"
serde_with = "3.4.0"
mithril-client = "0.5.7"
mithril-client = { version = "0.5.7", optional = true }

[dev-dependencies]
tempfile = "3.3.0"

[features]
mithril = ["mithril-client"]
default = ["mithril"]
1 change: 1 addition & 0 deletions src/bin/dolos/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub fn open_data_stores(config: &crate::Config) -> Result<Stores, Error> {
Ok((wal, chain, ledger))
}

#[allow(dead_code)]
pub fn destroy_data_stores(config: &crate::Config) -> Result<(), Error> {
let rolldb_path = define_rolldb_path(config);

Expand Down
12 changes: 9 additions & 3 deletions src/bin/dolos/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,26 @@ use serde::Deserialize;
use serde_with::{serde_as, DisplayFromStr};
use std::path::PathBuf;

mod bootstrap;
mod common;
mod daemon;
mod data;
mod eval;
mod serve;
mod sync;

#[cfg(feature = "mithril")]
mod bootstrap;

#[derive(Debug, Subcommand)]
enum Command {
Daemon(daemon::Args),
Sync(sync::Args),
Bootstrap(bootstrap::Args),
Data(data::Args),
Serve(serve::Args),
Eval(eval::Args),

#[cfg(feature = "mithril")]
Bootstrap(bootstrap::Args),
}

#[derive(Debug, Parser)]
Expand Down Expand Up @@ -102,10 +106,12 @@ fn main() -> Result<()> {
match args.command {
Command::Daemon(x) => daemon::run(config, &x)?,
Command::Sync(x) => sync::run(&config, &x)?,
Command::Bootstrap(x) => bootstrap::run(&config, &x)?,
Command::Data(x) => data::run(&config, &x)?,
Command::Serve(x) => serve::run(config, &x)?,
Command::Eval(x) => eval::run(&config, &x)?,

#[cfg(feature = "mithril")]
Command::Bootstrap(x) => bootstrap::run(&config, &x)?,
};

Ok(())
Expand Down

0 comments on commit e9f33ad

Please sign in to comment.