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

Change DSN bootstrapping. #1690

Merged
merged 10 commits into from
Jul 26, 2023
Merged

Change DSN bootstrapping. #1690

merged 10 commits into from
Jul 26, 2023

Conversation

shamil-gadelshin
Copy link
Member

This PR changes the network bootstrapping. It removes the redialing of the bootstrapping nodes and utilizes Kademlia bootstrap operation instead. Fixes #1679 (bootstrapping part)

Code contributor checklist:

@shamil-gadelshin shamil-gadelshin added the networking Subspace networking (DSN) label Jul 25, 2023
@shamil-gadelshin shamil-gadelshin self-assigned this Jul 25, 2023
Copy link
Member

@nazar-pc nazar-pc left a comment

Choose a reason for hiding this comment

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

Functionally looks fine, but think can be simplified significantly

@@ -237,6 +239,40 @@ where
}
}

/// Bootstraps Kademlia network
pub async fn bootstrap(&mut self) {
Copy link
Member

Choose a reason for hiding this comment

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

This will work as expected most of the time, but not all the time.

NodeRunner::run() can be called, driven for some time and then dropped. When it it called again, it could be that you're triggering second, third and so on bootstrapping process.

Command::Bootstrap should be sent once in constructor with receiver stored in NodeRunner. Then here you need to check if it is still present and only run this function if it is.

Just remember that any async function can be interrupted at any time.

Also I noticed handle_command is async, which is not desired and not necessary if you change remove_all_known_peer_addresses to not be async anymore. Otherwise you have even more edge cases to potentially deal with.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure whether we have this case in practice but this feature could be achieved using just a bool.

Copy link
Member

Choose a reason for hiding this comment

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

No, it is not. There is absolutely no guarantee that bootstrapping has finished last time you called it. There is a guarantee that it has started bootstrapping process, but not more than that. It will not prevent other commands from being processed in the meantime.

nazar-pc and others added 4 commits July 26, 2023 18:11
# Conflicts:
#	crates/subspace-networking/src/bin/subspace-bootstrap-node/main.rs
#	crates/subspace-node/src/import_blocks_from_dsn.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
networking Subspace networking (DSN)
Projects
Development

Successfully merging this pull request may close these issues.

Reduce dsn-bootstrap-node active connections.
2 participants