Skip to content
Draft
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
"build:doc": "npm run build:doc:lib && npm run build:doc:cli",
"build:doc:lib": "./node_modules/typedoc/bin/typedoc --tsconfig tsconfig.doc.json --disableSources",
"build:doc:cli": "node generateCliDoc.cjs",
"test:prepare": "node test/scripts/prepare-bellecour-fork-for-tests.js"
"test:prepare": "node test/scripts/prepare-forks-for-tests.js"
},
"files": [
"src/",
Expand Down
1 change: 1 addition & 0 deletions src/cli/utils/cli-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@
'specify the original dataset directory',
],
txGasPrice: () => [
// TODO remove this option (not applicable on supported chains)

Check warning on line 361 in src/cli/utils/cli-helper.js

View workflow job for this annotation

GitHub Actions / check-code

Complete the task associated to this "TODO" comment

Check warning on line 361 in src/cli/utils/cli-helper.js

View workflow job for this annotation

GitHub Actions / npm-dry-run / npm-publish / build

Complete the task associated to this "TODO" comment
'--gas-price <amount unit...>',
'set custom gas price for transactions (default unit wei)',
],
Expand Down
2 changes: 1 addition & 1 deletion src/common/utils/signers.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const getSignerFromPrivateKey = (
host,
privateKey,
{
gasPrice,
gasPrice, // TODO remove this option (not applicable on supported chains)
getTransactionCount,
providers,
allowExperimentalNetworks = false,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const getSignerFromPrivateKey: (
/**
* gas price override
*/
gasPrice?: bigint | number | string;
gasPrice?: bigint | number | string; // TODO remove this option (not applicable on supported chains)
/**
* nonce override
*/
Expand Down
23 changes: 6 additions & 17 deletions test/cli/cli-iexec-account.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
execAsync,
getRandomAddress,
getRandomWallet,
setBalance,
setNRlcBalance,
} from '../test-utils.js';
import {
globalSetup,
Expand All @@ -18,7 +18,7 @@ import {
} from './cli-test-utils.js';
import '../jest-setup.js';

const testChain = TEST_CHAINS['bellecour-fork'];
const testChain = TEST_CHAINS['arbitrum-sepolia-fork'];

describe('iexec account', () => {
let userWallet;
Expand All @@ -28,8 +28,8 @@ describe('iexec account', () => {
// init the project
await execAsync(`${iexecPath} init --skip-wallet --force`);
await setChain(testChain)();
userWallet = await setRandomWallet();
await setBalance(testChain)(userWallet.address, 50n * 10n ** 18n);
userWallet = await setRandomWallet(testChain)();
await setNRlcBalance(testChain)(userWallet.address, 50n * 10n ** 9n);
});

afterAll(async () => {
Expand All @@ -54,9 +54,6 @@ describe('iexec account', () => {
expect(res.ok).toBe(true);
expect(res.amount).toBe(amount);
expect(res.txHash).toBeDefined();
const tx = await testChain.provider.getTransaction(res.txHash);
expect(tx).toBeDefined();
expect(tx.gasPrice.toString()).toBe('0');

const bnAmount = new BN(amount);
const finalWalletBalance = new BN(
Expand Down Expand Up @@ -171,9 +168,7 @@ describe('iexec account', () => {
expect(res.ok).toBe(true);
expect(res.amount).toBe(amount);
expect(res.txHash).toBeDefined();
const tx = await testChain.provider.getTransaction(res.txHash);
expect(tx).toBeDefined();
expect(tx.gasPrice.toString()).toBe('0');

const bnAmount = new BN(amount);
const finalWalletBalance = new BN(
JSON.parse(await execAsync(`${iexecPath} wallet show --raw`)).balance
Expand Down Expand Up @@ -240,9 +235,6 @@ describe('iexec account', () => {
const res = JSON.parse(raw);
expect(res.ok).toBe(true);
expect(res.txHash).toBeDefined();
const tx = await testChain.provider.getTransaction(res.txHash);
expect(tx).toBeDefined();
expect(tx.gasPrice.toString()).toBe('0');

const raw1 = await execAsync(
`${iexecPath} account allowance ${spender} --raw`,
Expand All @@ -262,9 +254,6 @@ describe('iexec account', () => {
const res = JSON.parse(raw);
expect(res.ok).toBe(true);
expect(res.txHash).toBeDefined();
const tx = await testChain.provider.getTransaction(res.txHash);
expect(tx).toBeDefined();
expect(tx.gasPrice.toString()).toBe('0');

const raw1 = await execAsync(
`${iexecPath} account allowance ${spender} --raw`,
Expand Down Expand Up @@ -312,7 +301,7 @@ describe('iexec account', () => {
const amount = '500';
const spender = getRandomAddress();
const { privateKey, address: owner } = getRandomWallet();
await setWallet(privateKey);
await setWallet(testChain)(privateKey);
await execAsync(
`${iexecPath} account approve ${amount} ${spender} --raw`,
);
Expand Down
12 changes: 3 additions & 9 deletions test/cli/cli-iexec-app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from './cli-test-utils.js';
import '../jest-setup.js';

const testChain = TEST_CHAINS['bellecour-fork'];
const testChain = TEST_CHAINS['arbitrum-sepolia-fork'];

describe('iexec app', () => {
let userWallet;
Expand All @@ -32,7 +32,7 @@ describe('iexec app', () => {
await execAsync(`${iexecPath} init --skip-wallet --force`);
await setChain(testChain)();

userWallet = await setRandomWallet();
userWallet = await setRandomWallet(testChain)();
await execAsync(`${iexecPath} app init`);
await setAppUniqueName();
const deployed = await runIExecCliRaw(`${iexecPath} app deploy`);
Expand Down Expand Up @@ -84,9 +84,6 @@ describe('iexec app', () => {
expect(res.ok).toBe(true);
expect(res.address).toBeDefined();
expect(res.txHash).toBeDefined();
const tx = await testChain.provider.getTransaction(res.txHash);
expect(tx).toBeDefined();
expect(tx.gasPrice.toString()).toBe('0');
});
});

Expand Down Expand Up @@ -161,9 +158,6 @@ describe('iexec app', () => {
expect(res.address).toBe(address);
expect(res.to).toBe(receiverAddress);
expect(res.txHash).toBeDefined();
const tx = await testChain.provider.getTransaction(res.txHash);
expect(tx).toBeDefined();
expect(tx.gasPrice.toString()).toBe('0');
});
});

Expand All @@ -179,7 +173,7 @@ describe('iexec app', () => {
workClockTimeRef: '0',
}).then(({ catid }) => catid.toString());
// restore user wallet
await setWallet(userWallet.privateKey);
await setWallet(testChain)(userWallet.privateKey);
await execAsync(`${iexecPath} app init`);
await setAppUniqueName();
await execAsync(`${iexecPath} dataset init`);
Expand Down
7 changes: 2 additions & 5 deletions test/cli/cli-iexec-category.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from './cli-test-utils.js';
import '../jest-setup.js';

const testChain = TEST_CHAINS['bellecour-fork'];
const testChain = TEST_CHAINS['arbitrum-sepolia-fork'];

describe('iexec category', () => {
beforeAll(async () => {
Expand All @@ -25,7 +25,7 @@ describe('iexec category', () => {
});
describe('as user', () => {
beforeAll(async () => {
await setRandomWallet();
await setRandomWallet(testChain)();
});

test('iexec category init', async () => {
Expand Down Expand Up @@ -77,9 +77,6 @@ describe('iexec category', () => {
expect(res.ok).toBe(true);
expect(res.catid).toBeDefined();
expect(res.txHash).toBeDefined();
const tx = await testChain.provider.getTransaction(res.txHash);
expect(tx).toBeDefined();
expect(tx.gasPrice.toString()).toBe('0');
});
});
});
7 changes: 2 additions & 5 deletions test/cli/cli-iexec-dataset.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from './cli-test-utils.js';
import '../jest-setup.js';

const testChain = TEST_CHAINS['bellecour-fork'];
const testChain = TEST_CHAINS['arbitrum-sepolia-fork'];

describe('iexec dataset', () => {
let userWallet;
Expand All @@ -29,7 +29,7 @@ describe('iexec dataset', () => {
// init the project
await execAsync(`${iexecPath} init --skip-wallet --force`);
await setChain(testChain)();
userWallet = await setRandomWallet();
userWallet = await setRandomWallet(testChain)();
await execAsync(`${iexecPath} dataset init`);
await setDatasetUniqueName();
const deployed = await runIExecCliRaw(`${iexecPath} dataset deploy`);
Expand Down Expand Up @@ -79,9 +79,6 @@ describe('iexec dataset', () => {
expect(res.ok).toBe(true);
expect(res.address).toBeDefined();
expect(res.txHash).toBeDefined();
const tx = await testChain.provider.getTransaction(res.txHash);
expect(tx).toBeDefined();
expect(tx.gasPrice.toString()).toBe('0');
});
});

Expand Down
4 changes: 2 additions & 2 deletions test/cli/cli-iexec-deal.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from './cli-test-utils.js';
import '../jest-setup.js';

const testChain = TEST_CHAINS['bellecour-fork'];
const testChain = TEST_CHAINS['arbitrum-sepolia-fork'];

describe('iexec deal', () => {
let userWallet;
Expand All @@ -37,7 +37,7 @@ describe('iexec deal', () => {
workClockTimeRef: '0',
}).then(({ catid }) => catid.toString());
// restore user wallet
userWallet = await setRandomWallet();
userWallet = await setRandomWallet(testChain)();
await execAsync(`${iexecPath} app init`);
await execAsync(`${iexecPath} dataset init`);
await execAsync(`${iexecPath} workerpool init`);
Expand Down
20 changes: 3 additions & 17 deletions test/cli/cli-iexec-ens.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from './cli-test-utils.js';
import '../jest-setup.js';

const testChain = TEST_CHAINS['bellecour-fork'];
const ensFeaturedChain = TEST_CHAINS['bellecour-fork'];

describe('iexec ens', () => {
let userWallet;
Expand All @@ -21,8 +21,8 @@ describe('iexec ens', () => {
beforeAll(async () => {
await globalSetup('cli-iexec-ens');
await execAsync(`${iexecPath} init --skip-wallet --force`);
await setChain(testChain)();
userWallet = await setRandomWallet();
await setChain(ensFeaturedChain)();
userWallet = await setRandomWallet(ensFeaturedChain)();
await execAsync(`${iexecPath} app init`);
await execAsync(`${iexecPath} dataset init`);
await execAsync(`${iexecPath} workerpool init`);
Expand Down Expand Up @@ -54,20 +54,6 @@ describe('iexec ens', () => {
expect(res.setResolverTxHash).toBeTxHash();
expect(res.setAddrTxHash).toBeTxHash();
expect(res.setNameTxHash).toBeTxHash();
await testChain.provider.getTransaction(res.registerTxHash).then((tx) => {
expect(tx.gasPrice.toString()).toBe('0');
});
await testChain.provider
.getTransaction(res.setResolverTxHash)
.then((tx) => {
expect(tx.gasPrice.toString()).toBe('0');
});
await testChain.provider.getTransaction(res.setAddrTxHash).then((tx) => {
expect(tx.gasPrice.toString()).toBe('0');
});
await testChain.provider.getTransaction(res.setNameTxHash).then((tx) => {
expect(tx.gasPrice.toString()).toBe('0');
});

const showAddressRes = await runIExecCliRaw(`${iexecPath} wallet show`);
expect(showAddressRes.ens).toBe(expectedEns);
Expand Down
26 changes: 22 additions & 4 deletions test/cli/cli-iexec-info.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ import {
} from './cli-test-utils.js';
import '../jest-setup.js';

const testChain = TEST_CHAINS['bellecour-fork'];

describe('iexec info', () => {
beforeAll(async () => {
await globalSetup('cli-iexec-info');
await setChain(testChain)();
});
afterAll(async () => {
await globalTeardown();
});
test('iexec info', async () => {

test('iexec info (bellecour)', async () => {
const testChain = TEST_CHAINS['bellecour-fork'];
await setChain(testChain)();
const raw = await execAsync(`${iexecPath} info --raw`);
const res = JSON.parse(raw);
expect(res.ok).toBe(true);
Expand All @@ -34,6 +34,24 @@ describe('iexec info', () => {
expect(res.useNative).toBe(true);
});

test('iexec info (arbitrum-sepolia)', async () => {
const testChain = TEST_CHAINS['arbitrum-sepolia-fork'];
await setChain(testChain)();
const raw = await execAsync(`${iexecPath} info --raw`);
const res = JSON.parse(raw);
expect(res.ok).toBe(true);
expect(res.pocoVersion).toBeDefined();
expect(res.host).toBe(testChain.rpcURL);
expect(res.hubAddress).toBe(
testChain.hubAddress || testChain.defaults.hubAddress,
);
expect(res.appRegistryAddress).toBeDefined();
expect(res.datasetRegistryAddress).toBeDefined();
expect(res.workerpoolRegistryAddress).toBeDefined();
expect(res.rlcAddress).toBeDefined();
expect(res.useNative).toBe(false);
});

test('iexec info --chain mainnet', async () => {
const raw = await execAsync(`${iexecPath} info --raw --chain mainnet`);
const res = JSON.parse(raw);
Expand Down
2 changes: 1 addition & 1 deletion test/cli/cli-iexec-init.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from './cli-test-utils.js';
import '../jest-setup.js';

const testChain = TEST_CHAINS['bellecour-fork'];
const testChain = TEST_CHAINS['arbitrum-sepolia-fork'];

describe('iexec init', () => {
beforeAll(async () => {
Expand Down
Loading
Loading