Skip to content

Commit b082add

Browse files
merge: integrate latest changes from main branch
2 parents f043a9c + ec3728b commit b082add

File tree

6 files changed

+76
-16
lines changed

6 files changed

+76
-16
lines changed

src/lib/IExecConfig.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ export type * from '../common/types.js';
22
export type * from './IExecConfig.js';
33

44
import IExecContractsClient from '../common/utils/IExecContractsClient.js';
5-
import { EnhancedWallet } from '../common/utils/signers.js';
65
import { AnyRecord, ProviderOptions, TeeFramework } from '../common/types.js';
76
import { AbstractProvider, AbstractSigner, BrowserProvider } from 'ethers';
87

test/docker-compose.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ services:
108108
service-internal-error:
109109
image: nginx:alpine
110110
volumes:
111-
- $PWD/mock/server/http500.nginx.conf:/etc/nginx/conf.d/default.conf
111+
- $PWD/mock/server/http500.nginx.conf:/etc/nginx/conf.d/default.conf:ro
112112
expose:
113113
- 80
114114
ports:
@@ -269,6 +269,18 @@ services:
269269
market-mongo:
270270
condition: service_started
271271

272+
custom-token-chain-compass:
273+
image: iexechub/compass:v0.1.1
274+
restart: unless-stopped
275+
environment:
276+
DATA_FILE_PATH: /app/data.json
277+
volumes:
278+
- $PWD/mock/compass/data.json:/app/data.json:ro
279+
ports:
280+
- 8069:3000
281+
healthcheck:
282+
test: nc -w 1 0.0.0.0 3000
283+
272284
stack-ready:
273285
image: bash
274286
command:
@@ -290,5 +302,7 @@ services:
290302
condition: service_started
291303
result-proxy:
292304
condition: service_started
305+
custom-token-chain-compass:
306+
condition: service_healthy
293307
voucher-subgraph-deployer:
294308
condition: service_completed_successfully

test/lib/e2e/IExecWorkerpoolModule.test.js

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -263,27 +263,35 @@ describe('workerpool', () => {
263263
});
264264

265265
describe('on networks relying on compass', () => {
266-
// TODO include compass in stack instead of using arbitrum-sepolia-testnet
266+
const noEnsTestChain = TEST_CHAINS['custom-token-chain-no-ens'];
267+
267268
test('resolves the url against Compass', async () => {
268-
const readOnlyIExec = new IExec(
269-
{ ethProvider: 'arbitrum-sepolia-testnet' },
270-
{ allowExperimentalNetworks: true },
271-
);
269+
const { iexec: readOnlyIExec } = getTestConfig(noEnsTestChain)();
272270
const apiUrl = await readOnlyIExec.workerpool.getWorkerpoolApiUrl(
273271
'0xB967057a21dc6A66A29721d96b8Aa7454B7c383F',
274272
);
275273
expect(typeof apiUrl).toBe('string');
276274
expect(apiUrl.startsWith('https://')).toBe(true);
277275
});
278276

277+
test('throw if the workerpool does not exist in Compass', async () => {
278+
const { iexec: readOnlyIExec } = getTestConfig(noEnsTestChain)();
279+
const address = getRandomAddress();
280+
await expect(
281+
readOnlyIExec.workerpool.getWorkerpoolApiUrl(address),
282+
).rejects.toThrow(
283+
Error(
284+
`API error: Workerpool with address '${address}' not found in chain '${noEnsTestChain.chainId}'`,
285+
),
286+
);
287+
});
288+
279289
test('fails with CompassCallError if Compass is not available', async () => {
280-
const iexecCompassNotFound = new IExec(
281-
{ ethProvider: 'arbitrum-sepolia-testnet' },
282-
{
283-
allowExperimentalNetworks: true,
290+
const { iexec: iexecCompassNotFound } = getTestConfig(noEnsTestChain)({
291+
options: {
284292
compassURL: SERVICE_UNREACHABLE_URL,
285293
},
286-
);
294+
});
287295
await expect(
288296
iexecCompassNotFound.workerpool.getWorkerpoolApiUrl(
289297
getRandomAddress(),
@@ -294,10 +302,13 @@ describe('workerpool', () => {
294302
),
295303
);
296304

297-
const iexecCompassInternalError = new IExec(
298-
{ ethProvider: 'arbitrum-sepolia-testnet' },
299-
{ allowExperimentalNetworks: true, compassURL: SERVICE_HTTP_500_URL },
300-
);
305+
const { iexec: iexecCompassInternalError } = getTestConfig(
306+
noEnsTestChain,
307+
)({
308+
options: {
309+
compassURL: SERVICE_HTTP_500_URL,
310+
},
311+
});
301312
await expect(
302313
iexecCompassInternalError.workerpool.getWorkerpoolApiUrl(
303314
getRandomAddress(),

test/mock/compass/data.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[
2+
{
3+
"chainId": "65535",
4+
"description": "custom-token-chain-no-ens",
5+
"iapps": [],
6+
"workerpools": [
7+
{
8+
"name": "custom-token-chain-no-ens-workerpool",
9+
"apiUrl": "https://core.custom-token-chain-no-ens.iex.ec",
10+
"address": "0xB967057a21dc6A66A29721d96b8Aa7454B7c383F"
11+
}
12+
]
13+
}
14+
]

test/test-config-utils.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export const getTestConfigOptions =
2121
isNative: options.isNative ?? chain.isNative,
2222
providerOptions: options.providerOptions ?? chain.providerOptions,
2323
resultProxyURL: options.resultProxyURL ?? chain.resultProxyURL,
24+
compassURL: options.compassURL ?? chain.compassURL,
2425
smsURL: options.smsURL ?? chain.smsMap,
2526
useGas: options.useGas ?? chain.useGas,
2627
});

test/test-utils.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,27 @@ export const TEST_CHAINS = {
8181
},
8282
isAnvil: false,
8383
},
84+
'custom-token-chain-no-ens': {
85+
rpcURL: 'http://localhost:18545',
86+
chainId: '65535',
87+
hubAddress: '0xC129e7917b7c7DeDfAa5Fff1FB18d5D7050fE8ca',
88+
pocoAdminWallet: new Wallet(
89+
'0x564a9db84969c8159f7aa3d5393c5ecd014fce6a375842a45b12af6677b12407',
90+
),
91+
compassURL: 'http://localhost:8069',
92+
// TODO use another wallet
93+
faucetWallet: new Wallet(
94+
'0x564a9db84969c8159f7aa3d5393c5ecd014fce6a375842a45b12af6677b12407',
95+
),
96+
provider: new JsonRpcProvider('http://localhost:18545', undefined, {
97+
pollingInterval: 100,
98+
}),
99+
defaults: {
100+
isNative: false,
101+
useGas: true,
102+
},
103+
isAnvil: false,
104+
},
84105
'bellecour-fork': {
85106
rpcURL: 'http://localhost:8545',
86107
chainId: '134',

0 commit comments

Comments
 (0)