From 79c631e776a22f8fe07d31b8576ae930012cac84 Mon Sep 17 00:00:00 2001 From: Matan Markind <matan@starkware.co> Date: Mon, 12 Aug 2024 15:38:26 +0300 Subject: [PATCH] feat(consensus): add sync_topic to test config --- config/papyrus/default_config.json | 5 +++++ ...config__config_test__dump_default_config.snap | 5 +++++ .../sequencing/papyrus_consensus/src/config.rs | 16 +++++++++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/config/papyrus/default_config.json b/config/papyrus/default_config.json index a35bffc107..81f897e70d 100644 --- a/config/papyrus/default_config.json +++ b/config/papyrus/default_config.json @@ -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", diff --git a/crates/papyrus_node/src/config/snapshots/papyrus_node__config__config_test__dump_default_config.snap b/crates/papyrus_node/src/config/snapshots/papyrus_node__config__config_test__dump_default_config.snap index b0288f85ce..446e56caa8 100644 --- a/crates/papyrus_node/src/config/snapshots/papyrus_node__config__config_test__dump_default_config.snap +++ b/crates/papyrus_node/src/config/snapshots/papyrus_node__config__config_test__dump_default_config.snap @@ -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", diff --git a/crates/sequencing/papyrus_consensus/src/config.rs b/crates/sequencing/papyrus_consensus/src/config.rs index 6994bcf547..ad133c19ac 100644 --- a/crates/sequencing/papyrus_consensus/src/config.rs +++ b/crates/sequencing/papyrus_consensus/src/config.rs @@ -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 { @@ -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(), + } } }