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

refactor: update jsonrpc endpoint from *RecursiveFindContent to *GetContent #1526

Merged

Conversation

KolbyML
Copy link
Member

@KolbyML KolbyML commented Oct 14, 2024

What was wrong?

updates our codebase to match spec ethereum/portal-network-specs#344

How was it fixed?

by renaming portal_*RecursiveFindContent to portal_*GetContent

@KolbyML KolbyML force-pushed the update-the-recursive-find-content-name branch 2 times, most recently from b590478 to cb6e82e Compare October 14, 2024 05:52
@KolbyML KolbyML changed the title refactor update jsonrpc endpoint from *RecursiveFindContent to *GetContent refactor: update jsonrpc endpoint from *RecursiveFindContent to *GetContent Oct 14, 2024
@KolbyML KolbyML force-pushed the update-the-recursive-find-content-name branch from cb6e82e to cc8cc58 Compare October 14, 2024 05:55
@KolbyML KolbyML self-assigned this Oct 14, 2024
@KolbyML KolbyML marked this pull request as ready for review October 14, 2024 06:06
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.

🚢

I general it looks good to me. Couple of comments that maybe don't even belong to this PR, but I wanted to start discussion (if they are small enough, I wouldn't be against including them into this PR).

Since this is causing some API changes, please wait for at least one more approval.

@@ -78,16 +78,13 @@ pub trait BeaconNetworkApi {
-> RpcResult<ContentInfo>;

/// Lookup a target content key in the network
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it would be good to clarify that it will first check local storage.
Also in other places.

@@ -14,7 +14,7 @@ pub type RawContentValue = Bytes;
pub type DataRadius = U256;
pub type Distance = U256;

/// Part of a TraceRecursiveFindContent response
/// Part of a TraceGetContent response
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct NodeInfo {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This object doesn't seem to be used at all.

@@ -53,7 +53,7 @@ pub struct TraceGossipInfo {
pub transferred: Vec<String>,
}

/// Response for FindContent & RecursiveFindContent endpoints
/// Response for FindContent & GetContent endpoints
Copy link
Collaborator

Choose a reason for hiding this comment

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

While it's true that this is the response type, RecursiveFindContent would only return Content variant (this is also according to spec). Should we create separate type for it?

I also believe that ConnectionId variant is never used (not even for FindContent). Should we remove it?

While it's not strictly related to this pr (renaming endpoint), I think that this is something that we should improve. If you feel like it, maybe do it in this PR, otherwise create an issue for it.

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 will make a follow up PR to resolve this

@@ -299,7 +299,7 @@ pub async fn test_gossip_dropped_with_find_content(peertest: &Peertest, target:
// send find_content request from fresh target to target
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Unrelated to this pr, but this comment is wrong. Or at least, it looks like it was correct, but than line 301 was commented out and line 302 is added. Would be nice to fix it if you know what is happening here.

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 removed it, that seems like an artifact left when writing the test

Copy link
Collaborator

Choose a reason for hiding this comment

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

The comment should still be updated to

@@ -299,7 +299,7 @@ pub async fn test_gossip_dropped_with_find_content(peertest: &Peertest, target:
// send find_content request from fresh target to target
Copy link
Collaborator

Choose a reason for hiding this comment

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

The comment should still be updated to

/// First checks local storage if content is not found lookup a target content key in the
/// network
#[method(name = "beaconGetContent")]
async fn get_content(&self, content_key: BeaconContentKey) -> RpcResult<ContentInfo>;

/// Lookup a target content key in the network. Return tracing info.
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: I think you forgot to update this doc (you did it in other files)

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.

:shipit:

@KolbyML KolbyML merged commit bb30b6d into ethereum:master Oct 16, 2024
12 checks passed
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