2023-02-20 21:30:29 -08:00
|
|
|
//! Configuration for semantic verification which is run in parallel.
|
|
|
|
|
2020-08-19 19:25:46 -07:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
2023-02-20 21:30:29 -08:00
|
|
|
/// Configuration for parallel semantic verification:
|
|
|
|
/// <https://zebra.zfnd.org/dev/rfcs/0002-parallel-verification.html#definitions>
|
2023-04-13 01:42:17 -07:00
|
|
|
///
|
|
|
|
/// Automatically downloads the Zcash Sprout and Sapling parameters to the default directory:
|
|
|
|
/// - Linux: `$HOME/.zcash-params`
|
|
|
|
/// - macOS: `$HOME/Library/Application Support/ZcashParams`
|
|
|
|
/// - Windows: `%APPDATA%\ZcashParams` or `C:\Users\%USERNAME%\AppData\ZcashParams`
|
|
|
|
///
|
|
|
|
/// # Security
|
|
|
|
///
|
|
|
|
/// If you are running Zebra with elevated permissions ("root"), create the
|
|
|
|
/// parameters directory before running Zebra, and make sure the Zebra user
|
|
|
|
/// account has exclusive access to that directory, and other users can't modify
|
|
|
|
/// its parent directories.
|
2020-08-19 19:25:46 -07:00
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
|
|
#[serde(deny_unknown_fields, default)]
|
|
|
|
pub struct Config {
|
2023-02-20 21:30:29 -08:00
|
|
|
/// Should Zebra make sure that it follows the consensus chain while syncing?
|
|
|
|
/// This is a developer-only option.
|
|
|
|
///
|
|
|
|
/// # Security
|
|
|
|
///
|
|
|
|
/// Disabling this option leaves your node vulnerable to some kinds of chain-based attacks.
|
|
|
|
/// Zebra regularly updates its checkpoints to ensure nodes are following the best chain.
|
|
|
|
///
|
|
|
|
/// # Details
|
|
|
|
///
|
|
|
|
/// This option is `true` by default, because it prevents some kinds of chain attacks.
|
2020-08-19 19:25:46 -07:00
|
|
|
///
|
2023-02-20 21:30:29 -08:00
|
|
|
/// Disabling this option makes Zebra start full validation earlier.
|
|
|
|
/// It is slower and less secure.
|
2021-03-22 18:09:06 -07:00
|
|
|
///
|
2023-02-20 21:30:29 -08:00
|
|
|
/// Zebra requires some checkpoints to simplify validation of legacy network upgrades.
|
|
|
|
/// Required checkpoints are always active, even when this option is `false`.
|
2022-03-08 17:21:54 -08:00
|
|
|
///
|
2023-02-20 21:30:29 -08:00
|
|
|
/// # Deprecation
|
2022-03-08 17:21:54 -08:00
|
|
|
///
|
2023-02-20 21:30:29 -08:00
|
|
|
/// For security reasons, this option might be deprecated or ignored in a future Zebra
|
|
|
|
/// release.
|
2020-08-19 19:25:46 -07:00
|
|
|
pub checkpoint_sync: bool,
|
2022-03-08 17:21:54 -08:00
|
|
|
|
2021-12-14 13:43:07 -08:00
|
|
|
/// Skip the pre-download of Groth16 parameters if this option is true.
|
|
|
|
pub debug_skip_parameter_preload: bool,
|
2020-08-19 19:25:46 -07:00
|
|
|
}
|
|
|
|
|
2021-09-22 06:43:27 -07:00
|
|
|
// we like our default configs to be explicit
|
|
|
|
#[allow(unknown_lints)]
|
|
|
|
#[allow(clippy::derivable_impls)]
|
2020-08-19 19:25:46 -07:00
|
|
|
impl Default for Config {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self {
|
2022-03-08 17:21:54 -08:00
|
|
|
checkpoint_sync: true,
|
2021-12-14 13:43:07 -08:00
|
|
|
debug_skip_parameter_preload: false,
|
2020-08-19 19:25:46 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|