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

Add ContentNotFoundError #343

Merged
merged 9 commits into from
Oct 4, 2024
Merged

Add ContentNotFoundError #343

merged 9 commits into from
Oct 4, 2024

Conversation

acolytec3
Copy link
Contributor

@acolytec3 acolytec3 commented Sep 26, 2024

In the process of researching Ultralight test failures for Hive, I discovered that the JSON RPC spec currently advises that the portal_*localContent methods return 0x when no content is found.
However, this did not solve a hive test failure for portal_beaconLocalContent for Ultralight when I updated our code to match this spec. After further research, I discovered that trin and fluffy return an error and not 0x when content is not found. This PR updates the spec to reflect the current implemented state of the clients.

Specifically:

  • Corrects the portal_*localContent responses to reflect that the clients return an error
  • Adds a new ContentNotFoundError a specifies that the error code returned should be -32001 for the ContentNotFoundError and the message "content not found" following the current Trin implementation.
  • Adds a -32002 for the ContentNotFoundErrorWithTrace error type that is returned by the traceRecursiveFindContent method types

},
"errors":[{
"$ref": "#/components/errors/ContentNotFoundErrorWithTrace"
}]
},
Copy link
Contributor

@njgheorghita njgheorghita Sep 26, 2024

Choose a reason for hiding this comment

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

Seems like we're also going to want to add this error to simple RecursiveFindContent requests? I'm split on whether we want to include the trace w/ the error for these endpoints... probably not i guess... and just use the simple ContentNotFoundError type

@@ -0,0 +1,13 @@
{
"ContentNotFoundError": {
"code": -32099,
Copy link
Collaborator

Choose a reason for hiding this comment

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

We are using 39001 for this in the code (see PR https://github.com/ethereum/portal-network-specs/pull/276/files)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have updated

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm still seeing the wrong error code here? Maybe the change didn't get merged? And if we're going with 39001 for ContentNotFoundError then we should go with something like 39002 for ContentNotFoundErrorWithTrace?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ugh, sorry, the commit didn't grab the changes in this file. Should be correct now.

jsonrpc/src/methods/beacon.json Show resolved Hide resolved
jsonrpc/src/methods/history.json Show resolved Hide resolved
jsonrpc/src/methods/state.json Show resolved Hide resolved
@@ -0,0 +1,13 @@
{
"ContentNotFoundError": {
"code": -32099,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm still seeing the wrong error code here? Maybe the change didn't get merged? And if we're going with 39001 for ContentNotFoundError then we should go with something like 39002 for ContentNotFoundErrorWithTrace?

@acolytec3
Copy link
Contributor Author

@ogenev @kdeme @KolbyML any outstanding thoughts or are you good with merging this?

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.

Found one small issue everything else looks good :shipit:

jsonrpc/src/errors/errors.json Outdated Show resolved Hide resolved
@acolytec3 acolytec3 merged commit 845f0e6 into master Oct 4, 2024
3 checks passed
@acolytec3 acolytec3 deleted the content-not-found-errors branch October 4, 2024 10:41
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.

4 participants