Skip to content

Commit

Permalink
[State Sync] Set default driver config.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshLind authored and aptos-bot committed Apr 18, 2022
1 parent 051282f commit 9ebc914
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
6 changes: 3 additions & 3 deletions config/src/config/state_sync_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pub struct StateSyncDriverConfig {
impl Default for StateSyncDriverConfig {
fn default() -> Self {
Self {
bootstrapping_mode: BootstrappingMode::DownloadLatestAccountStates,
bootstrapping_mode: BootstrappingMode::ApplyTransactionOutputsFromGenesis,
enable_state_sync_v2: false,
continuous_syncing_mode: ContinuousSyncingMode::ApplyTransactionOutputs,
progress_check_interval_ms: 100,
Expand Down Expand Up @@ -157,9 +157,9 @@ impl Default for DataStreamingServiceConfig {
fn default() -> Self {
Self {
global_summary_refresh_interval_ms: 300,
max_concurrent_requests: 3,
max_concurrent_requests: 1,
max_data_stream_channel_sizes: 1000,
max_request_retry: 5,
max_request_retry: 3,
max_notification_id_mappings: 2000,
progress_check_interval_ms: 100,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,11 @@ async fn test_stream_invalid_response() {
#[tokio::test]
async fn test_stream_out_of_order_responses() {
// Create an epoch ending data stream
let streaming_service_config = DataStreamingServiceConfig::default();
let max_concurrent_requests = 3;
let streaming_service_config = DataStreamingServiceConfig {
max_concurrent_requests,
..Default::default()
};
let (mut data_stream, mut stream_listener) =
create_epoch_ending_stream(streaming_service_config, MIN_ADVERTISED_EPOCH_END);

Expand All @@ -254,7 +258,10 @@ async fn test_stream_out_of_order_responses() {

// Verify at least three requests have been made
let (sent_requests, _) = data_stream.get_sent_requests_and_notifications();
assert_ge!(sent_requests.as_ref().unwrap().len(), 3);
assert_ge!(
sent_requests.as_ref().unwrap().len(),
max_concurrent_requests as usize
);

// Set a response for the second request and verify no notifications
set_epoch_ending_response_in_queue(&mut data_stream, 1);
Expand Down Expand Up @@ -309,7 +316,11 @@ async fn test_stream_out_of_order_responses() {
#[tokio::test]
async fn test_stream_listener_dropped() {
// Create an epoch ending data stream
let streaming_service_config = DataStreamingServiceConfig::default();
let max_concurrent_requests = 3;
let streaming_service_config = DataStreamingServiceConfig {
max_concurrent_requests,
..Default::default()
};
let (mut data_stream, mut stream_listener) =
create_epoch_ending_stream(streaming_service_config, MIN_ADVERTISED_EPOCH_END);

Expand All @@ -321,7 +332,10 @@ async fn test_stream_listener_dropped() {

// Verify no notifications have been sent yet
let (sent_requests, sent_notifications) = data_stream.get_sent_requests_and_notifications();
assert_ge!(sent_requests.as_ref().unwrap().len(), 3);
assert_ge!(
sent_requests.as_ref().unwrap().len(),
max_concurrent_requests as usize
);
assert_eq!(sent_notifications.len(), 0);

// Set a response for the first request and verify a notification is sent
Expand Down

0 comments on commit 9ebc914

Please sign in to comment.