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

chore: dont gossip to disconnected nodes if there are no connected nodes available #1051

Merged
merged 2 commits into from
Dec 1, 2023

Conversation

KolbyML
Copy link
Member

@KolbyML KolbyML commented Dec 1, 2023

What was wrong?

fixes #1049

How was it fixed?

Certain tests where checking if certain functions were working by putting dummy values into our kbuckets. Since we have strict standards for how we handle connected vs disconnected this test failed as it was written before this connection standard was in place.

The solution? set it as connect, this doesn't matter as these tests aren't meant to test the status of the node functionality.

@KolbyML KolbyML self-assigned this Dec 1, 2023
@KolbyML KolbyML marked this pull request as ready for review December 1, 2023 00:25
Copy link
Member

@ogenev ogenev left a comment

Choose a reason for hiding this comment

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

Comment on lines 412 to 415
let state = match set_connected {
true => ConnectionState::Connected,
false => ConnectionState::Disconnected,
};
Copy link
Member

Choose a reason for hiding this comment

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

It is maybe a personal preference, but I like more the following syntax:

Suggested change
let state = match set_connected {
true => ConnectionState::Connected,
false => ConnectionState::Disconnected,
};
let state = if set_connected {
ConnectionState::Connected
} else {
ConnectionState::Disconnected,
}
};

@@ -398,7 +398,7 @@ where
command_tx
}

fn add_bootnodes(&mut self, bootnode_enrs: Vec<Enr>) {
fn add_bootnodes(&mut self, bootnode_enrs: Vec<Enr>, set_connected: bool) {
// Attempt to insert bootnodes into the routing table in a disconnected state.
Copy link
Member

Choose a reason for hiding this comment

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

We need to update this comment and adding a short docstring for this function explaining the set_connected argument would be nice.

@KolbyML KolbyML merged commit 2343ed1 into ethereum:master Dec 1, 2023
1 of 2 checks passed
Copy link
Collaborator

@njgheorghita njgheorghita left a comment

Choose a reason for hiding this comment

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

Nice! Thanks for wrapping this up. Just few grammar bugs to point out. Docstrings w/ good grammar are good imo.

@@ -398,7 +398,11 @@ where
command_tx
}

fn add_bootnodes(&mut self, bootnode_enrs: Vec<Enr>) {
/// Insert a vector of enr's into the routing table
Copy link
Collaborator

Choose a reason for hiding this comment

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

Insert a vector of enrs into the routing table

fn add_bootnodes(&mut self, bootnode_enrs: Vec<Enr>) {
/// Insert a vector of enr's into the routing table
/// set_connected: should only be true for tests, false for production code
/// Tests what use this function are testing if adding to queue's work not if our connection code
Copy link
Collaborator

Choose a reason for hiding this comment

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

Tests that use this function are testing if adding to queues works, not if our connection code works.

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.

Remove all usage of disconnected nodes from the overlay service.
3 participants