Skip to content

Commit

Permalink
chore(papyrus_p2p_sync): decrease sleep upon unanswered query (#2562)
Browse files Browse the repository at this point in the history
  • Loading branch information
eitanm-starkware authored Dec 10, 2024
1 parent b800ae7 commit 81c7a4c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions config/papyrus/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,9 @@
"value": true
},
"p2p_sync.wait_period_for_new_data": {
"description": "Time in seconds to wait when a query returned with partial data before sending a new query",
"description": "Time in millisseconds to wait when a query returned with partial data before sending a new query",
"privacy": "Public",
"value": 5
"value": 50
},
"rpc.chain_id": {
"description": "The chain to follow. For more details see https://docs.starknet.io/documentation/architecture_and_concepts/Blocks/transactions/#chain-id.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
source: crates/papyrus_node/src/config/config_test.rs
expression: dumped_default_config
snapshot_kind: text
---
{
"base_layer.node_url": {
Expand Down Expand Up @@ -430,9 +429,9 @@ snapshot_kind: text
"privacy": "TemporaryValue"
},
"p2p_sync.wait_period_for_new_data": {
"description": "Time in seconds to wait when a query returned with partial data before sending a new query",
"description": "Time in millisseconds to wait when a query returned with partial data before sending a new query",
"value": {
"$serde_json::private::Number": "5"
"$serde_json::private::Number": "50"
},
"privacy": "Public"
},
Expand Down
12 changes: 6 additions & 6 deletions crates/papyrus_p2p_sync/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use futures::channel::mpsc::SendError;
use futures::Stream;
use header::HeaderStreamBuilder;
use papyrus_common::pending_classes::ApiContractClass;
use papyrus_config::converters::deserialize_seconds_to_duration;
use papyrus_config::converters::deserialize_milliseconds_to_duration;
use papyrus_config::dumping::{ser_optional_param, ser_param, SerializeConfig};
use papyrus_config::{ParamPath, ParamPrivacyInput, SerializedParam};
use papyrus_network::network_manager::SqmrClientSender;
Expand Down Expand Up @@ -56,7 +56,7 @@ pub struct P2PSyncClientConfig {
pub num_block_state_diffs_per_query: u64,
pub num_block_transactions_per_query: u64,
pub num_block_classes_per_query: u64,
#[serde(deserialize_with = "deserialize_seconds_to_duration")]
#[serde(deserialize_with = "deserialize_milliseconds_to_duration")]
pub wait_period_for_new_data: Duration,
pub buffer_size: usize,
pub stop_sync_at_block_number: Option<BlockNumber>,
Expand Down Expand Up @@ -92,9 +92,9 @@ impl SerializeConfig for P2PSyncClientConfig {
),
ser_param(
"wait_period_for_new_data",
&self.wait_period_for_new_data.as_secs(),
"Time in seconds to wait when a query returned with partial data before sending a \
new query",
&self.wait_period_for_new_data.as_millis(),
"Time in millisseconds to wait when a query returned with partial data before \
sending a new query",
ParamPrivacyInput::Public,
),
ser_param(
Expand Down Expand Up @@ -125,7 +125,7 @@ impl Default for P2PSyncClientConfig {
num_block_state_diffs_per_query: 100,
num_block_transactions_per_query: 100,
num_block_classes_per_query: 100,
wait_period_for_new_data: Duration::from_secs(5),
wait_period_for_new_data: Duration::from_millis(50),
// TODO(eitan): split this by protocol
buffer_size: 100000,
stop_sync_at_block_number: None,
Expand Down

0 comments on commit 81c7a4c

Please sign in to comment.