From 9d582082f05cab961915aef04e74f8e32fd7ba9c Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Fri, 21 Jun 2024 15:20:41 +0100 Subject: [PATCH 01/20] wip: update to support agreementId --- docs/classes/Provider.md | 6 +++--- package-lock.json | 4 ++-- package.json | 2 +- src/services/Provider.ts | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/classes/Provider.md b/docs/classes/Provider.md index e3e92d81..9c937bfc 100644 --- a/docs/classes/Provider.md +++ b/docs/classes/Provider.md @@ -128,9 +128,9 @@ ___ ### computeStatus -▸ **computeStatus**(`providerUri`, `consumerAddress`, `jobId?`, `did?`, `signal?`): `Promise`<[`ComputeJob`](../interfaces/ComputeJob.md) \| [`ComputeJob`](../interfaces/ComputeJob.md)[]\> +▸ **computeStatus**(`providerUri`, `consumerAddress`, `jobId?`, `agreementId?`, `signal?`): `Promise`<[`ComputeJob`](../interfaces/ComputeJob.md) \| [`ComputeJob`](../interfaces/ComputeJob.md)[]\> -Get compute status for a specific jobId/documentId/owner. +Get compute status for a specific jobId/agreementId/owner. #### Parameters @@ -139,7 +139,7 @@ Get compute status for a specific jobId/documentId/owner. | `providerUri` | `string` | The URI of the provider we want to query | | `consumerAddress` | `string` | The consumer ethereum address | | `jobId?` | `string` | The ID of a compute job. | -| `did?` | `string` | The ID of the asset | +| `agreementId?` | `string` | The ID of service agreement | | `signal?` | `AbortSignal` | abort signal | #### Returns diff --git a/package-lock.json b/package-lock.json index 87b25d16..ffb382ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@oceanprotocol/lib", - "version": "3.3.1", + "version": "3.3.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@oceanprotocol/lib", - "version": "3.3.1", + "version": "3.3.2", "license": "Apache-2.0", "dependencies": { "@oceanprotocol/contracts": "^2.0.3", diff --git a/package.json b/package.json index 0870c151..447b59c1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@oceanprotocol/lib", "source": "./src/index.ts", - "version": "3.3.1", + "version": "3.3.2", "description": "JavaScript client library for Ocean Protocol", "main": "./dist/lib.js", "umd:main": "dist/lib.umd.js", diff --git a/src/services/Provider.ts b/src/services/Provider.ts index 27cb40aa..3d5435f0 100644 --- a/src/services/Provider.ts +++ b/src/services/Provider.ts @@ -685,7 +685,7 @@ export class Provider { * @param {string} providerUri The URI of the provider we want to query * @param {string} consumerAddress The consumer ethereum address * @param {string} jobId The ID of a compute job. - * @param {string} did The ID of the asset + * @param {string} agreementId The ID of the service agreement (tx id) * @param {AbortSignal} signal abort signal * @return {Promise} */ @@ -693,7 +693,7 @@ export class Provider { providerUri: string, consumerAddress: string, jobId?: string, - did?: string, + agreementId?: string, signal?: AbortSignal ): Promise { const providerEndpoints = await this.getEndpoints(providerUri) @@ -706,7 +706,7 @@ export class Provider { : null let url = `?consumerAddress=${consumerAddress}` - url += (did && `&documentId=${this.noZeroX(did)}`) || '' + url += (agreementId && `&agreementId=${this.noZeroX(agreementId)}`) || '' url += (jobId && `&jobId=${jobId}`) || '' if (!computeStatusUrl) return null From 1dcafcff6cd51b1d3f0ec4a7ce882ad727a2267b Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Tue, 25 Jun 2024 09:19:41 +0100 Subject: [PATCH 02/20] wip: debug agreemenet id --- ComputeExamples.md | 2 +- test/integration/ComputeExamples.test.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ComputeExamples.md b/ComputeExamples.md index 487ffffd..250c169d 100644 --- a/ComputeExamples.md +++ b/ComputeExamples.md @@ -672,7 +672,7 @@ You can also add various delays so you see the various states of the compute job providerUrl, await consumerAccount.getAddress(), computeJobId, - DATASET_DDO.id + agreementId ) ``` -Let's save the compute job it, we re going to use later +Let's save the compute job id, we re going to use later +We can also save the agreementId. Its another optional field that we can later use to retrieve the job status ```Typescript computeJobId = computeJobs[0].jobId + agreementId = computeJobs[0].agreementId ``` diff --git a/test/integration/ComputeExamples.test.ts b/test/integration/ComputeExamples.test.ts index 877a9392..209ada3e 100644 --- a/test/integration/ComputeExamples.test.ts +++ b/test/integration/ComputeExamples.test.ts @@ -655,8 +655,6 @@ describe('Compute-to-data example tests', async () => { algo ) - console.log('COMPUTE JOBS', computeJobs) - /// ``` /// -Let's save the compute job id, we re going to use later -We can also save the agreementId. Its another optional field that we can later use to retrieve the job status +Let's save the compute job it, we re going to use later ```Typescript computeJobId = computeJobs[0].jobId // eslint-disable-next-line prefer-destructuring From 5105a4fdadbf5590ebf2954a1d6f3a12f77b235c Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Tue, 25 Jun 2024 16:47:42 +0100 Subject: [PATCH 06/20] update compute stop, document id is not needed, neither for operator service, neither used on signature check --- docs/classes/Provider.md | 3 ++- src/services/Provider.ts | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/classes/Provider.md b/docs/classes/Provider.md index 9c937bfc..3757738d 100644 --- a/docs/classes/Provider.md +++ b/docs/classes/Provider.md @@ -154,7 +154,7 @@ ___ ### computeStop -▸ **computeStop**(`did`, `consumerAddress`, `jobId`, `providerUri`, `signer`, `signal?`): `Promise`<[`ComputeJob`](../interfaces/ComputeJob.md) \| [`ComputeJob`](../interfaces/ComputeJob.md)[]\> +▸ **computeStop**(`did`, `consumerAddress`, `jobId`, `providerUri`, `signer`, `signal?`, `agreementId?`): `Promise`<[`ComputeJob`](../interfaces/ComputeJob.md) \| [`ComputeJob`](../interfaces/ComputeJob.md)[]\> Instruct the provider to Stop the execution of a to stop a compute job. @@ -168,6 +168,7 @@ Instruct the provider to Stop the execution of a to stop a compute job. | `providerUri` | `string` | The provider URI. | | `signer` | `Signer` | The consumer signer object. | | `signal?` | `AbortSignal` | abort signal | +| `agreementId?` | `string` | service agreement id | #### Returns diff --git a/src/services/Provider.ts b/src/services/Provider.ts index aec23bdc..be0252bd 100644 --- a/src/services/Provider.ts +++ b/src/services/Provider.ts @@ -620,6 +620,7 @@ export class Provider { jobId: string, providerUri: string, signer: Signer, + agreementId?: string, signal?: AbortSignal ): Promise { const providerEndpoints = await this.getEndpoints(providerUri) @@ -643,12 +644,13 @@ export class Provider { let signatureMessage = consumerAddress signatureMessage += jobId || '' - signatureMessage += (did && `${this.noZeroX(did)}`) || '' - signatureMessage += nonce + // On provider service we just check signature owner + jobId + // signatureMessage += (agreementId && `${this.noZeroX(agreementId)}`) || '' + // signatureMessage += nonce const signature = await this.signProviderRequest(signer, signatureMessage) const payload = Object() payload.signature = signature - payload.documentId = this.noZeroX(did) + payload.agreementId = this.noZeroX(agreementId) payload.consumerAddress = consumerAddress payload.nonce = nonce if (jobId) payload.jobId = jobId From a30665f3d5a26bd4466708c65afc1a2b3a1c221c Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Wed, 26 Jun 2024 09:03:05 +0100 Subject: [PATCH 07/20] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 447b59c1..9b4f1eba 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@oceanprotocol/lib", "source": "./src/index.ts", - "version": "3.3.2", + "version": "3.3.3", "description": "JavaScript client library for Ocean Protocol", "main": "./dist/lib.js", "umd:main": "dist/lib.umd.js", From 5f7d30969299cd69b0b19928b364de2833ec3ab6 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Wed, 26 Jun 2024 10:11:40 +0100 Subject: [PATCH 08/20] update computeStop, add some comments explaining the flow issues on the route --- src/services/Provider.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/services/Provider.ts b/src/services/Provider.ts index be0252bd..ca5f117a 100644 --- a/src/services/Provider.ts +++ b/src/services/Provider.ts @@ -644,7 +644,10 @@ export class Provider { let signatureMessage = consumerAddress signatureMessage += jobId || '' - // On provider service we just check signature owner + jobId + // On current provider impl (and nodes) we DO NOT check this signature + // On nodes we are signing again just the Nonce to send the request to Operator Service + // on current provider we sign: {owner}{job_id}{nonce}" OR {owner}{nonce} if no jobId + // On provider service STOP route, we just check signature owner + jobId OR just owner if no jobId // signatureMessage += (agreementId && `${this.noZeroX(agreementId)}`) || '' // signatureMessage += nonce const signature = await this.signProviderRequest(signer, signatureMessage) From dc675a360b4e583c3691960e5282c8be05eed855 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Thu, 27 Jun 2024 08:20:18 +0100 Subject: [PATCH 09/20] revert version change --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9b4f1eba..447b59c1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@oceanprotocol/lib", "source": "./src/index.ts", - "version": "3.3.3", + "version": "3.3.2", "description": "JavaScript client library for Ocean Protocol", "main": "./dist/lib.js", "umd:main": "dist/lib.umd.js", From 6f13fe796feb9f168f234c8edf5ed27bcc47ce82 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Thu, 27 Jun 2024 08:22:39 +0100 Subject: [PATCH 10/20] Release 3.3.3-next.0 --- CHANGELOG.md | 47 +++++++++++++++++++++++++++-------------------- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 30 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d2d5769..a2dbcfc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,14 +4,23 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [v3.3.3-next.0](https://github.com/oceanprotocol/ocean.js/compare/v3.3.2...v3.3.3-next.0) + +- wip: update to support agreementId [`9d58208`](https://github.com/oceanprotocol/ocean.js/commit/9d582082f05cab961915aef04e74f8e32fd7ba9c) +- update compute stop, document id is not needed, neither for operator service, neither used on signature check [`5105a4f`](https://github.com/oceanprotocol/ocean.js/commit/5105a4fdadbf5590ebf2954a1d6f3a12f77b235c) +- wip: debug agreemenet id [`1dcafcf`](https://github.com/oceanprotocol/ocean.js/commit/1dcafcff6cd51b1d3f0ec4a7ce882ad727a2267b) + #### [v3.3.2](https://github.com/oceanprotocol/ocean.js/compare/v3.3.1...v3.3.2) +> 25 June 2024 + - Split coupled tests to fix timeout issues [`#1827`](https://github.com/oceanprotocol/ocean.js/pull/1827) - Bump braces from 3.0.2 to 3.0.3 [`#1819`](https://github.com/oceanprotocol/ocean.js/pull/1819) - Bump chai-spies and @types/chai-spies [`#1816`](https://github.com/oceanprotocol/ocean.js/pull/1816) - Pontus x devnet config [`#1806`](https://github.com/oceanprotocol/ocean.js/pull/1806) - Update CODEOWNERS [`#1824`](https://github.com/oceanprotocol/ocean.js/pull/1824) - Sanitize service endpoint by adding/reving slash when needed. [`#1821`](https://github.com/oceanprotocol/ocean.js/pull/1821) +- Release 3.3.2 [`3ba3ccb`](https://github.com/oceanprotocol/ocean.js/commit/3ba3ccb6b5df9caa87e31dfb316a1c1c74a6740c) #### [v3.3.1](https://github.com/oceanprotocol/ocean.js/compare/v3.3.0...v3.3.1) @@ -84,29 +93,15 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - make sure we increment a number when working with nonces [`#1781`](https://github.com/oceanprotocol/ocean.js/pull/1781) - Release 3.1.4 [`b2e2cf2`](https://github.com/oceanprotocol/ocean.js/commit/b2e2cf24293af07f597c25e3a3e392db9caa381a) -#### [v3.1.3](https://github.com/oceanprotocol/ocean.js/compare/v3.1.3-next.1...v3.1.3) +#### [v3.1.3](https://github.com/oceanprotocol/ocean.js/compare/v3.1.2...v3.1.3) > 16 October 2023 - fix fs use & error handling [`#1777`](https://github.com/oceanprotocol/ocean.js/pull/1777) - Bump postcss from 8.4.5 to 8.4.31 [`#1778`](https://github.com/oceanprotocol/ocean.js/pull/1778) -- Release 3.1.3 [`1bc5a39`](https://github.com/oceanprotocol/ocean.js/commit/1bc5a39fda217c91cf5c44f41c6275acd20740de) - -#### [v3.1.3-next.1](https://github.com/oceanprotocol/ocean.js/compare/v3.1.3-next.0...v3.1.3-next.1) - -> 11 October 2023 - -- update error handling [`aada8e9`](https://github.com/oceanprotocol/ocean.js/commit/aada8e92af9273ccc20e86dc00ea73bcb7e8dfdf) -- Release 3.1.3-next.1 [`40c22b9`](https://github.com/oceanprotocol/ocean.js/commit/40c22b9b1fa147fd4295da1bdd6248d7714a2b30) - -#### [v3.1.3-next.0](https://github.com/oceanprotocol/ocean.js/compare/v3.1.2...v3.1.3-next.0) - -> 6 October 2023 - - Bump @types/crypto-js from 4.1.1 to 4.1.2 [`#1774`](https://github.com/oceanprotocol/ocean.js/pull/1774) - Bump @types/chai-spies from 1.0.3 to 1.0.4 [`#1776`](https://github.com/oceanprotocol/ocean.js/pull/1776) -- fix fs use [`735dc2f`](https://github.com/oceanprotocol/ocean.js/commit/735dc2f62b976be683bc9fcd7f8940e715b18519) -- Release 3.1.3-next.0 [`5ac5d1f`](https://github.com/oceanprotocol/ocean.js/commit/5ac5d1f44a637b5d8d285757941b0393bb3a7983) +- Release 3.1.3 [`1bc5a39`](https://github.com/oceanprotocol/ocean.js/commit/1bc5a39fda217c91cf5c44f41c6275acd20740de) #### [v3.1.2](https://github.com/oceanprotocol/ocean.js/compare/v3.1.1...v3.1.2) @@ -584,7 +579,21 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - Bump typedoc from 0.22.15 to 0.22.17 [`#1514`](https://github.com/oceanprotocol/ocean.js/pull/1514) - Release 1.1.3 [`7772e93`](https://github.com/oceanprotocol/ocean.js/commit/7772e9387ef9d63f98ea80cfd4eefbea963dd0ad) -#### [v1.1.2](https://github.com/oceanprotocol/ocean.js/compare/v1.0.0...v1.1.2) +#### [v1.1.2](https://github.com/oceanprotocol/ocean.js/compare/v1.1.1...v1.1.2) + +> 15 June 2022 + +- Release 1.1.2 [`85bf271`](https://github.com/oceanprotocol/ocean.js/commit/85bf2716e26d8691aeb9d5504e563d557419dc2e) +- manual bump fix [`5674a54`](https://github.com/oceanprotocol/ocean.js/commit/5674a547d1d367ce88b3595f0be8ebbf12274266) + +#### [v1.1.1](https://github.com/oceanprotocol/ocean.js/compare/v1.1.0...v1.1.1) + +> 15 June 2022 + +- Release 1.1.1 [`ea48e01`](https://github.com/oceanprotocol/ocean.js/commit/ea48e015ac8299f71d57a929f8f30c5d1a8446e7) +- manual bump fix [`a362410`](https://github.com/oceanprotocol/ocean.js/commit/a36241004b1d9578ec5c02d9d6e64d9750c53a7b) + +#### [v1.1.0](https://github.com/oceanprotocol/ocean.js/compare/v1.0.0...v1.1.0) > 15 June 2022 @@ -592,9 +601,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - Bump @types/node from 17.0.35 to 17.0.44 [`#1513`](https://github.com/oceanprotocol/ocean.js/pull/1513) - Bump eslint-config-oceanprotocol from 1.5.0 to 2.0.1 [`#1466`](https://github.com/oceanprotocol/ocean.js/pull/1466) - update to new schema & compute fixes [`#1510`](https://github.com/oceanprotocol/ocean.js/pull/1510) -- Release 1.1.2 [`85bf271`](https://github.com/oceanprotocol/ocean.js/commit/85bf2716e26d8691aeb9d5504e563d557419dc2e) -- manual bump fix [`5674a54`](https://github.com/oceanprotocol/ocean.js/commit/5674a547d1d367ce88b3595f0be8ebbf12274266) -- manual bump fix [`a362410`](https://github.com/oceanprotocol/ocean.js/commit/a36241004b1d9578ec5c02d9d6e64d9750c53a7b) +- Release 1.1.0 [`112c27e`](https://github.com/oceanprotocol/ocean.js/commit/112c27edab58ef0681ea3e87fb09978411924753) #### [v1.0.0](https://github.com/oceanprotocol/ocean.js/compare/v1.0.0-next.45...v1.0.0) diff --git a/package-lock.json b/package-lock.json index 419ea99a..584535a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@oceanprotocol/lib", - "version": "3.3.2", + "version": "3.3.3-next.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@oceanprotocol/lib", - "version": "3.3.2", + "version": "3.3.3-next.0", "license": "Apache-2.0", "dependencies": { "@oceanprotocol/contracts": "^2.0.3", diff --git a/package.json b/package.json index 447b59c1..34457516 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@oceanprotocol/lib", "source": "./src/index.ts", - "version": "3.3.2", + "version": "3.3.3-next.0", "description": "JavaScript client library for Ocean Protocol", "main": "./dist/lib.js", "umd:main": "dist/lib.umd.js", From bb44f762fb9bc9843b0defc30c8f683e1b167db3 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Fri, 28 Jun 2024 11:34:23 +0100 Subject: [PATCH 11/20] fix test --- test/integration/PublishEditConsume.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/PublishEditConsume.test.ts b/test/integration/PublishEditConsume.test.ts index 72504e8a..48ce54b9 100644 --- a/test/integration/PublishEditConsume.test.ts +++ b/test/integration/PublishEditConsume.test.ts @@ -222,7 +222,7 @@ describe('Publish consume test', async () => { addresses.ERC721Factory, aquarius ) - assert(urlAssetId, 'Failed to publish ipfs DDO') + assert(ipfsAssetId, 'Failed to publish ipfs DDO') }) it('Should publish arwave asset', async () => { From 974f3aa64e0a58e88de07e9bb3b5b6febc3da4c1 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Fri, 28 Jun 2024 12:00:31 +0100 Subject: [PATCH 12/20] debug: add more timeout to test --- test/integration/PublishEditConsume.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/PublishEditConsume.test.ts b/test/integration/PublishEditConsume.test.ts index 48ce54b9..777ce056 100644 --- a/test/integration/PublishEditConsume.test.ts +++ b/test/integration/PublishEditConsume.test.ts @@ -380,7 +380,7 @@ describe('Publish consume test', async () => { providerUrl ) assert(ipfsOrderTx, 'Ordering ipfs dataset failed.') - }).timeout(40000) + }).timeout(60000) it('Should order onchain dataset', async () => { onchainOrderTx = await orderAsset( From fb50bee3804d943949da33cfdfb615449d6c39c1 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Fri, 28 Jun 2024 12:16:12 +0100 Subject: [PATCH 13/20] try swap tests order , debug --- test/integration/PublishEditConsume.test.ts | 28 ++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/test/integration/PublishEditConsume.test.ts b/test/integration/PublishEditConsume.test.ts index 777ce056..67bd7fa8 100644 --- a/test/integration/PublishEditConsume.test.ts +++ b/test/integration/PublishEditConsume.test.ts @@ -211,20 +211,6 @@ describe('Publish consume test', async () => { assert(urlAssetId, 'Failed to publish url DDO') }) - it('Should publish ipfs asset', async () => { - ipfsAssetId = await createAsset( - 'IpfsDatatoken', - 'IPFSDT', - publisherAccount, - ifpsFile, - assetDdo, - providerUrl, - addresses.ERC721Factory, - aquarius - ) - assert(ipfsAssetId, 'Failed to publish ipfs DDO') - }) - it('Should publish arwave asset', async () => { arweaveAssetId = await createAsset( 'ArweaveDatatoken', @@ -239,6 +225,20 @@ describe('Publish consume test', async () => { assert(arweaveAssetId, 'Failed to publish ipfs DDO') }) + it('Should publish ipfs asset', async () => { + ipfsAssetId = await createAsset( + 'IpfsDatatoken', + 'IPFSDT', + publisherAccount, + ifpsFile, + assetDdo, + providerUrl, + addresses.ERC721Factory, + aquarius + ) + assert(ipfsAssetId, 'Failed to publish ipfs DDO') + }) + it('Should publish onchain asset', async () => { const chainFile: Smartcontract = { type: 'smartcontract', From 557289e5f2c3a667abb6645a07c8342be881c186 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Fri, 28 Jun 2024 12:23:11 +0100 Subject: [PATCH 14/20] put timeout back and test order,mut be ipfs side temporary --- test/integration/PublishEditConsume.test.ts | 30 ++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/test/integration/PublishEditConsume.test.ts b/test/integration/PublishEditConsume.test.ts index 67bd7fa8..48ce54b9 100644 --- a/test/integration/PublishEditConsume.test.ts +++ b/test/integration/PublishEditConsume.test.ts @@ -211,20 +211,6 @@ describe('Publish consume test', async () => { assert(urlAssetId, 'Failed to publish url DDO') }) - it('Should publish arwave asset', async () => { - arweaveAssetId = await createAsset( - 'ArweaveDatatoken', - 'ARWEAVEDT', - publisherAccount, - arweaveFile, - assetDdo, - providerUrl, - addresses.ERC721Factory, - aquarius - ) - assert(arweaveAssetId, 'Failed to publish ipfs DDO') - }) - it('Should publish ipfs asset', async () => { ipfsAssetId = await createAsset( 'IpfsDatatoken', @@ -239,6 +225,20 @@ describe('Publish consume test', async () => { assert(ipfsAssetId, 'Failed to publish ipfs DDO') }) + it('Should publish arwave asset', async () => { + arweaveAssetId = await createAsset( + 'ArweaveDatatoken', + 'ARWEAVEDT', + publisherAccount, + arweaveFile, + assetDdo, + providerUrl, + addresses.ERC721Factory, + aquarius + ) + assert(arweaveAssetId, 'Failed to publish ipfs DDO') + }) + it('Should publish onchain asset', async () => { const chainFile: Smartcontract = { type: 'smartcontract', @@ -380,7 +380,7 @@ describe('Publish consume test', async () => { providerUrl ) assert(ipfsOrderTx, 'Ordering ipfs dataset failed.') - }).timeout(60000) + }).timeout(40000) it('Should order onchain dataset', async () => { onchainOrderTx = await orderAsset( From 986f8fa5bf20b68d9b0d5bed9be99dbcc1524169 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Mon, 1 Jul 2024 10:14:33 +0100 Subject: [PATCH 15/20] debug test --- test/integration/PublishEditConsume.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/integration/PublishEditConsume.test.ts b/test/integration/PublishEditConsume.test.ts index 48ce54b9..b1cd66ba 100644 --- a/test/integration/PublishEditConsume.test.ts +++ b/test/integration/PublishEditConsume.test.ts @@ -291,6 +291,7 @@ describe('Publish consume test', async () => { resolvedIpfsAssetDdo = await aquarius.waitForAqua(ipfsAssetId) assert(resolvedIpfsAssetDdo, 'Cannot fetch ipfs DDO from Aquarius') + console.log('RESOLVE: resolvedIpfsAssetDdo: ', resolvedIpfsAssetDdo) resolvedOnchainAssetDdo = await aquarius.waitForAqua(onchainAssetId) assert(resolvedOnchainAssetDdo, 'Cannot fetch onchain DDO from Aquarius') @@ -370,6 +371,7 @@ describe('Publish consume test', async () => { }).timeout(40000) it('Should order ipfs dataset', async () => { + console.log('ORDER resolvedIpfsAssetDdo: ', resolvedIpfsAssetDdo) ipfsOrderTx = await orderAsset( resolvedIpfsAssetDdo.id, resolvedIpfsAssetDdo.services[0].datatokenAddress, From 50a515b300456d7775d38508e45555d04a23c97a Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Mon, 1 Jul 2024 10:47:30 +0100 Subject: [PATCH 16/20] more debug --- test/integration/helpers.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/integration/helpers.ts b/test/integration/helpers.ts index e3e097c8..ce52d602 100644 --- a/test/integration/helpers.ts +++ b/test/integration/helpers.ts @@ -182,6 +182,8 @@ export async function orderAsset( providerUrl ) + console.log('initializeData: ', initializeData) + const providerFees: ProviderFees = { providerFeeAddress: initializeData.providerFee.providerFeeAddress, providerFeeToken: initializeData.providerFee.providerFeeToken, @@ -192,6 +194,7 @@ export async function orderAsset( providerData: initializeData.providerFee.providerData, validUntil: initializeData.providerFee.validUntil } + console.log('providerFees: ', providerFees) // make the payment const tx = await datatoken.startOrder( @@ -200,7 +203,9 @@ export async function orderAsset( 0, providerFees ) + console.log('tx: ', tx) const orderTx = await tx.wait() + console.log('orderTx: ', orderTx) const orderStartedTx = getEventFromTx(orderTx, 'OrderStarted') return orderStartedTx } From 0d09bd3ae9b6e6fb6eb74bd0bd128d981fdb31ed Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Mon, 1 Jul 2024 11:04:25 +0100 Subject: [PATCH 17/20] more debug --- test/integration/helpers.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/integration/helpers.ts b/test/integration/helpers.ts index ce52d602..8f358ae7 100644 --- a/test/integration/helpers.ts +++ b/test/integration/helpers.ts @@ -174,6 +174,15 @@ export async function orderAsset( datatoken: Datatoken, providerUrl: string ) { + console.log('Before providerInitialize') + console.log(did) + console.log(datatokenAddress) + console.log(consumerAccount) + console.log(serviceId) + console.log(serviceIndex) + console.log(datatoken) + console.log(providerUrl) + console.log('--------------------------------------------------------') const initializeData = await ProviderInstance.initialize( did, serviceId, From c5b2fc50a5bb1e0ac539d7dcdb947e65d6861156 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Mon, 1 Jul 2024 12:22:19 +0100 Subject: [PATCH 18/20] more debugging --- src/services/Provider.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/services/Provider.ts b/src/services/Provider.ts index ca5f117a..ca90ce47 100644 --- a/src/services/Provider.ts +++ b/src/services/Provider.ts @@ -382,18 +382,22 @@ export class Provider { if (validUntil) initializeUrl += '&validUntil=' + validUntil let response try { + console.log('ProviderInitialize url: ', initializeUrl) response = await fetch(initializeUrl, { method: 'GET', headers: { 'Content-Type': 'application/json' }, signal }) + console.log('response: ', response) } catch (e) { + console.log('error: ', e) LoggerInstance.error('Provider initialized failed: ') LoggerInstance.error(e) throw new Error(`Provider initialize failed url: ${initializeUrl} `) } if (response?.ok) { const results: ProviderInitialize = await response.json() + console.log('results: ', results) return results } const resolvedResponse = await response.json() @@ -403,6 +407,7 @@ export class Provider { response.statusText, resolvedResponse ) + console.log('resolvedResponse: ', resolvedResponse) throw new Error(JSON.stringify(resolvedResponse)) } From 88fea271daec08930b680c347a6186d89bc2194e Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Mon, 1 Jul 2024 12:53:37 +0100 Subject: [PATCH 19/20] try other ipfs file --- test/integration/PublishEditConsume.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/integration/PublishEditConsume.test.ts b/test/integration/PublishEditConsume.test.ts index b1cd66ba..3b6281ca 100644 --- a/test/integration/PublishEditConsume.test.ts +++ b/test/integration/PublishEditConsume.test.ts @@ -78,7 +78,8 @@ const ifpsFile: Files = { files: [ { type: 'ipfs', - hash: 'QmdMBw956S3i2H2ioS9cERrtxoLJuSsfjzCvkqoDgUa2xm' + hash: 'QmRhsp7eghZtW4PktPC2wAHdKoy2LiF1n6UXMKmAhqQJUA' + // not exists anymore? 'QmdMBw956S3i2H2ioS9cERrtxoLJuSsfjzCvkqoDgUa2xm' } ] } From 4e0536a1f8a812e4002b437665ce5357fddccd22 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Mon, 1 Jul 2024 14:06:13 +0100 Subject: [PATCH 20/20] remove console.logs --- src/services/Provider.ts | 5 ----- test/integration/PublishEditConsume.test.ts | 3 --- test/integration/helpers.ts | 14 -------------- 3 files changed, 22 deletions(-) diff --git a/src/services/Provider.ts b/src/services/Provider.ts index ca90ce47..ca5f117a 100644 --- a/src/services/Provider.ts +++ b/src/services/Provider.ts @@ -382,22 +382,18 @@ export class Provider { if (validUntil) initializeUrl += '&validUntil=' + validUntil let response try { - console.log('ProviderInitialize url: ', initializeUrl) response = await fetch(initializeUrl, { method: 'GET', headers: { 'Content-Type': 'application/json' }, signal }) - console.log('response: ', response) } catch (e) { - console.log('error: ', e) LoggerInstance.error('Provider initialized failed: ') LoggerInstance.error(e) throw new Error(`Provider initialize failed url: ${initializeUrl} `) } if (response?.ok) { const results: ProviderInitialize = await response.json() - console.log('results: ', results) return results } const resolvedResponse = await response.json() @@ -407,7 +403,6 @@ export class Provider { response.statusText, resolvedResponse ) - console.log('resolvedResponse: ', resolvedResponse) throw new Error(JSON.stringify(resolvedResponse)) } diff --git a/test/integration/PublishEditConsume.test.ts b/test/integration/PublishEditConsume.test.ts index 3b6281ca..c6c3e55e 100644 --- a/test/integration/PublishEditConsume.test.ts +++ b/test/integration/PublishEditConsume.test.ts @@ -79,7 +79,6 @@ const ifpsFile: Files = { { type: 'ipfs', hash: 'QmRhsp7eghZtW4PktPC2wAHdKoy2LiF1n6UXMKmAhqQJUA' - // not exists anymore? 'QmdMBw956S3i2H2ioS9cERrtxoLJuSsfjzCvkqoDgUa2xm' } ] } @@ -292,7 +291,6 @@ describe('Publish consume test', async () => { resolvedIpfsAssetDdo = await aquarius.waitForAqua(ipfsAssetId) assert(resolvedIpfsAssetDdo, 'Cannot fetch ipfs DDO from Aquarius') - console.log('RESOLVE: resolvedIpfsAssetDdo: ', resolvedIpfsAssetDdo) resolvedOnchainAssetDdo = await aquarius.waitForAqua(onchainAssetId) assert(resolvedOnchainAssetDdo, 'Cannot fetch onchain DDO from Aquarius') @@ -372,7 +370,6 @@ describe('Publish consume test', async () => { }).timeout(40000) it('Should order ipfs dataset', async () => { - console.log('ORDER resolvedIpfsAssetDdo: ', resolvedIpfsAssetDdo) ipfsOrderTx = await orderAsset( resolvedIpfsAssetDdo.id, resolvedIpfsAssetDdo.services[0].datatokenAddress, diff --git a/test/integration/helpers.ts b/test/integration/helpers.ts index 8f358ae7..e3e097c8 100644 --- a/test/integration/helpers.ts +++ b/test/integration/helpers.ts @@ -174,15 +174,6 @@ export async function orderAsset( datatoken: Datatoken, providerUrl: string ) { - console.log('Before providerInitialize') - console.log(did) - console.log(datatokenAddress) - console.log(consumerAccount) - console.log(serviceId) - console.log(serviceIndex) - console.log(datatoken) - console.log(providerUrl) - console.log('--------------------------------------------------------') const initializeData = await ProviderInstance.initialize( did, serviceId, @@ -191,8 +182,6 @@ export async function orderAsset( providerUrl ) - console.log('initializeData: ', initializeData) - const providerFees: ProviderFees = { providerFeeAddress: initializeData.providerFee.providerFeeAddress, providerFeeToken: initializeData.providerFee.providerFeeToken, @@ -203,7 +192,6 @@ export async function orderAsset( providerData: initializeData.providerFee.providerData, validUntil: initializeData.providerFee.validUntil } - console.log('providerFees: ', providerFees) // make the payment const tx = await datatoken.startOrder( @@ -212,9 +200,7 @@ export async function orderAsset( 0, providerFees ) - console.log('tx: ', tx) const orderTx = await tx.wait() - console.log('orderTx: ', orderTx) const orderStartedTx = getEventFromTx(orderTx, 'OrderStarted') return orderStartedTx }