Skip to content

Commit afd5480

Browse files
feat: experimental support for bulk processing on arbitrum-sepolia-testnet (#463)
* feat: add bulk_cid in requestorder * feat: raise orders volume limit to MAX_SAFE_INTEGER * feat: add prepareDatasetBulk * feat: upload bulk files to thegraph ipfs node * feat: add bulkOnly filter on dataset orderbook * chore: update test stack
1 parent 1ea541a commit afd5480

32 files changed

+2950
-1084
lines changed

docs/classes/IExecConfig.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const wallet = IExecWalletModule.fromConfig(config);
3434
- [resolveEnsPublicResolverAddress](IExecConfig.md#resolveenspublicresolveraddress)
3535
- [resolveIexecGatewayURL](IExecConfig.md#resolveiexecgatewayurl)
3636
- [resolveIpfsGatewayURL](IExecConfig.md#resolveipfsgatewayurl)
37+
- [resolveIpfsNodeURL](IExecConfig.md#resolveipfsnodeurl)
3738
- [resolvePocoSubgraphURL](IExecConfig.md#resolvepocosubgraphurl)
3839
- [resolveResultProxyURL](IExecConfig.md#resolveresultproxyurl)
3940
- [resolveSmsURL](IExecConfig.md#resolvesmsurl)
@@ -184,6 +185,18 @@ resolve the current IPFS gateway URL
184185

185186
___
186187

188+
### resolveIpfsNodeURL
189+
190+
**resolveIpfsNodeURL**(): `Promise`<`string`\>
191+
192+
resolve the current IPFS node URL
193+
194+
#### Returns
195+
196+
`Promise`<`string`\>
197+
198+
___
199+
187200
### resolvePocoSubgraphURL
188201

189202
**resolvePocoSubgraphURL**(): `Promise`<`string`\>

docs/classes/IExecOrderModule.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ module exposing order methods
3636
- [hashRequestorder](IExecOrderModule.md#hashrequestorder)
3737
- [hashWorkerpoolorder](IExecOrderModule.md#hashworkerpoolorder)
3838
- [matchOrders](IExecOrderModule.md#matchorders)
39+
- [prepareDatasetBulk](IExecOrderModule.md#preparedatasetbulk)
3940
- [publishApporder](IExecOrderModule.md#publishapporder)
4041
- [publishDatasetorder](IExecOrderModule.md#publishdatasetorder)
4142
- [publishRequestorder](IExecOrderModule.md#publishrequestorder)
@@ -506,6 +507,43 @@ console.log(`created deal ${dealid} in tx ${txHash}`);
506507

507508
___
508509

510+
### prepareDatasetBulk
511+
512+
**prepareDatasetBulk**(`datasetorders`, `options?`): `Promise`<{ `cid`: `string` ; `volume`: `number` }\>
513+
514+
Prepare a bulk from datasetorders to process multiple datasets with a single requestorder
515+
516+
NB:
517+
- datasetorders used must authorize the requester to use the dataset in for free with an infinite volume (`utils.DATASET_INFINITE_VOLUME`)
518+
- depending on the number of datasetorders provided and the `maxDatasetPerTask` option, the bulk might require be splitted into multiple tasks to respect the max dataset per task limit, the returned `volume` is the number of tasks required to process the bulk
519+
520+
example:
521+
```js
522+
const { bulkCid, volume } = await prepareDatasetBulk(datasetorders, { maxDatasetPerTask: 5 });
523+
console.log(`bulk_cid: ${bulkCid}, volume: ${volume}`);
524+
525+
const requestorderTemplate = await createRequestorder({
526+
app: appAddress,
527+
category: 0,
528+
volume: volume, // set the volume
529+
params: { bulk_cid: bulkCid } // set the bulk cid in the requestorder params
530+
});
531+
```
532+
533+
#### Parameters
534+
535+
| Name | Type | Description |
536+
| :------ | :------ | :------ |
537+
| `datasetorders` | [`ConsumableDatasetorder`](../interfaces/internal_.ConsumableDatasetorder.md)[] | - |
538+
| `options?` | `Object` | - |
539+
| `options.maxDatasetPerTask?` | `number` | Maximum number of datasets to include in a single task **`Default`** ```ts 100 ``` |
540+
541+
#### Returns
542+
543+
`Promise`<{ `cid`: `string` ; `volume`: `number` }\>
544+
545+
___
546+
509547
### publishApporder
510548

511549
**publishApporder**(`apporder`, `options?`): `Promise`<`string`\>

docs/classes/IExecOrderbookModule.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,10 @@ console.log('total orders:', count);
152152
153153
| Name | Type | Description |
154154
| :------ | :------ | :------ |
155-
| `datasetAddressOrOptions` | `string` \| { `app?`: `string` ; `dataset?`: `string` ; `datasetOwner?`: `string` ; `isAppStrict?`: `boolean` ; `isRequesterStrict?`: `boolean` ; `isWorkerpoolStrict?`: `boolean` ; `maxTag?`: [`Tag`](../modules.md#tag) \| `string`[] ; `minTag?`: [`Tag`](../modules.md#tag) \| `string`[] ; `minVolume?`: [`BNish`](../modules.md#bnish) ; `page?`: `number` ; `pageSize?`: `number` ; `requester?`: `string` ; `workerpool?`: `string` } | - |
155+
| `datasetAddressOrOptions` | `string` \| { `app?`: `string` ; `bulkOnly?`: `boolean` ; `dataset?`: `string` ; `datasetOwner?`: `string` ; `isAppStrict?`: `boolean` ; `isRequesterStrict?`: `boolean` ; `isWorkerpoolStrict?`: `boolean` ; `maxTag?`: [`Tag`](../modules.md#tag) \| `string`[] ; `minTag?`: [`Tag`](../modules.md#tag) \| `string`[] ; `minVolume?`: [`BNish`](../modules.md#bnish) ; `page?`: `number` ; `pageSize?`: `number` ; `requester?`: `string` ; `workerpool?`: `string` } | - |
156156
| `options?` | `Object` | **`Deprecated`** use first parameter instead migration: replace `fetchDatasetOrderbook(datasetAddress, options)` by `fetchDatasetOrderbook({ dataset: datasetAddress, ...options })` |
157157
| `options.app?` | `string` | include orders restricted to specified app (use `'any'` to include any app) |
158+
| `options.bulkOnly?` | `boolean` | filters out orders that don't allow bulk processing (default: `false`) |
158159
| `options.isAppStrict?` | `boolean` | filters out orders allowing “any” app (default: `false`) |
159160
| `options.isRequesterStrict?` | `boolean` | filters out orders allowing “any” requester (default: `false`) |
160161
| `options.isWorkerpoolStrict?` | `boolean` | filters out orders allowing “any” workerpool (default: `false`) |

docs/interfaces/IExecConfigOptions.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- [hubAddress](IExecConfigOptions.md#hubaddress)
1717
- [iexecGatewayURL](IExecConfigOptions.md#iexecgatewayurl)
1818
- [ipfsGatewayURL](IExecConfigOptions.md#ipfsgatewayurl)
19+
- [ipfsNodeURL](IExecConfigOptions.md#ipfsnodeurl)
1920
- [isNative](IExecConfigOptions.md#isnative)
2021
- [pocoSubgraphURL](IExecConfigOptions.md#pocosubgraphurl)
2122
- [providerOptions](IExecConfigOptions.md#provideroptions)
@@ -118,6 +119,14 @@ override the IPFS gateway URL to target a custom instance
118119

119120
___
120121

122+
### ipfsNodeURL
123+
124+
`Optional` **ipfsNodeURL**: `string`
125+
126+
override the IPFS node URL to target a custom instance
127+
128+
___
129+
121130
### isNative
122131

123132
`Optional` **isNative**: `boolean`

docs/interfaces/internal_.PublishedDatasetorder.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ published sell order for a dataset
1010

1111
### Properties
1212

13+
- [bulk](internal_.PublishedDatasetorder.md#bulk)
1314
- [chainId](internal_.PublishedDatasetorder.md#chainid)
1415
- [order](internal_.PublishedDatasetorder.md#order)
1516
- [orderHash](internal_.PublishedDatasetorder.md#orderhash)
@@ -20,6 +21,14 @@ published sell order for a dataset
2021

2122
## Properties
2223

24+
### bulk
25+
26+
`Optional` **bulk**: `boolean`
27+
28+
true if the order allows bulk processing
29+
30+
___
31+
2332
### chainId
2433

2534
**chainId**: `number`

docs/interfaces/internal_.RequestorderParams.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
### Properties
1010

11+
- [bulk\_cid](internal_.RequestorderParams.md#bulk_cid)
1112
- [iexec\_args](internal_.RequestorderParams.md#iexec_args)
1213
- [iexec\_input\_files](internal_.RequestorderParams.md#iexec_input_files)
1314
- [iexec\_result\_encryption](internal_.RequestorderParams.md#iexec_result_encryption)
@@ -17,6 +18,16 @@
1718

1819
## Properties
1920

21+
### bulk\_cid
22+
23+
`Optional` **bulk\_cid**: `string`
24+
25+
bulk CID for the request
26+
27+
default none
28+
29+
___
30+
2031
### iexec\_args
2132

2233
`Optional` **iexec\_args**: `string`

docs/modules/utils.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
### Variables
1212

13+
- [DATASET\_INFINITE\_VOLUME](utils.md#dataset_infinite_volume)
1314
- [NULL\_ADDRESS](utils.md#null_address)
1415
- [NULL\_BYTES32](utils.md#null_bytes32)
1516

@@ -27,6 +28,19 @@
2728

2829
## Variables
2930

31+
### DATASET\_INFINITE\_VOLUME
32+
33+
`Const` **DATASET\_INFINITE\_VOLUME**: `number`
34+
35+
infinite dataset volume
36+
37+
A `Datasetorder` with this volume is considered as having an infinite volume and is eligible to be processed by any number of tasks without decrementing the remaining volume.
38+
The Dataset owner still can cancel the order at any time.
39+
40+
NB: Infinite volume is represented by the maximum safe integer in JavaScript (`Number.MAX_SAFE_INTEGER`), which is `9007199254740991`.
41+
42+
___
43+
3044
### NULL\_ADDRESS
3145

3246
`Const` **NULL\_ADDRESS**: `string`

eslint.config.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ export default [
5656
'sonarjs/no-nested-functions': 'warn', // todo refactor to enforce error on this rule
5757
'sonarjs/todo-tag': 'warn',
5858
},
59-
settings: {
60-
'import/ignore': ['ethers', 'graphql-request'],
61-
},
6259
},
6360
{
6461
// cli specific files using nodejs globals

0 commit comments

Comments
 (0)