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

Stateless bootstrap server #3975

Merged
merged 32 commits into from Nov 1, 2022

Conversation

pwojcikdev
Copy link
Contributor

@pwojcikdev pwojcikdev commented Oct 15, 2022

This PR introduces stateless bootstrap server, a component that aims to replace the old bootstrap serving infrastructure. Old design relied on using dedicated tcp connections for bootstrapping, here I only utilize the realtime channels that are already established. Because of this, it is now possible to bootstrap from nodes that for any reason do not allow incoming connections (behind NAT, firewall rules). It will also reduce the number of needed sockets per peer. Lastly, it is also much faster because the requests are done asynchronously, so the effect of latency is minimized.

nano/node/messages.cpp Outdated Show resolved Hide resolved
debug_assert (header.extensions.to_ulong () > 0); // Block payload must have least `not_a_block` terminator
header.serialize (stream);
nano::write (stream, type);
nano::write (stream, id);
Copy link
Contributor

Choose a reason for hiding this comment

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

Endianness should be specified.

nano/node/messages.hpp Outdated Show resolved Hide resolved
error = deserialize (stream);
if (!error)
{
update_header ();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this updating the header? The header should either be right or wrong. It should not need updating/adjusting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, there is no reason to do that in there. Personally I would update the header during serialization, but that is the const method and I didn't want to suddenly refactor all message classes

@pwojcikdev
Copy link
Contributor Author

We discussed internally that adding account info query to the bootstrap server might be useful feature (even though it cannot be 100% trusted). The latest update added just that. @dsiganos

@pwojcikdev pwojcikdev merged commit dd70d9a into nanocurrency:develop Nov 1, 2022
@pwojcikdev pwojcikdev deleted the prs/bootstrap-server branch November 1, 2022 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants