Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- test/*fullchain* (#190, #196)
- IexecAccessors (#189, #191, #196)
- IexecPoco (#196)
- `trust` specific field (#201)
- IexecPocoBoost (#198)
- Migrate scripts to TypeScript: (#184)
- `getFunctionSignatures.js`, `common-test-snapshot.js`, `test-storage.js`, `timelock.js`
Expand Down
14 changes: 7 additions & 7 deletions test/000_fullchain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ describe('Integration tests', function () {
beneficiary: beneficiary.address,
callback: callbackAddress,
volume,
trust: workers.length ** 2 - 1,
trust: BigInt(workers.length ** 2 - 1),
});
const { dealId, schedulerStakePerDeal } = await iexecWrapper.signAndSponsorMatchOrders(
...orders.toArray(),
Expand Down Expand Up @@ -208,7 +208,7 @@ describe('Integration tests', function () {
beneficiary: beneficiary.address,
callback: callbackAddress,
volume,
trust: workers.length ** 2 - 1,
trust: BigInt(workers.length ** 2 - 1),
});
const { dealId, schedulerStakePerDeal } = await iexecWrapper.signAndMatchOrders(
...orders.toArray(),
Expand Down Expand Up @@ -296,7 +296,7 @@ describe('Integration tests', function () {
beneficiary: beneficiary.address,
callback: callbackAddress,
volume,
trust: 1,
trust: 1n,
});
const { dealId, schedulerStakePerDeal } = await iexecWrapper.signAndSponsorMatchOrders(
...orders.toArray(),
Expand Down Expand Up @@ -374,7 +374,7 @@ describe('Integration tests', function () {
beneficiary: beneficiary.address,
callback: callbackAddress,
volume,
trust: 1,
trust: 1n,
});
const { dealId, schedulerStakePerDeal } = await iexecWrapper.signAndMatchOrders(
...orders.toArray(),
Expand Down Expand Up @@ -450,7 +450,7 @@ describe('Integration tests', function () {
requester: requester.address,
tag: teeDealTag,
volume,
trust: 1,
trust: 1n,
});
const { dealId, dealPrice, schedulerStakePerDeal } = await iexecWrapper.signAndMatchOrders(
...orders.toArray(),
Expand Down Expand Up @@ -522,7 +522,7 @@ describe('Integration tests', function () {
requester: requester.address,
tag: standardDealTag,
volume,
trust: workerNumber ** 2 - 1,
trust: BigInt(workerNumber ** 2 - 1),
});
const { dealId, dealPrice, schedulerStakePerDeal } =
await iexecWrapper.signAndMatchOrders(...orders.toArray());
Expand Down Expand Up @@ -624,7 +624,7 @@ describe('Integration tests', function () {
requester: requester.address,
tag: standardDealTag,
volume,
trust: winningWorkers.length,
trust: BigInt(winningWorkers.length),
});

const { dealId, dealPrice, schedulerStakePerDeal } = await iexecWrapper.signAndMatchOrders(
Expand Down
2 changes: 1 addition & 1 deletion test/200_fullchain-bot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ describe('Integration tests', function () {
requester: requester.address,
tag: standardDealTag,
volume,
trust: 4,
trust: 4n,
});
const { dealId, dealPrice, schedulerStakePerDeal } = await iexecWrapper.signAndMatchOrders(
...orders.toArray(),
Expand Down
2 changes: 1 addition & 1 deletion test/300_fullchain-reopen.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describe('Integration tests', function () {
requester: requester.address,
tag: standardDealTag,
volume,
trust: 4,
trust: 4n,
});
const { dealId, dealPrice, schedulerStakePerDeal } = await iexecWrapper.signAndMatchOrders(
...orders.toArray(),
Expand Down
32 changes: 10 additions & 22 deletions test/byContract/IexecAccessors/IexecAccessorsABILegacy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@
import { SignerWithAddress } from '@nomicfoundation/hardhat-ethers/signers';
import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
import { expect } from 'chai';
import { ZeroAddress } from 'ethers';
import { ethers } from 'hardhat';
import { Wallet, ZeroAddress } from 'ethers';
import {
IexecInterfaceNative,
IexecInterfaceNativeABILegacy,
IexecInterfaceNativeABILegacy__factory,
IexecInterfaceNative__factory,
} from '../../../typechain';
import { OrdersActors, OrdersAssets, OrdersPrices, buildOrders } from '../../../utils/createOrders';
import { OrdersAssets, OrdersPrices, buildOrders } from '../../../utils/createOrders';
import {
ContributionStatusEnum,
TaskStatusEnum,
Expand All @@ -24,19 +21,18 @@ import { IexecWrapper } from '../../utils/IexecWrapper';
import { loadHardhatFixtureDeployment } from '../../utils/hardhat-fixture-deployer';

const standardDealTag = '0x0000000000000000000000000000000000000000000000000000000000000000';
const volume = 1;
const trust = 1;
const volume = 1n;
const trust = 1n;
const categoryId = 1;
const appPrice = 1000;
const datasetPrice = 1_000_000;
const workerpoolPrice = 1_000_000_000;
const callbackAddress = ethers.Wallet.createRandom().address;
const appPrice = 1000n;
const datasetPrice = 1_000_000n;
const workerpoolPrice = 1_000_000_000n;
const callbackAddress = Wallet.createRandom().address;
const dealParams = 'params';
const { resultDigest } = buildUtf8ResultAndDigest('result');
const taskIndex = 0;
const taskIndex = 0n;

let proxyAddress: string;
let iexecPoco: IexecInterfaceNative;
let iexecPocoABILegacy: IexecInterfaceNativeABILegacy;
let iexecWrapper: IexecWrapper;
let [appAddress, workerpoolAddress, datasetAddress]: string[] = [];
Expand All @@ -49,7 +45,6 @@ let [
anyone,
worker1,
]: SignerWithAddress[] = [];
let ordersActors: OrdersActors;
let ordersAssets: OrdersAssets;
let ordersPrices: OrdersPrices;
let [dealId, taskId, resultHash, resultSeal]: string[] = [];
Expand All @@ -68,14 +63,7 @@ describe('IexecAccessorsABILegacy', function () {
accounts);
iexecWrapper = new IexecWrapper(proxyAddress, accounts);
({ appAddress, datasetAddress, workerpoolAddress } = await iexecWrapper.createAssets());
iexecPoco = IexecInterfaceNative__factory.connect(proxyAddress, anyone);
iexecPocoABILegacy = IexecInterfaceNativeABILegacy__factory.connect(proxyAddress, anyone);
ordersActors = {
appOwner: appProvider,
datasetOwner: datasetProvider,
workerpoolOwner: scheduler,
requester: requester,
};
ordersAssets = {
app: appAddress,
dataset: datasetAddress,
Expand Down Expand Up @@ -142,7 +130,7 @@ describe('IexecAccessorsABILegacy', function () {
});

it('[ABILegacy] Should return account', async function () {
const balanceAmount = 3;
const balanceAmount = 3n;
await iexecWrapper.depositInIexecAccount(requester, balanceAmount);
const account = await iexecPocoABILegacy.viewAccountABILegacy(requester.address);
expect(account.length).to.equal(2);
Expand Down
4 changes: 2 additions & 2 deletions test/byContract/IexecPoco/IexecPoco1.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ describe('IexecPoco1', () => {

describe('Match orders', () => {
it('Should match orders with: all assets, beneficiary, BoT, callback, replication', async () => {
const trust = 3;
const trust = 3n;
const category = 2;
const params = '<params>';
// Use orders with full configuration.
Expand Down Expand Up @@ -453,7 +453,7 @@ describe('IexecPoco1', () => {
});

it('[Standard] Should match orders with: all assets, beneficiary, BoT, callback, replication', async () => {
const trust = 3;
const trust = 3n;
const category = 2;
const params = '<params>';
// Use orders with full configuration.
Expand Down
4 changes: 2 additions & 2 deletions test/byContract/IexecPoco/IexecPoco2-claim.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('IexecPoco2#claim', async () => {
requester: requester.address,
prices: ordersPrices,
volume: expectedVolume,
trust: 4, // Consensus is reachable with 2 fresh workers
trust: 4n, // Consensus is reachable with 2 fresh workers
});
const { dealId, taskId, taskIndex, dealPrice, startTime } =
await iexecWrapper.signAndSponsorMatchOrders(...orders.toArray());
Expand Down Expand Up @@ -238,7 +238,7 @@ describe('IexecPoco2#claim', async () => {
assets: ordersAssets,
requester: requester.address,
prices: ordersPrices,
trust: 0,
trust: 0n,
});
const { dealId, taskId, taskIndex } = await iexecWrapper.signAndMatchOrders(
...orders.toArray(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const datasetPrice = 1_000_000n;
const workerpoolPrice = 1_000_000_000n;
const taskPrice = appPrice + datasetPrice + workerpoolPrice;
const timeRef = BigInt(CONFIG.categories[0].workClockTimeRef);
const trust = 1;
const trust = 1n;
const volume = 1n;
const teeDealTag = '0x0000000000000000000000000000000000000000000000000000000000000001';
const standardDealTag = ZeroHash;
Expand Down Expand Up @@ -361,7 +361,7 @@ describe('IexecPoco2#contributeAndFinalize', () => {
requester: requester.address,
prices: ordersPrices,
volume,
trust: 3,
trust: 3n,
tag: standardDealTag,
}).toArray(),
);
Expand Down
12 changes: 6 additions & 6 deletions test/byContract/IexecPoco/IexecPoco2-contribute.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe('IexecPoco2#contribute', () => {
requester: requester.address,
prices: ordersPrices,
volume,
trust: 0,
trust: 0n,
tag: standardDealTag,
});
}
Expand All @@ -107,7 +107,7 @@ describe('IexecPoco2#contribute', () => {
requester: requester.address,
prices: ordersPrices,
volume,
trust: 3,
trust: 3n,
tag: teeDealTag,
}).toArray(),
);
Expand Down Expand Up @@ -212,7 +212,7 @@ describe('IexecPoco2#contribute', () => {
requester: requester.address,
prices: ordersPrices,
volume,
trust: 0,
trust: 0n,
tag: teeDealTag,
}).toArray(),
);
Expand Down Expand Up @@ -337,7 +337,7 @@ describe('IexecPoco2#contribute', () => {
requester: requester.address,
prices: ordersPrices,
volume,
trust: 3, // so consensus is not yet reached on first contribution
trust: 3n, // so consensus is not yet reached on first contribution
tag: standardDealTag,
}).toArray(),
);
Expand Down Expand Up @@ -395,7 +395,7 @@ describe('IexecPoco2#contribute', () => {
requester: requester.address,
prices: ordersPrices,
volume,
trust: 0,
trust: 0n,
tag: teeDealTag,
}).toArray(),
);
Expand Down Expand Up @@ -460,7 +460,7 @@ describe('IexecPoco2#contribute', () => {
requester: requester.address,
prices: ordersPrices,
volume,
trust: 0,
trust: 0n,
tag: teeDealTag,
}).toArray(),
);
Expand Down
4 changes: 2 additions & 2 deletions test/byContract/IexecPoco/IexecPoco2-finalize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ describe('IexecPoco2#finalize', async () => {
requester: requester.address,
prices: ordersPrices,
volume: 1n,
trust: 3,
trust: 3n,
});
const { dealId, taskId, taskIndex } = await iexecWrapper.signAndMatchOrders(
...orders.toArray(),
Expand Down Expand Up @@ -725,7 +725,7 @@ describe('IexecPoco2#finalize', async () => {
...buildOrders({
assets: ordersAssets,
requester: requester.address,
trust: 3,
trust: 3n,
}).toArray(),
);
await iexecPoco.initialize(dealId, taskIndex).then((tx) => tx.wait());
Expand Down
16 changes: 8 additions & 8 deletions test/byContract/IexecPoco/IexecPoco2-reopen.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('IexecPoco2#reopen', async () => {
}

it('Should reopen task after reveal deadline', async () => {
await matchOrdersAndInitializeTask(3); // Multiple workers.
await matchOrdersAndInitializeTask(3n); // Multiple workers.
const resultHash = buildResultHash(taskId, resultDigest);
const badResultDigest = buildUtf8ResultAndDigest('bad-result').resultDigest;
const contributions = [
Expand Down Expand Up @@ -131,7 +131,7 @@ describe('IexecPoco2#reopen', async () => {
});

it('Should not reopen task when sender is not the scheduler', async () => {
await matchOrdersAndInitializeTask(1);
await matchOrdersAndInitializeTask(1n);
await contribute(worker, resultDigest);
const task = await iexecPoco.viewTask(taskId);
// Time travel beyond reveal deadline but before final deadline.
Expand All @@ -145,7 +145,7 @@ describe('IexecPoco2#reopen', async () => {
});

it('Should not reopen task when status is before revealing', async () => {
await matchOrdersAndInitializeTask(3);
await matchOrdersAndInitializeTask(3n);
// Only 1 contribution, consensus not reached yet.
await contribute(worker1, resultDigest);
const task = await iexecPoco.viewTask(taskId);
Expand All @@ -156,7 +156,7 @@ describe('IexecPoco2#reopen', async () => {
});

it('Should not reopen task when status is after revealing', async () => {
await matchOrdersAndInitializeTask(1);
await matchOrdersAndInitializeTask(1n);
const { results, resultDigest } = buildUtf8ResultAndDigest('result');
await contribute(worker, resultDigest);
// Move task to the next status (COMPLETED).
Expand All @@ -173,7 +173,7 @@ describe('IexecPoco2#reopen', async () => {
});

it('Should not reopen task after final deadline', async () => {
await matchOrdersAndInitializeTask(1);
await matchOrdersAndInitializeTask(1n);
await contribute(worker, resultDigest);
const task = await iexecPoco.viewTask(taskId);
// Time travel beyond final deadline.
Expand All @@ -187,7 +187,7 @@ describe('IexecPoco2#reopen', async () => {
});

it('Should not reopen task before reveal deadline', async () => {
await matchOrdersAndInitializeTask(1);
await matchOrdersAndInitializeTask(1n);
await contribute(worker, resultDigest);
const task = await iexecPoco.viewTask(taskId);
// No time travel.
Expand All @@ -200,7 +200,7 @@ describe('IexecPoco2#reopen', async () => {
});

it('Should not reopen task with at least 1 reveal', async () => {
await matchOrdersAndInitializeTask(3);
await matchOrdersAndInitializeTask(3n);
await contribute(worker1, resultDigest);
await contribute(worker2, resultDigest);
// Consensus reached, reveal for worker 1.
Expand All @@ -223,7 +223,7 @@ describe('IexecPoco2#reopen', async () => {
* Create orders with the provided trust, match deal, and initialize task.
* @param trust
*/
async function matchOrdersAndInitializeTask(trust: number) {
async function matchOrdersAndInitializeTask(trust: bigint) {
const orders = buildOrders({
assets: ordersAssets,
prices: ordersPrices,
Expand Down
4 changes: 2 additions & 2 deletions test/byContract/IexecPoco/IexecPoco2-reveal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ describe('IexecPoco2#reveal', () => {
requester: requester.address,
prices: ordersPrices,
volume,
trust: 1,
trust: 1n,
tag: standardDealTag,
});
({ dealId, taskIndex, taskId } = await iexecWrapper.signAndMatchOrders(
Expand Down Expand Up @@ -195,7 +195,7 @@ describe('IexecPoco2#reveal', () => {
requester: requester.address,
prices: ordersPrices,
volume,
trust: 3,
trust: 3n,
tag: standardDealTag,
salt: ethers.zeroPadValue(ethers.toBeHex(Date.now()), 32), // make
}).toArray(), // app and dataset orders unique since already matched in
Expand Down
4 changes: 2 additions & 2 deletions test/byContract/IexecPocoBoost/IexecPocoBoost.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ describe('IexecPocoBoost', function () {
});
const { appOrder, datasetOrder, workerpoolOrder, requestOrder } = orders.toObject();
// Change trust.
requestOrder.trust = 1;
requestOrder.trust = 1n;
// Sign & hash orders.
await signOrders(domain, orders, ordersActors);
// Run & verify.
Expand Down Expand Up @@ -886,7 +886,7 @@ describe('IexecPocoBoost', function () {
requester: requester.address,
});
// Set bad trust (> 1).
orders.requester.trust = 2;
orders.requester.trust = 2n;
await expect(
iexecPocoBoostInstance.matchOrdersBoost(...orders.toArray()),
).to.be.revertedWith('PocoBoost: Bad trust level');
Expand Down
Loading