-
Notifications
You must be signed in to change notification settings - Fork 246
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
Conversation
There was a problem hiding this 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
crates/subspace-farmer/src/bin/subspace-farmer/commands/farm.rs
Outdated
Show resolved
Hide resolved
@@ -237,6 +239,40 @@ where | |||
} | |||
} | |||
|
|||
/// Bootstraps Kademlia network | |||
pub async fn bootstrap(&mut self) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
14b039d
to
b7de051
Compare
…ation Simplify bootstrapping process
# Conflicts: # crates/subspace-networking/src/bin/subspace-bootstrap-node/main.rs # crates/subspace-node/src/import_blocks_from_dsn.rs
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: