Skip to content

Commit

Permalink
fix(network): include network chain_id in default config
Browse files Browse the repository at this point in the history
  • Loading branch information
AlonLStarkWare committed Aug 6, 2024
1 parent 4445e06 commit 3f92cc2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
5 changes: 5 additions & 0 deletions config/papyrus/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@
"privacy": "TemporaryValue",
"value": true
},
"network.chain_id": {
"description": "The chain to follow. For more details see https://docs.starknet.io/documentation/architecture_and_concepts/Blocks/transactions/#chain-id.",
"pointer_target": "chain_id",
"privacy": "Public"
},
"network.idle_connection_timeout": {
"description": "Amount of time in seconds that a connection with no active sessions will stay alive.",
"privacy": "Public",
Expand Down
2 changes: 1 addition & 1 deletion crates/papyrus_network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ papyrus_common.workspace = true
papyrus_config.workspace = true
replace_with.workspace = true
serde = { workspace = true, features = ["derive"] }
starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0"}
starknet_api = { path = "../starknet_api", version = "0.13.0-rc.0" }
thiserror.workspace = true
tokio = { workspace = true, features = ["full", "sync"] }
tokio-retry.workspace = true
Expand Down
6 changes: 6 additions & 0 deletions crates/papyrus_network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ impl SerializeConfig for NetworkConfig {
alive.",
ParamPrivacyInput::Public,
),
ser_param(
"chain_id",
&self.chain_id,
"The chain to follow. For more details see https://docs.starknet.io/documentation/architecture_and_concepts/Blocks/transactions/#chain-id.",
ParamPrivacyInput::Public,
),
]);
config.extend(ser_optional_param(
&self.bootstrap_peer_multiaddr,
Expand Down
2 changes: 1 addition & 1 deletion crates/papyrus_network/src/mixed_behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl MixedBehaviour {
let mut kademlia_config = kad::Config::default();
kademlia_config.set_protocol_names(vec![
StreamProtocol::try_from_owned(format!("/starknet/kad/{}/1.0.0", chain_id))
.expect("Failed to create kademlia protocol"),
.expect("Failed to create StreamProtocol from a string that starts with /"),
]);
Self {
peer_manager: peer_manager::PeerManager::new(PeerManagerConfig::default()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ expression: dumped_default_config
"value": true,
"privacy": "TemporaryValue"
},
"network.chain_id": {
"description": "The chain to follow. For more details see https://docs.starknet.io/documentation/architecture_and_concepts/Blocks/transactions/#chain-id.",
"value": "SN_MAIN",
"privacy": "Public"
},
"network.idle_connection_timeout": {
"description": "Amount of time in seconds that a connection with no active sessions will stay alive.",
"value": {
Expand Down

0 comments on commit 3f92cc2

Please sign in to comment.