Skip to content

Commit 02ad77f

Browse files
committed
Use utility function everywhere
1 parent d867adf commit 02ad77f

File tree

5 files changed

+16
-14
lines changed

5 files changed

+16
-14
lines changed

test/000_fullchain-boost.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
} from '../utils/poco-tools';
3838
import { IexecWrapper } from './utils/IexecWrapper';
3939
import { loadHardhatFixtureDeployment } from './utils/hardhat-fixture-deployer';
40+
import { randomAddress } from './utils/utils';
4041

4142
const teeDealTag = '0x0000000000000000000000000000000000000000000000000000000000000001';
4243
const taskIndex = 0n;
@@ -129,7 +130,7 @@ describe('IexecPocoBoostFacet (IT)', function () {
129130

130131
describe('MatchOrders', function () {
131132
it('Should match orders (TEE)', async function () {
132-
const callbackAddress = ethers.Wallet.createRandom().address;
133+
const callbackAddress = randomAddress();
133134
const orders = buildOrders({
134135
assets: ordersAssets,
135136
requester: requester.address,
@@ -288,7 +289,7 @@ describe('IexecPocoBoostFacet (IT)', function () {
288289
});
289290

290291
it('Should sponsor match orders (TEE)', async function () {
291-
const callbackAddress = ethers.Wallet.createRandom().address;
292+
const callbackAddress = randomAddress();
292293
const orders = buildOrders({
293294
assets: ordersAssets,
294295
requester: requester.address,

test/000_fullchain.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
} from '../utils/poco-tools';
1717
import { IexecWrapper } from './utils/IexecWrapper';
1818
import { loadHardhatFixtureDeployment } from './utils/hardhat-fixture-deployer';
19+
import { randomAddress } from './utils/utils';
1920

2021
// +---------+-------------+-------------+-------------+----------+-----+---------------------------------------------+
2122
// | | Sponsorship | Replication | Beneficiary | Callback | BoT | Type |
@@ -34,7 +35,7 @@ const teeDealTag = '0x0000000000000000000000000000000000000000000000000000000000
3435
const appPrice = 1000n;
3536
const datasetPrice = 1_000_000n;
3637
const workerpoolPrice = 1_000_000_000n;
37-
const callbackAddress = ethers.Wallet.createRandom().address;
38+
const callbackAddress = randomAddress();
3839
const { results, resultDigest } = buildUtf8ResultAndDigest('result');
3940
const { resultsCallback, callbackResultDigest } = buildResultCallbackAndDigest(123);
4041

test/byContract/IexecAccessors/IexecAccessors.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {
2828
} from '../../../utils/poco-tools';
2929
import { IexecWrapper } from '../../utils/IexecWrapper';
3030
import { loadHardhatFixtureDeployment } from '../../utils/hardhat-fixture-deployer';
31-
import { hashDomain } from '../../utils/utils';
31+
import { hashDomain, randomAddress } from '../../utils/utils';
3232

3333
/**
3434
* Test state view functions.
@@ -104,7 +104,7 @@ describe('IexecAccessors', async () => {
104104

105105
it('allowance', async function () {
106106
const amount = 10n;
107-
const spender = ethers.Wallet.createRandom().address;
107+
const spender = randomAddress();
108108
await iexecWrapper.depositInIexecAccount(anyone, amount);
109109
await iexecPoco.connect(anyone).approve(spender, amount);
110110
expect(await iexecPoco.allowance(anyone.address, spender)).to.equal(amount);

test/byContract/IexecPocoBoost/IexecPocoBoost.test.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import {
5858
} from '../../../utils/poco-tools';
5959
import { IexecWrapper } from '../../utils/IexecWrapper';
6060
import { loadHardhatFixtureDeployment } from '../../utils/hardhat-fixture-deployer';
61+
import { randomAddress } from '../../utils/utils';
6162

6263
const teeDealTag = '0x0000000000000000000000000000000000000000000000000000000000000001';
6364
const taskIndex = 0n;
@@ -69,7 +70,7 @@ const appPrice = 1000n;
6970
const datasetPrice = 1_000_000n;
7071
const workerpoolPrice = 1_000_000_000n;
7172
const someSignature = '0xabcd'; // contract signatures could have arbitrary formats
72-
const randomEOAAddress = ethers.Wallet.createRandom().address;
73+
const randomEOAAddress = randomAddress();
7374

7475
let proxyAddress: string;
7576
let iexecPocoBoostInstance: IexecPocoBoostFacet;
@@ -173,7 +174,7 @@ describe('IexecPocoBoost', function () {
173174
beneficiary: beneficiary.address,
174175
tag: teeDealTag,
175176
prices: ordersPrices,
176-
callback: ethers.Wallet.createRandom().address,
177+
callback: randomAddress(),
177178
});
178179
const {
179180
appOrder,
@@ -304,7 +305,7 @@ describe('IexecPocoBoost', function () {
304305
beneficiary: beneficiary.address,
305306
tag: teeDealTag,
306307
prices: ordersPrices,
307-
callback: ethers.Wallet.createRandom().address,
308+
callback: randomAddress(),
308309
});
309310
const { appOrder, datasetOrder, workerpoolOrder, requestOrder } = orders.toObject();
310311
// Should match orders with low app order volume
@@ -1618,7 +1619,7 @@ describe('IexecPocoBoost', function () {
16181619
assets: ordersAssets,
16191620
requester: requester.address,
16201621
tag: teeDealTag,
1621-
callback: ethers.Wallet.createRandom().address,
1622+
callback: randomAddress(),
16221623
});
16231624
await signOrders(domain, orders, ordersActors);
16241625
const dealId = getDealId(domain, orders.requester, taskIndex);
@@ -1971,7 +1972,7 @@ describe('IexecPocoBoost', function () {
19711972
assets: ordersAssets,
19721973
requester: requester.address,
19731974
tag: teeDealTag,
1974-
callback: ethers.Wallet.createRandom().address,
1975+
callback: randomAddress(),
19751976
});
19761977
await signOrders(domain, orders, ordersActors);
19771978
const dealId = getDealId(domain, orders.requester, taskIndex);

test/byContract/IexecRelay/IexecRelay.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
} from '../../../typechain';
1212
import { getIexecAccounts } from '../../../utils/poco-tools';
1313
import { loadHardhatFixtureDeployment } from '../../utils/hardhat-fixture-deployer';
14+
import { randomAddress } from '../../utils/utils';
1415

1516
const appPrice = 1;
1617
const datasetPrice = 2;
@@ -35,9 +36,7 @@ describe('IexecRelay', async () => {
3536
async function initFixture() {
3637
const accounts = await getIexecAccounts();
3738
iexecPoco = IexecInterfaceNative__factory.connect(proxyAddress, accounts.anyone);
38-
[app, dataset, workerpool, requester, beneficiary] = Array(5).fill(
39-
ethers.Wallet.createRandom().address,
40-
);
39+
[app, dataset, workerpool, requester, beneficiary] = Array(5).fill(randomAddress());
4140
sign = await ethers.Wallet.createRandom().signMessage('sign');
4241
}
4342

@@ -108,7 +107,7 @@ describe('IexecRelay', async () => {
108107
category,
109108
trust,
110109
beneficiary,
111-
callback: ethers.Wallet.createRandom().address,
110+
callback: randomAddress(),
112111
params: 'params',
113112
salt,
114113
sign,

0 commit comments

Comments
 (0)