Skip to content

Commit

Permalink
feat(consensus): add sync_topic to test config
Browse files Browse the repository at this point in the history
  • Loading branch information
matan-starkware committed Aug 13, 2024
1 parent 999504e commit 4923e37
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
5 changes: 5 additions & 0 deletions config/papyrus/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@
"privacy": "Public",
"value": 0
},
"consensus.test.sync_topic": {
"description": "The network topic for sync messages.",
"privacy": "Public",
"value": "consensus_test_sync"
},
"consensus.validator_id": {
"description": "A required param! The validator id of the node.",
"param_type": "String",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ expression: dumped_default_config
},
"privacy": "Public"
},
"consensus.test.sync_topic": {
"description": "The network topic for sync messages.",
"value": "consensus_test_sync",
"privacy": "Public"
},
"consensus.validator_id": {
"description": "A required param! The validator id of the node.",
"param_type": "String",
Expand Down
16 changes: 15 additions & 1 deletion crates/sequencing/papyrus_consensus/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ pub struct ConsensusTestConfig {
pub drop_probability: f64,
/// The probability of sending an invalid message.
pub invalid_probability: f64,
/// The network topic for sync messages.
pub sync_topic: String,
}

impl SerializeConfig for ConsensusTestConfig {
Expand Down Expand Up @@ -129,12 +131,24 @@ impl SerializeConfig for ConsensusTestConfig {
"The probability of sending an invalid message.",
ParamPrivacyInput::Public,
),
ser_param(
"sync_topic",
&self.sync_topic,
"The network topic for sync messages.",
ParamPrivacyInput::Public,
),
])
}
}

impl Default for ConsensusTestConfig {
fn default() -> Self {
Self { cache_size: 1000, random_seed: 0, drop_probability: 0.0, invalid_probability: 0.0 }
Self {
cache_size: 1000,
random_seed: 0,
drop_probability: 0.0,
invalid_probability: 0.0,
sync_topic: "consensus_test_sync".to_string(),
}
}
}

0 comments on commit 4923e37

Please sign in to comment.