-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dd58ae1
commit 2a0e685
Showing
7 changed files
with
58 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
use anyhow::{bail, Result}; | ||
use lurk::config::{Settings, LURK_CONFIG}; | ||
use lurk::config::lurk_config; | ||
use std::collections::HashMap; | ||
|
||
pub const PUBLIC_PARAMS_BENCH_PATH: &str = "/var/tmp/lurk_benches/public_params"; | ||
|
||
/// Sets the config settings with the temporary public parameter cache location | ||
pub fn set_bench_config() -> Result<()> { | ||
let mut settings = Settings::new(); | ||
settings.public_params_dir = PUBLIC_PARAMS_BENCH_PATH.into(); | ||
let mut overrides = HashMap::new(); | ||
overrides.insert("public_params_dir", PUBLIC_PARAMS_BENCH_PATH.into()); | ||
let config = lurk_config(Some(&overrides)); | ||
// If global config already set, check it has the same | ||
// temporary public param cache or return an error | ||
LURK_CONFIG.set(settings).or_else(|preset| { | ||
if preset.public_params_dir == PUBLIC_PARAMS_BENCH_PATH { | ||
Ok(()) | ||
} else { | ||
bail!( | ||
"Incorrect public parameter cache directory: {}", | ||
preset.public_params_dir | ||
) | ||
} | ||
}) | ||
if config.public_params_dir == PUBLIC_PARAMS_BENCH_PATH { | ||
Ok(()) | ||
} else { | ||
bail!( | ||
"Incorrect public parameter cache directory: {}", | ||
config.public_params_dir | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters