Skip to content

Commit b10956a

Browse files
fix: use effective deal volume instead of estimated
1 parent 0ab49d3 commit b10956a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

packages/sdk/src/lib/dataProtectorCore/processBulkRequest.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { utils } from 'iexec';
2+
import { NULL_ADDRESS } from 'iexec/utils';
23
import {
34
MAX_DESIRED_APP_ORDER_PRICE,
45
MAX_DESIRED_WORKERPOOL_ORDER_PRICE,
@@ -315,7 +316,7 @@ export const processBulkRequest = async ({
315316
.fetchWorkerpoolOrderbook({
316317
workerpool: vWorkerpool,
317318
app: vApp,
318-
dataset: 'any', // For bulk requests, we don't specify a specific dataset
319+
dataset: NULL_ADDRESS, // For bulk requests, we don't specify a specific dataset
319320
requester: requester,
320321
isRequesterStrict: useVoucher,
321322
minTag: ['tee', 'scone'],
@@ -372,25 +373,26 @@ export const processBulkRequest = async ({
372373
...(vVoucherOwner ? { voucherAddress: userVoucher?.address } : {}),
373374
};
374375

375-
const { dealid, txHash } = await iexec.order.matchOrders(
376-
orders,
377-
matchOptions
378-
);
376+
const {
377+
dealid,
378+
txHash,
379+
volume: matchedVolume,
380+
} = await iexec.order.matchOrders(orders, matchOptions);
379381

380382
// Store the match results
381383
allDealIds.push(dealid);
382384
allTxHashes.push(txHash);
383385

384386
// Update remaining volume
385-
remainingVolume -= matchVolume;
387+
remainingVolume -= matchedVolume.toNumber();
386388

387389
vOnStatusUpdate({
388390
title: 'REQUEST_TO_PROCESS_BULK_DATA',
389391
isDone: true,
390392
payload: {
391393
txHash: txHash,
392394
dealId: dealid,
393-
matchVolume,
395+
matchVolume: matchedVolume.toNumber(),
394396
remainingVolume,
395397
totalVolume: volume,
396398
},

0 commit comments

Comments
 (0)