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 #276

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions jsonrpc/src/content/results.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
},
"RecursiveFindContentResult": {
"name": "RecursiveFindContentResult",
"description": "Returns the hex encoded content value and utp transfer flag. If the content is not available, returns \"0x\"",
"description": "Returns the hex encoded content value and utp transfer flag, if it was found.",
"schema": {
"type": "object",
"required": [
Expand All @@ -179,7 +179,7 @@
},
"TraceRecursiveFindContentResult": {
"name": "TraceRecursiveFindContentResult",
"description": "Returns the hex encoded content value and trace data object. If the content is not available, returns \"0x\"",
"description": "Returns the hex encoded content value and trace data object, if it was found.",
"schema": {
"type": "object",
"required": [
Expand All @@ -205,7 +205,7 @@
},
"LocalContentResult": {
"name": "LocalContentResult",
"description": "Returns the hex encoded content value. If the content is not available, returns \"0x\"",
"description": "Returns the hex encoded content value, if it was found.",
"schema": {
"$ref": "#/components/schemas/hexString"
}
Expand Down
21 changes: 18 additions & 3 deletions jsonrpc/src/methods/history.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,12 @@
],
"result": {
"$ref": "#/components/contentDescriptors/RecursiveFindContentResult"
}
},
"errors": [
{
"$ref": "#/components/schemas/ContentNotFoundError"
}
]
},
{
"name": "portal_historyTraceRecursiveFindContent",
Expand All @@ -149,7 +154,12 @@
],
"result": {
"$ref": "#/components/contentDescriptors/TraceRecursiveFindContentResult"
}
},
"errors": [
Copy link
Collaborator

@kdeme kdeme Feb 28, 2024

Choose a reason for hiding this comment

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

As I was making these adjustments in fluffy, I realized that we shouldn't return an error for the trace version of the call. Else we will not receive the actual trace which still contains useful information of the route the requests took.

So I think we should instead make the content and utpTransfer not required or perhaps even incorporate them in the traceResultObject. In the fluffy implementation it seems that the content field is already optional for the trace version of the request (cc @mynameisdaniil).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking that in the trace versions of these calls, you would still return the trace but in the "data" field of the error

{
"$ref": "#/components/schemas/ContentNotFoundError"
}
]
},
{
"name": "portal_historyStore",
Expand All @@ -176,7 +186,12 @@
],
"result": {
"$ref": "#/components/contentDescriptors/LocalContentResult"
}
},
"errors": [
{
"$ref": "#/components/schemas/ContentNotFoundError"
}
]
},
{
"name": "portal_historyGossip",
Expand Down
14 changes: 12 additions & 2 deletions jsonrpc/src/methods/state.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,12 @@
],
"result": {
"$ref": "#/components/contentDescriptors/RecursiveFindContentResult"
}
},
"errors": [
{
"$ref": "#/components/schemas/ContentNotFoundError"
}
]
},
{
"name": "portal_stateStore",
Expand All @@ -164,7 +169,12 @@
],
"result": {
"$ref": "#/components/contentDescriptors/LocalContentResult"
}
},
"errors": [
{
"$ref": "#/components/schemas/ContentNotFoundError"
}
]
},
{
"name": "portal_stateGossip",
Expand Down
9 changes: 9 additions & 0 deletions jsonrpc/src/schemas/errors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"ContentNotFoundError": {
"code": -39001,
"message": "Unable to locate content on the network.",
"data": {
"$ref": "#/components/schemas/traceResultObject"
}
}
}
Loading