From 1617f6856fd980310c83525b2569baf974d16767 Mon Sep 17 00:00:00 2001 From: alexcos20 Date: Sat, 21 Nov 2026 08:28:11 +0200 Subject: [PATCH 1/4] unify_status_endpoints --- package-lock.json | 25 +++++++------- package.json | 2 +- test/http.test.ts | 84 ++++++++++++++++++++++------------------------- 3 files changed, 55 insertions(+), 56 deletions(-) diff --git a/package-lock.json b/package-lock.json index 42effab..4e8f07d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@oasisprotocol/sapphire-ethers-v6": "^6.0.1", "@oceanprotocol/contracts": "^3.2.0-rc.1", "@oceanprotocol/ddo-js": "^1.0.0", - "@oceanprotocol/lib": "^10.1.0", + "@oceanprotocol/lib": "github:oceanprotocol/ocean.js#feature/unify_status_endpoints", "chalk": "^6.0.1", "commander": "^15.0.0", "enquirer": "^2.4.1", @@ -1933,22 +1933,24 @@ "license": "Apache-2.0" }, "node_modules/@oceanprotocol/ddo-js": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@oceanprotocol/ddo-js/-/ddo-js-1.0.0.tgz", - "integrity": "sha512-FSw3rDimhf/aHARzQVN7Ve4xGkgK4cRRr8AJtc3XRH0Knc7WK8ga+TJkx9LvS1KjH7hVePSD9Q7400oJQe0Iqg==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@oceanprotocol/ddo-js/-/ddo-js-1.1.0.tgz", + "integrity": "sha512-9/CYpaD0qzA/smmK63nMDnnd3XYNGGreb8y7uUwiC6ODqEKyvhEdMnSj2Rya4oNpyiJQ9cJhOsNGSEmYDhynKw==", "license": "Apache-2.0", "dependencies": { "ethers": "^6.17.0", "jsonld": "^9.0.0", - "n3": "^2.2.0", + "n3": "^2.13.12", "rdf-literal": "^2.0.0", "rdf-validate-shacl": "^0.6.5" + }, + "engines": { + "node": ">=22" } }, "node_modules/@oceanprotocol/lib": { "version": "10.1.0", - "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-10.1.0.tgz", - "integrity": "sha512-cZue8rqPFgPeC1yuht1A1j5nL9M9C/GQVtHYMk4GhoYpkOzAfPMBqHw2gscmf9r8sdtBZEpSXq2TviZdXwamag==", + "resolved": "git+ssh://git@github.com/oceanprotocol/ocean.js.git#6a12611adb8ca8a433db596447ba79717a5e31d2", "license": "Apache-2.0", "dependencies": { "@chainsafe/libp2p-noise": "^17.0.0", @@ -1965,7 +1967,7 @@ "@libp2p/websockets": "^10.1.21", "@multiformats/multiaddr": "^13.0.3", "@oasisprotocol/sapphire-ethers-v6": "^6.0.1", - "@oceanprotocol/ddo-js": "^1.0.0", + "@oceanprotocol/ddo-js": "^1.1.0", "bignumber.js": "^11.1.5", "cross-fetch": "^4.1.0", "crypto-js": "^4.2.0", @@ -3100,6 +3102,7 @@ "version": "4.2.0", "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==", + "deprecated": "Active development of CryptoJS has been discontinued. This library is no longer maintained.", "license": "MIT" }, "node_modules/datastore-core": { @@ -4938,9 +4941,9 @@ } }, "node_modules/n3": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/n3/-/n3-2.2.5.tgz", - "integrity": "sha512-lR/0N7zVayC6N0uWqrMkPpJn8Up4+qBsjWiBnoOWWEi/ldTcygs2Dw1iAgozzDXLW/fcxXFfbMzpGHlc/1MBLQ==", + "version": "2.13.12", + "resolved": "https://registry.npmjs.org/n3/-/n3-2.13.12.tgz", + "integrity": "sha512-z944NsyJi58WXcYevtNkUL2JhVr0KP6nvED9AgymQq5V35TDaNn1N8kO+OWJk/kj4PR0L/ilWB3d7/bWceg1CQ==", "license": "MIT", "dependencies": { "buffer": "^6.0.3", diff --git a/package.json b/package.json index 13f2b8a..7489cd3 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "@oasisprotocol/sapphire-ethers-v6": "^6.0.1", "@oceanprotocol/contracts": "^3.2.0-rc.1", "@oceanprotocol/ddo-js": "^1.0.0", - "@oceanprotocol/lib": "^10.1.0", + "@oceanprotocol/lib": "github:oceanprotocol/ocean.js#feature/unify_status_endpoints", "chalk": "^6.0.1", "commander": "^15.0.0", "enquirer": "^2.4.1", diff --git a/test/http.test.ts b/test/http.test.ts index 20c59d8..1e807e3 100644 --- a/test/http.test.ts +++ b/test/http.test.ts @@ -1,21 +1,49 @@ import { expect } from "chai"; +import { startP2P, stopP2P, validateNode } from "../src/nodeConnection.js"; -describe("Ocean Node Root Endpoint", () => { - it("should return 200 OK", async () => { - const response = await fetch("http://localhost:8001/"); - const responseBody = await response.json(); +// Node status is fetched through ocean.js `getNodeStatus` (the CLI's own +// `validateNode` wrapper), not a raw `fetch` to the root endpoint. That call +// uses the STATUS command over whichever transport NODE_URL names, so this test +// covers both the HTTP and P2P CI legs, and is immune to the ocean-node #1622 +// root-endpoint rename (`nodeId`/`providerAddress`/`nodePublicKey`/`software` +// are gone; the status object exposes `id`/`address`/`publicKey`). +const NODE_URL = process.env.NODE_URL || "http://127.0.0.1:8001"; +const IS_P2P = !NODE_URL.startsWith("http"); - expect(response.status).to.equal(200); - expect(responseBody).to.have.property("chainIds"); - expect(responseBody).to.have.property("providerAddress"); - expect(responseBody).to.have.property("software"); - expect(responseBody).to.have.property("version"); +describe("Ocean Node status (via getNodeStatus)", function () { + this.timeout(60_000); + + before(() => { + // validateNode awaits ensureP2PReady() for P2P URIs, so P2P must be started. + if (IS_P2P) { + startP2P(NODE_URL); + } + }); - // You can also check the values of the properties - expect(responseBody.software).to.equal("Ocean-Node"); + after(async () => { + await stopP2P(); + }); + + it("should return the full node status object", async () => { + const status = await validateNode(NODE_URL); + + expect(status, `node ${NODE_URL} should be reachable`).to.not.be.null; + expect(status).to.have.property("id"); + expect(status).to.have.property("publicKey"); + expect(status).to.have.property("address"); + expect(status).to.have.property("version"); + expect(status).to.have.property("http"); + expect(status).to.have.property("p2p"); + expect(status).to.have.property("provider"); + expect(status).to.have.property("indexer"); + expect(status).to.have.property("supportedStorage"); + expect(status).to.have.property("uptime"); + expect(status).to.have.property("platform"); + expect(status).to.have.property("codeHash"); + expect(status).to.have.property("allowedAdmins"); // Check if version is "0.0.1" or greater - const [major, minor, patch] = responseBody.version.split(".").map(Number); + const [major, minor, patch] = status.version.split(".").map(Number); expect(major).to.be.at.least(0); if (major === 0) { expect(minor).to.be.at.least(0); @@ -26,38 +54,6 @@ describe("Ocean Node Root Endpoint", () => { }); }); -describe("Direct Command Endpoint", () => { - it("should return correct status", async () => { - const response = await fetch("http://localhost:8001/directCommand", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ command: "status" }), - }); - const responseBody = await response.json(); - - expect(response.status).to.equal(200); - expect(responseBody).to.have.property("id"); - expect(responseBody).to.have.property("publicKey"); - expect(responseBody).to.have.property("address"); - expect(responseBody).to.have.property("version"); - expect(responseBody).to.have.property("http"); - expect(responseBody).to.have.property("p2p"); - expect(responseBody).to.have.property("provider"); - expect(responseBody).to.have.property("indexer"); - expect(responseBody).to.have.property("supportedStorage"); - expect(responseBody).to.have.property("uptime"); - expect(responseBody).to.have.property("platform"); - expect(responseBody).to.have.property("codeHash"); - expect(responseBody).to.have.property("allowedAdmins"); - - // Check the values of some of the properties - expect(responseBody.http).to.be.true; - expect(responseBody.p2p).to.be.true; - }); -}); - describe("getP2PPeers Endpoint", () => { it("should return correct status", async () => { const response = await fetch("http://localhost:8001/getP2PPeers"); From 8bfe19fbca69a02515d05147cae74704b15116d1 Mon Sep 17 00:00:00 2001 From: Alex Coseru Date: Sat, 21 Nov 2026 08:32:12 +0200 Subject: [PATCH 2/4] Add NODE_VERSION to Barge run step Set NODE_VERSION environment variable for Barge. --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d19198..13d017e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -183,6 +183,8 @@ jobs: working-directory: ${{ github.workspace }}/barge run: | bash -x start_ocean.sh --with-typesense 2>&1 > start_ocean.log & + env: + NODE_VERSION: pr-1622 - name: Install dependencies run: npm ci - run: npm run build From 87fce117fadf03b67e1178024e2452e2382035d3 Mon Sep 17 00:00:00 2001 From: alexcos20 Date: Sat, 21 Nov 2026 08:52:48 +0200 Subject: [PATCH 3/4] fix system tests --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d19198..784a39c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -219,7 +219,7 @@ jobs: attempt=1 echo "Waiting for node HTTP API to be ready..." while [ $attempt -le $max_attempts ]; do - PEER_ID=$(curl -s http://127.0.0.1:8001 | jq -r '.nodeId // empty' 2>/dev/null) + PEER_ID=$(curl -s http://127.0.0.1:8001 | jq -r '.id // .nodeId // empty' 2>/dev/null) if [ -n "$PEER_ID" ]; then echo "Got peer ID: $PEER_ID" echo "NODE_URL=${PEER_ID}" >> $GITHUB_ENV From 19a2bfa3096ff5fa9c4cfaca3ed183c4ddaffd0f Mon Sep 17 00:00:00 2001 From: alexcos20 Date: Sat, 21 Nov 2026 09:55:17 +0200 Subject: [PATCH 4/4] test: check node status via getNodeStatus over HTTP, not an in-process P2P dial --- test/http.test.ts | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/test/http.test.ts b/test/http.test.ts index 1e807e3..e92adb7 100644 --- a/test/http.test.ts +++ b/test/http.test.ts @@ -1,33 +1,25 @@ import { expect } from "chai"; -import { startP2P, stopP2P, validateNode } from "../src/nodeConnection.js"; +import { ProviderInstance } from "@oceanprotocol/lib"; -// Node status is fetched through ocean.js `getNodeStatus` (the CLI's own -// `validateNode` wrapper), not a raw `fetch` to the root endpoint. That call -// uses the STATUS command over whichever transport NODE_URL names, so this test -// covers both the HTTP and P2P CI legs, and is immune to the ocean-node #1622 -// root-endpoint rename (`nodeId`/`providerAddress`/`nodePublicKey`/`software` -// are gone; the status object exposes `id`/`address`/`publicKey`). -const NODE_URL = process.env.NODE_URL || "http://127.0.0.1:8001"; -const IS_P2P = !NODE_URL.startsWith("http"); +// Node status is fetched through ocean.js `getNodeStatus` (which uses the STATUS +// command over `POST /directCommand`), not a raw `fetch` to the root endpoint, so +// this is immune to the ocean-node #1622 root-endpoint rename (`nodeId`/ +// `providerAddress`/`nodePublicKey`/`software` are gone; the status object exposes +// `id`/`address`/`publicKey`). It runs over the node's HTTP API, which is up in +// both CI transport legs; the P2P transport itself is exercised by the full +// system-test suite (which runs the CLI with NODE_URL set to the node's peer id). +const NODE_HTTP = "http://127.0.0.1:8001"; describe("Ocean Node status (via getNodeStatus)", function () { - this.timeout(60_000); - - before(() => { - // validateNode awaits ensureP2PReady() for P2P URIs, so P2P must be started. - if (IS_P2P) { - startP2P(NODE_URL); - } - }); - - after(async () => { - await stopP2P(); - }); + this.timeout(30_000); it("should return the full node status object", async () => { - const status = await validateNode(NODE_URL); + const status = await ProviderInstance.getNodeStatus( + NODE_HTTP, + AbortSignal.timeout(15_000), + ); - expect(status, `node ${NODE_URL} should be reachable`).to.not.be.null; + expect(status, `node ${NODE_HTTP} should be reachable`).to.not.be.null; expect(status).to.have.property("id"); expect(status).to.have.property("publicKey"); expect(status).to.have.property("address");