Skip to content

Commit

Permalink
chore(starknet_consensus_manager): add chain_id to config
Browse files Browse the repository at this point in the history
  • Loading branch information
Yael-Starkware committed Dec 4, 2024
1 parent a6a227b commit 2e874c2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config/sequencer/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,11 @@
"privacy": "Public",
"value": "0.0.0.0:8080"
},
"consensus_manager_config.consensus_config.chain_id": {
"description": "The chain id of the Starknet chain.",
"pointer_target": "chain_id",
"privacy": "Public"
},
"consensus_manager_config.consensus_config.consensus_delay": {
"description": "Delay (seconds) before starting consensus to give time for network peering.",
"privacy": "Public",
Expand Down
10 changes: 10 additions & 0 deletions crates/sequencing/papyrus_consensus/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use papyrus_config::{ParamPath, ParamPrivacyInput, SerializedParam};
use papyrus_network::NetworkConfig;
use serde::{Deserialize, Serialize};
use starknet_api::block::BlockNumber;
use starknet_api::core::ChainId;

use super::types::ValidatorId;

Expand All @@ -23,6 +24,8 @@ const CONSENSUS_QUIC_PORT: u16 = 10101;
/// Configuration for consensus.
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
pub struct ConsensusConfig {
/// The chain id of the Starknet chain.
pub chain_id: ChainId,
/// The validator ID of the node.
pub validator_id: ValidatorId,
/// The network topic of the consensus.
Expand All @@ -45,6 +48,12 @@ pub struct ConsensusConfig {
impl SerializeConfig for ConsensusConfig {
fn dump(&self) -> BTreeMap<ParamPath, SerializedParam> {
let mut config = BTreeMap::from_iter([
ser_param(
"chain_id",
&self.chain_id,
"The chain id of the Starknet chain.",
ParamPrivacyInput::Public,
),
ser_param(
"validator_id",
&self.validator_id,
Expand Down Expand Up @@ -90,6 +99,7 @@ impl Default for ConsensusConfig {
..Default::default()
};
Self {
chain_id: ChainId::Other("0x0".to_string()),
validator_id: ValidatorId::default(),
network_topic: "consensus".to_string(),
start_height: BlockNumber::default(),
Expand Down
1 change: 1 addition & 0 deletions crates/starknet_sequencer_node/src/config/node_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pub static CONFIG_POINTERS: LazyLock<ConfigPointers> = LazyLock::new(|| {
set_pointing_param_paths(&[
"batcher_config.block_builder_config.chain_info.chain_id",
"batcher_config.storage.db_config.chain_id",
"consensus_manager_config.consensus_config.chain_id",
"consensus_manager_config.consensus_config.network_config.chain_id",
"gateway_config.chain_info.chain_id",
"mempool_p2p_config.network_config.chain_id",
Expand Down

0 comments on commit 2e874c2

Please sign in to comment.