From 6a09e8b8154855f6b3c1980d248a49986a8c85de Mon Sep 17 00:00:00 2001 From: bhartnett <51288821+bhartnett@users.noreply.github.com> Date: Tue, 1 Oct 2024 13:52:18 +0800 Subject: [PATCH 1/7] Add new RPC endpoint portal_*GetContent. --- jsonrpc/src/content/results.json | 7 +++++++ jsonrpc/src/methods/beacon.json | 12 ++++++++++++ jsonrpc/src/methods/history.json | 12 ++++++++++++ jsonrpc/src/methods/state.json | 12 ++++++++++++ 4 files changed, 43 insertions(+) diff --git a/jsonrpc/src/content/results.json b/jsonrpc/src/content/results.json index 21035be8..75dc21eb 100644 --- a/jsonrpc/src/content/results.json +++ b/jsonrpc/src/content/results.json @@ -225,5 +225,12 @@ "title": "number of peers", "type": "number" } + }, + "GetContentResult": { + "name": "GetContentResult", + "description": "Returns the hex encoded content value. If the content is not available, returns \"0x\"", + "schema": { + "$ref": "#/components/schemas/hexString" + } } } diff --git a/jsonrpc/src/methods/beacon.json b/jsonrpc/src/methods/beacon.json index 1dae6869..f6bd6a2b 100644 --- a/jsonrpc/src/methods/beacon.json +++ b/jsonrpc/src/methods/beacon.json @@ -200,5 +200,17 @@ "result": { "$ref": "#/components/contentDescriptors/GossipResult" } + }, + { + "name": "portal_beaconGetContent", + "summary": "Get content from the local database if it exists, otherwise look up the target content key in the network.", + "params": [ + { + "$ref": "#/components/contentDescriptors/ContentKey" + } + ], + "result": { + "$ref": "#/components/contentDescriptors/GetContentResult" + } } ] diff --git a/jsonrpc/src/methods/history.json b/jsonrpc/src/methods/history.json index e94d8abe..93d94275 100644 --- a/jsonrpc/src/methods/history.json +++ b/jsonrpc/src/methods/history.json @@ -192,5 +192,17 @@ "result": { "$ref": "#/components/contentDescriptors/GossipResult" } + }, + { + "name": "portal_historyGetContent", + "summary": "Get content from the local database if it exists, otherwise look up the target content key in the network.", + "params": [ + { + "$ref": "#/components/contentDescriptors/ContentKey" + } + ], + "result": { + "$ref": "#/components/contentDescriptors/GetContentResult" + } } ] diff --git a/jsonrpc/src/methods/state.json b/jsonrpc/src/methods/state.json index 166275e7..8066f2af 100644 --- a/jsonrpc/src/methods/state.json +++ b/jsonrpc/src/methods/state.json @@ -180,5 +180,17 @@ "result": { "$ref": "#/components/contentDescriptors/GossipResult" } + }, + { + "name": "portal_stateGetContent", + "summary": "Get content from the local database if it exists, otherwise look up the target content key in the network.", + "params": [ + { + "$ref": "#/components/contentDescriptors/ContentKey" + } + ], + "result": { + "$ref": "#/components/contentDescriptors/GetContentResult" + } } ] From e34642fb1c7165eab27ce8749903e6bce25d3c5a Mon Sep 17 00:00:00 2001 From: bhartnett <51288821+bhartnett@users.noreply.github.com> Date: Tue, 1 Oct 2024 13:52:52 +0800 Subject: [PATCH 2/7] Add git ignore. --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..c4e5a38c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Specify filepatterns you want git to ignore. +jsonrpc/openrpc.json +jsonrpc/node_modules From 81f472a99d4d15c230db684f4b92b44e93d4a041 Mon Sep 17 00:00:00 2001 From: bhartnett <51288821+bhartnett@users.noreply.github.com> Date: Tue, 1 Oct 2024 22:54:39 +0800 Subject: [PATCH 3/7] Update portal_*GetContent endpoint description. --- jsonrpc/src/methods/beacon.json | 2 +- jsonrpc/src/methods/history.json | 2 +- jsonrpc/src/methods/state.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jsonrpc/src/methods/beacon.json b/jsonrpc/src/methods/beacon.json index f6bd6a2b..6e08cfc1 100644 --- a/jsonrpc/src/methods/beacon.json +++ b/jsonrpc/src/methods/beacon.json @@ -203,7 +203,7 @@ }, { "name": "portal_beaconGetContent", - "summary": "Get content from the local database if it exists, otherwise look up the target content key in the network.", + "summary": "Get content from the local database if it exists, otherwise look up the target content key in the network. After fetching from the network the content is validated and stored in the local database before being returned.", "params": [ { "$ref": "#/components/contentDescriptors/ContentKey" diff --git a/jsonrpc/src/methods/history.json b/jsonrpc/src/methods/history.json index 93d94275..f83d643e 100644 --- a/jsonrpc/src/methods/history.json +++ b/jsonrpc/src/methods/history.json @@ -195,7 +195,7 @@ }, { "name": "portal_historyGetContent", - "summary": "Get content from the local database if it exists, otherwise look up the target content key in the network.", + "summary": "Get content from the local database if it exists, otherwise look up the target content key in the network. After fetching from the network the content is validated and stored in the local database before being returned.", "params": [ { "$ref": "#/components/contentDescriptors/ContentKey" diff --git a/jsonrpc/src/methods/state.json b/jsonrpc/src/methods/state.json index 8066f2af..b6e338e3 100644 --- a/jsonrpc/src/methods/state.json +++ b/jsonrpc/src/methods/state.json @@ -183,7 +183,7 @@ }, { "name": "portal_stateGetContent", - "summary": "Get content from the local database if it exists, otherwise look up the target content key in the network.", + "summary": "Get content from the local database if it exists, otherwise look up the target content key in the network. After fetching from the network the content is validated and stored in the local database before being returned.", "params": [ { "$ref": "#/components/contentDescriptors/ContentKey" From 28d22546bf594f8a6ff9de0a8a0d6f29f0d81339 Mon Sep 17 00:00:00 2001 From: bhartnett <51288821+bhartnett@users.noreply.github.com> Date: Fri, 4 Oct 2024 10:33:20 +0800 Subject: [PATCH 4/7] Rename portal_*RecursiveFindContent endpoints to portal_*GetContent. --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index c4e5a38c..26c9e8f0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ -# Specify filepatterns you want git to ignore. jsonrpc/openrpc.json jsonrpc/node_modules From 3c4cdaee3b093a37419f9e7cb4c92cbef7785755 Mon Sep 17 00:00:00 2001 From: bhartnett <51288821+bhartnett@users.noreply.github.com> Date: Fri, 4 Oct 2024 10:34:15 +0800 Subject: [PATCH 5/7] Rename portal_*RecursiveFindContent endpoints to portal_*GetContent. --- jsonrpc/src/content/results.json | 21 ++++++++------------- jsonrpc/src/methods/beacon.json | 24 ++++++------------------ jsonrpc/src/methods/history.json | 24 ++++++------------------ jsonrpc/src/methods/state.json | 18 +++--------------- 4 files changed, 23 insertions(+), 64 deletions(-) diff --git a/jsonrpc/src/content/results.json b/jsonrpc/src/content/results.json index 75dc21eb..22c60d2f 100644 --- a/jsonrpc/src/content/results.json +++ b/jsonrpc/src/content/results.json @@ -34,7 +34,7 @@ "schema": { "title": "FindContentResult", "type": "object", - "oneOf" :[ + "oneOf": [ { "title": "ContentInfo", "type": "object", @@ -58,7 +58,9 @@ "title": "ENRs", "description": "List of ENR records of nodes that are closer than the recipient is to the requested content", "type": "object", - "required": ["enrs"], + "required": [ + "enrs" + ], "properties": { "enrs": { "type": "array", @@ -164,8 +166,8 @@ } } }, - "RecursiveFindContentResult": { - "name": "RecursiveFindContentResult", + "GetContentResult": { + "name": "GetContentResult", "description": "Returns the hex encoded content value and utp transfer flag. If the content is not available, returns \"0x\"", "schema": { "type": "object", @@ -185,8 +187,8 @@ } } }, - "TraceRecursiveFindContentResult": { - "name": "TraceRecursiveFindContentResult", + "TraceGetContentResult": { + "name": "TraceGetContentResult", "description": "Returns the hex encoded content value and trace data object. If the content is not available, returns \"0x\"", "schema": { "type": "object", @@ -225,12 +227,5 @@ "title": "number of peers", "type": "number" } - }, - "GetContentResult": { - "name": "GetContentResult", - "description": "Returns the hex encoded content value. If the content is not available, returns \"0x\"", - "schema": { - "$ref": "#/components/schemas/hexString" - } } } diff --git a/jsonrpc/src/methods/beacon.json b/jsonrpc/src/methods/beacon.json index 5e15f463..59cdad8d 100644 --- a/jsonrpc/src/methods/beacon.json +++ b/jsonrpc/src/methods/beacon.json @@ -133,27 +133,27 @@ } }, { - "name": "portal_beaconRecursiveFindContent", - "summary": "Look up a target content key in the network", + "name": "portal_beaconGetContent", + "summary": "Get content from the local database if it exists, otherwise look up the target content key in the network. After fetching from the network the content is validated and stored in the local database before being returned.", "params": [ { "$ref": "#/components/contentDescriptors/ContentKey" } ], "result": { - "$ref": "#/components/contentDescriptors/RecursiveFindContentResult" + "$ref": "#/components/contentDescriptors/GetContentResult" } }, { - "name": "portal_beaconTraceRecursiveFindContent", - "summary": "Look up a target content key in the network and get tracing data", + "name": "portal_beaconTraceGetContent", + "summary": "Look up a target content as defined in portal_beaconGetContent and get tracing data", "params": [ { "$ref": "#/components/contentDescriptors/ContentKey" } ], "result": { - "$ref": "#/components/contentDescriptors/TraceRecursiveFindContentResult" + "$ref": "#/components/contentDescriptors/TraceGetContentResult" } }, { @@ -197,17 +197,5 @@ "result": { "$ref": "#/components/contentDescriptors/GossipResult" } - }, - { - "name": "portal_beaconGetContent", - "summary": "Get content from the local database if it exists, otherwise look up the target content key in the network. After fetching from the network the content is validated and stored in the local database before being returned.", - "params": [ - { - "$ref": "#/components/contentDescriptors/ContentKey" - } - ], - "result": { - "$ref": "#/components/contentDescriptors/GetContentResult" - } } ] diff --git a/jsonrpc/src/methods/history.json b/jsonrpc/src/methods/history.json index dea90e57..aa7dc971 100644 --- a/jsonrpc/src/methods/history.json +++ b/jsonrpc/src/methods/history.json @@ -125,27 +125,27 @@ } }, { - "name": "portal_historyRecursiveFindContent", - "summary": "Look up a target content key in the network", + "name": "portal_historyGetContent", + "summary": "Get content from the local database if it exists, otherwise look up the target content key in the network. After fetching from the network the content is validated and stored in the local database before being returned.", "params": [ { "$ref": "#/components/contentDescriptors/ContentKey" } ], "result": { - "$ref": "#/components/contentDescriptors/RecursiveFindContentResult" + "$ref": "#/components/contentDescriptors/GetContentResult" } }, { - "name": "portal_historyTraceRecursiveFindContent", - "summary": "Look up a target content key in the network and get tracing data", + "name": "portal_historyTraceGetContent", + "summary": "Look up a target content as defined in portal_historyGetContent and get tracing data", "params": [ { "$ref": "#/components/contentDescriptors/ContentKey" } ], "result": { - "$ref": "#/components/contentDescriptors/TraceRecursiveFindContentResult" + "$ref": "#/components/contentDescriptors/TraceGetContentResult" } }, { @@ -189,17 +189,5 @@ "result": { "$ref": "#/components/contentDescriptors/GossipResult" } - }, - { - "name": "portal_historyGetContent", - "summary": "Get content from the local database if it exists, otherwise look up the target content key in the network. After fetching from the network the content is validated and stored in the local database before being returned.", - "params": [ - { - "$ref": "#/components/contentDescriptors/ContentKey" - } - ], - "result": { - "$ref": "#/components/contentDescriptors/GetContentResult" - } } ] diff --git a/jsonrpc/src/methods/state.json b/jsonrpc/src/methods/state.json index 93fd22c9..c5f9c400 100644 --- a/jsonrpc/src/methods/state.json +++ b/jsonrpc/src/methods/state.json @@ -125,15 +125,15 @@ } }, { - "name": "portal_stateRecursiveFindContent", - "summary": "Look up a target content key in the network", + "name": "portal_stateGetContent", + "summary": "Get content from the local database if it exists, otherwise look up the target content key in the network. After fetching from the network the content is validated and stored in the local database before being returned.", "params": [ { "$ref": "#/components/contentDescriptors/ContentKey" } ], "result": { - "$ref": "#/components/contentDescriptors/RecursiveFindContentResult" + "$ref": "#/components/contentDescriptors/GetContentResult" } }, { @@ -177,17 +177,5 @@ "result": { "$ref": "#/components/contentDescriptors/GossipResult" } - }, - { - "name": "portal_stateGetContent", - "summary": "Get content from the local database if it exists, otherwise look up the target content key in the network. After fetching from the network the content is validated and stored in the local database before being returned.", - "params": [ - { - "$ref": "#/components/contentDescriptors/ContentKey" - } - ], - "result": { - "$ref": "#/components/contentDescriptors/GetContentResult" - } } ] From 9086752ebe58290286c712b924a0a64ff53e23f6 Mon Sep 17 00:00:00 2001 From: bhartnett <51288821+bhartnett@users.noreply.github.com> Date: Fri, 4 Oct 2024 10:52:03 +0800 Subject: [PATCH 6/7] Update TraceGetContent description wording. --- jsonrpc/src/methods/beacon.json | 2 +- jsonrpc/src/methods/history.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jsonrpc/src/methods/beacon.json b/jsonrpc/src/methods/beacon.json index 59cdad8d..868cbb90 100644 --- a/jsonrpc/src/methods/beacon.json +++ b/jsonrpc/src/methods/beacon.json @@ -146,7 +146,7 @@ }, { "name": "portal_beaconTraceGetContent", - "summary": "Look up a target content as defined in portal_beaconGetContent and get tracing data", + "summary": "Get content as defined in portal_beaconGetContent and get additional tracing data", "params": [ { "$ref": "#/components/contentDescriptors/ContentKey" diff --git a/jsonrpc/src/methods/history.json b/jsonrpc/src/methods/history.json index aa7dc971..8ca98567 100644 --- a/jsonrpc/src/methods/history.json +++ b/jsonrpc/src/methods/history.json @@ -138,7 +138,7 @@ }, { "name": "portal_historyTraceGetContent", - "summary": "Look up a target content as defined in portal_historyGetContent and get tracing data", + "summary": "Get content as defined in portal_historyGetContent and get additional tracing data", "params": [ { "$ref": "#/components/contentDescriptors/ContentKey" From 86d3b0ac4e3a5581ac909f79aeeb4a0d277316d2 Mon Sep 17 00:00:00 2001 From: bhartnett <51288821+bhartnett@users.noreply.github.com> Date: Fri, 4 Oct 2024 11:00:31 +0800 Subject: [PATCH 7/7] Add portal_stateTraceGetContent endpoint and add additional detail to portal_*GetContent descriptions. --- jsonrpc/src/methods/beacon.json | 2 +- jsonrpc/src/methods/history.json | 2 +- jsonrpc/src/methods/state.json | 14 +++++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/jsonrpc/src/methods/beacon.json b/jsonrpc/src/methods/beacon.json index 868cbb90..d6b3ebf5 100644 --- a/jsonrpc/src/methods/beacon.json +++ b/jsonrpc/src/methods/beacon.json @@ -134,7 +134,7 @@ }, { "name": "portal_beaconGetContent", - "summary": "Get content from the local database if it exists, otherwise look up the target content key in the network. After fetching from the network the content is validated and stored in the local database before being returned.", + "summary": "Get content from the local database if it exists, otherwise look up the target content key in the network. After fetching from the network the content is validated and stored in the local database if storage criteria is met before being returned.", "params": [ { "$ref": "#/components/contentDescriptors/ContentKey" diff --git a/jsonrpc/src/methods/history.json b/jsonrpc/src/methods/history.json index 8ca98567..e5257b1f 100644 --- a/jsonrpc/src/methods/history.json +++ b/jsonrpc/src/methods/history.json @@ -126,7 +126,7 @@ }, { "name": "portal_historyGetContent", - "summary": "Get content from the local database if it exists, otherwise look up the target content key in the network. After fetching from the network the content is validated and stored in the local database before being returned.", + "summary": "Get content from the local database if it exists, otherwise look up the target content key in the network. After fetching from the network the content is validated and stored in the local database if storage criteria is met before being returned.", "params": [ { "$ref": "#/components/contentDescriptors/ContentKey" diff --git a/jsonrpc/src/methods/state.json b/jsonrpc/src/methods/state.json index c5f9c400..b99ffb42 100644 --- a/jsonrpc/src/methods/state.json +++ b/jsonrpc/src/methods/state.json @@ -126,7 +126,7 @@ }, { "name": "portal_stateGetContent", - "summary": "Get content from the local database if it exists, otherwise look up the target content key in the network. After fetching from the network the content is validated and stored in the local database before being returned.", + "summary": "Get content from the local database if it exists, otherwise look up the target content key in the network. After fetching from the network the content is validated and stored in the local database if storage criteria is met before being returned.", "params": [ { "$ref": "#/components/contentDescriptors/ContentKey" @@ -136,6 +136,18 @@ "$ref": "#/components/contentDescriptors/GetContentResult" } }, + { + "name": "portal_stateTraceGetContent", + "summary": "Get content as defined in portal_stateGetContent and get additional tracing data", + "params": [ + { + "$ref": "#/components/contentDescriptors/ContentKey" + } + ], + "result": { + "$ref": "#/components/contentDescriptors/TraceGetContentResult" + } + }, { "name": "portal_stateStore", "summary": "Store state content key with content data",