Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add syncing configuration options #892

Merged
merged 8 commits into from
Dec 15, 2020
Merged

Add syncing configuration options #892

merged 8 commits into from
Dec 15, 2020

Conversation

dutterbutter
Copy link
Contributor

Summary of changes
Changes introduced in this pull request:

  • Adds SyncConfig to the ChainSyncer
  • Options include worker_tasks and req_window
  • Adds sync options to DaemonOpts for command-line usage
  • Updates tests accordingly

Reference issue to close (if applicable)

Closes #801

Other information and links

Command-line usage:

forest --req-window 100 --worker-tasks 1

@@ -54,14 +54,15 @@ fn peer_manager_update() {
local_sender,
event_receiver,
genesis_ts.clone(),
SyncConfig::default(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should spawn 0 workers, or else the test has unnecessary overhead

@@ -1029,6 +1031,7 @@ mod tests {
genesis: genesis_ts,
bad_blocks: Default::default(),
verifier: Default::default(),
req_window: Default::default(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will be 0, seems like that would cause issues with the test?

@@ -83,6 +83,7 @@ async fn space_race_full_sync() {
genesis,
bad_blocks: Default::default(),
verifier: PhantomData::<FullVerifier>::default(),
req_window: Default::default(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

fn default() -> Self {
Self {
req_window: 200,
worker_tasks: 1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please add the TODO that existed to revisit this value, as this certainly shouldn't stay once side effects fixed?

Comment on lines 58 to 65
impl SyncConfig {
pub fn new(req_window: i64, worker_tasks: usize) -> Self {
Self {
req_window,
worker_tasks
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think a constructor like this is necessary, but doesn't matter much

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can remove if you want and just reference the struct directly in peer_test.rs I just defaulted to adding a constructor instead. Give a thumbs up if you want that changed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just config, it can change later if more are added (probably would be swapped for a builder pattern or something so don't worry about it)

@dutterbutter dutterbutter merged commit d1dbd0a into main Dec 15, 2020
@dutterbutter dutterbutter deleted the db/dynamic branch December 15, 2020 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Blocksync: Implement dynamic request length
2 participants