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

Test gossip propagation #1342

Merged
merged 2 commits into from
Jul 19, 2024

Conversation

njgheorghita
Copy link
Collaborator

@njgheorghita njgheorghita commented Jul 17, 2024

What was wrong?

Did some digging while debugging #1341 - but looks like our code is working as expected 🥳 Though I feel like it's useful to keep this test in for sanity.

Also added a check to our OFFER functionality to make sure that we can only offer content that's present in the local datastore for unpopulated offers.

How was it fixed?

  • added tests
  • added check to make sure that offered data is available locally

To-Do

@njgheorghita njgheorghita force-pushed the test-gossip-propagation branch 2 times, most recently from 0064571 to 823e23d Compare July 17, 2024 18:00
@njgheorghita njgheorghita marked this pull request as ready for review July 17, 2024 18:10
Copy link
Member

@KolbyML KolbyML left a comment

Choose a reason for hiding this comment

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

:shipit:

Copy link
Collaborator

@morph-dev morph-dev left a comment

Choose a reason for hiding this comment

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

LGTM.

Few non-blocking comments, more for discussion purposes.

@@ -170,6 +170,9 @@ impl HistoryNetworkApiServer for HistoryNetworkApi {
}

/// Send an OFFER request with given ContentKey, to the designated peer and wait for a response.
/// If the content value is provided, a "populated" offer is used, which will not store the
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we add this to other *_rpc.rs files?

Related to this, maybe state shouldn't supported "unpopulated" version.

Copy link
Collaborator Author

@njgheorghita njgheorghita Jul 19, 2024

Choose a reason for hiding this comment

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

Maybe this is true for beacon network as well? I'll wait till @ogenev gets back and check with him, and if so remove the feature for those subnetworks

None,
)
.await
.is_err());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would be worth checking the error itself, because it could fail for some other reason, e.g. wrong test configuration, not being connected/able to talk to the target node, etc.

trace: None,
}
})?;
match self.store.read().get(&content_key) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Question more for my understanding: considering that now we are getting the value from the DB before the OFFER request anyway, why not use Request::PopulatedOffer instead?

And if we switch to Request::PopulatedOffer, do we ever use Request::Offer? And if not, can we remove it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think the whole offer/populated offer is a result of what was easiest for testing, especially back in the early days of the network when these endpoints were a bit more useful. Aka, if I want to test basic gossip across the network, and I know my node has these content keys stored locally, the unpopulated offer endpoint is easier to use than the populated endpoint.

Why not use Request::PopulatedOffer instead?

Well, in the use case of... I know I have this content key stored locally, and I want to gossip it to peer A, this endpoint is still easier, because I don't have to manually go into the store and retrieve the content value, like I would if my only option was a populated offer. Now, is this a use case we even care about / worth supporting, is a valid question. Now that our network has been pretty thoroughly tested, at least in terms of the basic offer/accept flow, how useful is this endpoint?

Basically, it seems possible that we could remove it. But that would require a quick audit of all our tests / hive to make sure it's not being used anywhere. Essentially, this seems like a fairly low-priority issue, and not worth the time right now. But maybe once we start reaching some stability with the state network, it'll be worth re-auditing the jsonrpc api for outdated endpoints and we can revisit this then?

Copy link
Collaborator

@morph-dev morph-dev Jul 19, 2024

Choose a reason for hiding this comment

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

I wasn't talking about JSON rpc endpoint, as much as I was talking about Request object and how we handle it internally.

For example, the json rpc handler can retrieve the content value from the local storage, and call network.overlay.send_populated_offer(..) instead. In that case, I believe we don't need Request::Offer type at all (but still support json rpc offer endpoint).

If you are still not sure what I mean, we can have a look at the code together. It's very possible that I'm not understanding how some things work.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ahh, ok yeah that's interesting. Off the top of my head that seems feasible, but will probably need to do a little tinkering to confirm and make sure there aren't any edge cases that wouldn't be supported. Not super high-priority imo but I put it on my flamingo list of todos

@njgheorghita njgheorghita merged commit 9540bdd into ethereum:master Jul 19, 2024
8 checks passed
@njgheorghita njgheorghita deleted the test-gossip-propagation branch July 19, 2024 13:36
@njgheorghita njgheorghita mentioned this pull request Jul 26, 2024
1 task
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.

3 participants