Skip to content

Commit

Permalink
chore(consensus): remove network_topic from ConsensusConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
guy-starkware committed Jan 13, 2025
1 parent 360cbf4 commit eb3ed83
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 35 deletions.
5 changes: 0 additions & 5 deletions config/papyrus/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,6 @@
"privacy": "Public",
"value": 10100
},
"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
5 changes: 0 additions & 5 deletions config/sequencer/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -664,11 +664,6 @@
"privacy": "Public",
"value": 10100
},
"consensus_manager_config.consensus_config.network_topic": {
"description": "The network topic of the consensus.",
"privacy": "Public",
"value": "consensus"
},
"consensus_manager_config.consensus_config.num_validators": {
"description": "The number of validators in the consensus.",
"privacy": "Public",
Expand Down
10 changes: 4 additions & 6 deletions crates/papyrus_node/src/bin/run_consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use papyrus_consensus_orchestrator::papyrus_consensus_context::PapyrusConsensusC
use papyrus_network::gossipsub_impl::Topic;
use papyrus_network::network_manager::{BroadcastTopicChannels, NetworkManager};
use papyrus_node::bin_utils::build_configs;
use papyrus_node::run::{run, PapyrusResources, PapyrusTaskHandles, NETWORK_TOPIC};
use papyrus_node::run::{run, PapyrusResources, PapyrusTaskHandles};
use papyrus_p2p_sync::BUFFER_SIZE;
use papyrus_protobuf::consensus::{ProposalPart, StreamMessage};
use papyrus_storage::StorageReader;
Expand Down Expand Up @@ -58,12 +58,10 @@ fn build_consensus(
storage_reader: StorageReader,
network_manager: &mut NetworkManager,
) -> anyhow::Result<Option<JoinHandle<anyhow::Result<()>>>> {
let network_channels = network_manager.register_broadcast_topic(
Topic::new(consensus_config.network_topic.clone()),
BUFFER_SIZE,
)?;
let network_channels = network_manager
.register_broadcast_topic(Topic::new(consensus_config.vote_topic.clone()), BUFFER_SIZE)?;
let proposal_network_channels: BroadcastTopicChannels<StreamMessage<ProposalPart>> =
network_manager.register_broadcast_topic(Topic::new(NETWORK_TOPIC), BUFFER_SIZE)?;
network_manager.register_broadcast_topic(Topic::new(config.proposal_topic), BUFFER_SIZE)?;
let BroadcastTopicChannels {
broadcasted_messages_receiver: inbound_network_receiver,
broadcast_topic_client: outbound_network_sender,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,6 @@ 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
8 changes: 3 additions & 5 deletions crates/papyrus_node/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ const DEFAULT_LEVEL: LevelFilter = LevelFilter::INFO;
// TODO: Consider moving to a more general place.
const GENESIS_HASH: &str = "0x0";

// TODO(guyn): move this to the config.
pub const NETWORK_TOPIC: &str = "consensus_proposals";

// TODO(dvir): add this to config.
// Duration between updates to the storage metrics (those in the collect_storage_metrics function).
const STORAGE_METRICS_UPDATE_INTERVAL: Duration = Duration::from_secs(10);
Expand Down Expand Up @@ -191,10 +188,11 @@ fn spawn_consensus(
debug!("Consensus configuration: {config:?}");

let network_channels = network_manager
.register_broadcast_topic(Topic::new(config.network_topic.clone()), BUFFER_SIZE)?;
.register_broadcast_topic(Topic::new(config.votes_topic.clone()), BUFFER_SIZE)?;
let proposal_network_channels: BroadcastTopicChannels<
StreamMessage<ProposalPart, HeightAndRound>,
> = network_manager.register_broadcast_topic(Topic::new(NETWORK_TOPIC), BUFFER_SIZE)?;
> = network_manager
.register_broadcast_topic(Topic::new(config.proposals_topic), BUFFER_SIZE)?;
let BroadcastTopicChannels {
broadcasted_messages_receiver: inbound_network_receiver,
broadcast_topic_client: outbound_network_sender,
Expand Down
9 changes: 0 additions & 9 deletions crates/sequencing/papyrus_consensus/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ pub struct ConsensusConfig {
pub chain_id: ChainId,
/// The validator ID of the node.
pub validator_id: ValidatorId,
/// The network topic of the consensus.
pub network_topic: String,
/// The height to start the consensus from.
pub start_height: BlockNumber,
/// The number of validators in the consensus.
Expand Down Expand Up @@ -70,12 +68,6 @@ impl SerializeConfig for ConsensusConfig {
"The validator id of the node.",
ParamPrivacyInput::Public,
),
ser_param(
"network_topic",
&self.network_topic,
"The network topic of the consensus.",
ParamPrivacyInput::Public,
),
ser_param(
"start_height",
&self.start_height,
Expand Down Expand Up @@ -131,7 +123,6 @@ impl Default for ConsensusConfig {
Self {
chain_id: ChainId::Other("0x0".to_string()),
validator_id: ValidatorId::from(DEFAULT_VALIDATOR_ID),
network_topic: "consensus".to_string(),
start_height: BlockNumber::default(),
num_validators: 1,
consensus_delay: Duration::from_secs(5),
Expand Down

0 comments on commit eb3ed83

Please sign in to comment.