Skip to content

Commit

Permalink
refactor(consensus): rename topic in config to network_topic
Browse files Browse the repository at this point in the history
This is prep for adding sync_topic.
  • Loading branch information
matan-starkware committed Aug 12, 2024
1 parent 965be23 commit 9fccc9e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 22 deletions.
10 changes: 5 additions & 5 deletions config/papyrus/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@
"privacy": "Public",
"value": 5
},
"consensus.network_topic": {
"description": "The network topic of the consensus.",
"privacy": "Public",
"value": "consensus"
},
"consensus.num_validators": {
"description": "The number of validators in the consensus.",
"privacy": "Public",
Expand Down Expand Up @@ -119,11 +124,6 @@
"privacy": "Public",
"value": 0
},
"consensus.topic": {
"description": "The topic of the consensus.",
"privacy": "Public",
"value": "consensus"
},
"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 @@ -96,6 +96,11 @@ expression: dumped_default_config
},
"privacy": "Public"
},
"consensus.network_topic": {
"description": "The network topic of the consensus.",
"value": "consensus",
"privacy": "Public"
},
"consensus.num_validators": {
"description": "The number of validators in the consensus.",
"value": {
Expand Down Expand Up @@ -143,11 +148,6 @@ expression: dumped_default_config
},
"privacy": "Public"
},
"consensus.topic": {
"description": "The topic of the consensus.",
"value": "consensus",
"privacy": "Public"
},
"consensus.validator_id": {
"description": "A required param! The validator id of the node.",
"param_type": "String",
Expand Down
15 changes: 8 additions & 7 deletions crates/papyrus_node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,13 +364,14 @@ fn run_network(
let event_server_channel =
network_manager.register_sqmr_protocol_server(Protocol::Event.into(), BUFFER_SIZE);

let consensus_channels = match consensus_config {
Some(consensus_config) => Some(
network_manager
.register_broadcast_topic(Topic::new(consensus_config.topic), BUFFER_SIZE)?,
),
None => None,
};
let consensus_channels =
match consensus_config {
Some(consensus_config) => Some(network_manager.register_broadcast_topic(
Topic::new(consensus_config.network_topic),
BUFFER_SIZE,
)?),
None => None,
};
let p2p_sync_client_channels = P2PSyncClientChannels::new(
header_client_sender,
state_diff_client_sender,
Expand Down
10 changes: 5 additions & 5 deletions crates/sequencing/papyrus_consensus/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub struct ConsensusConfig {
/// The validator ID of the node.
pub validator_id: ValidatorId,
/// The network topic of the consensus.
pub topic: String,
pub network_topic: String,
/// The height to start the consensus from.
pub start_height: BlockNumber,
/// The number of validators in the consensus.
Expand All @@ -47,9 +47,9 @@ impl SerializeConfig for ConsensusConfig {
ParamPrivacyInput::Public,
),
ser_param(
"topic",
&self.topic,
"The topic of the consensus.",
"network_topic",
&self.network_topic,
"The network topic of the consensus.",
ParamPrivacyInput::Public,
),
ser_param(
Expand Down Expand Up @@ -80,7 +80,7 @@ impl Default for ConsensusConfig {
fn default() -> Self {
Self {
validator_id: ValidatorId::default(),
topic: "consensus".to_string(),
network_topic: "consensus".to_string(),
start_height: BlockNumber::default(),
num_validators: 4,
consensus_delay: Duration::from_secs(5),
Expand Down

0 comments on commit 9fccc9e

Please sign in to comment.