Skip to content

Commit

Permalink
feat: add config template to consensus manager
Browse files Browse the repository at this point in the history
commit-id:13a987cd
  • Loading branch information
lev-starkware committed Aug 15, 2024
1 parent 18b4df2 commit 6e7b138
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions crates/consensus_manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ workspace = true

[dependencies]
async-trait.workspace = true
papyrus_config.workspace = true
serde.workspace = true
starknet_consensus_manager_types.workspace = true
starknet_mempool_infra.workspace = true
tokio.workspace = true
validator.workspace = true
30 changes: 30 additions & 0 deletions crates/consensus_manager/src/config.rs
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 }
}
}
1 change: 1 addition & 0 deletions crates/consensus_manager/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pub mod communication;
pub mod config;
pub mod consensus_manager;

0 comments on commit 6e7b138

Please sign in to comment.