-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add config template to consensus manager
commit-id:13a987cd
- Loading branch information
1 parent
18b4df2
commit 6e7b138
Showing
4 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use std::collections::BTreeMap; | ||
|
||
use papyrus_config::dumping::{ser_param, SerializeConfig}; | ||
use papyrus_config::{ParamPath, ParamPrivacyInput, SerializedParam}; | ||
use serde::{Deserialize, Serialize}; | ||
use validator::Validate; | ||
|
||
/// The consensus manager related configuration. | ||
/// TODO(Lev/Tsabary/Matan): Define actual configuration. | ||
#[derive(Clone, Debug, Serialize, Deserialize, Validate, PartialEq)] | ||
pub struct ConsensusManagerConfig { | ||
pub consensus_config_param_1: usize, | ||
} | ||
|
||
impl SerializeConfig for ConsensusManagerConfig { | ||
fn dump(&self) -> BTreeMap<ParamPath, SerializedParam> { | ||
BTreeMap::from_iter([ser_param( | ||
"consensus_config_param_1", | ||
&self.consensus_config_param_1, | ||
"The first consensus manager configuration parameter", | ||
ParamPrivacyInput::Public, | ||
)]) | ||
} | ||
} | ||
|
||
impl Default for ConsensusManagerConfig { | ||
fn default() -> Self { | ||
Self { consensus_config_param_1: 1 } | ||
} | ||
} |
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,2 +1,3 @@ | ||
pub mod communication; | ||
pub mod config; | ||
pub mod consensus_manager; |