Skip to content

Commit 3aa2eb4

Browse files
authored
Upgrade zod to v4 and OIS to v3 (#2042)
* Bump zod to v4 and OIS to v3 * Fix airnode-validator tests * Replace hardcoded cloud providers with option map * Add retry to getBalance calls to fix problematic airnode-admin e2e test * Add custom error message for messy timestamp zod regex
1 parent d74857c commit 3aa2eb4

47 files changed

Lines changed: 245 additions & 148 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/blue-jeans-switch.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@api3/airnode-validator": minor
3+
"@api3/airnode-deployer": minor
4+
"@api3/airnode-examples": minor
5+
"@api3/airnode-adapter": minor
6+
"@api3/airnode-node": minor
7+
---
8+
9+
Bump zod to v4 and OIS to v3

packages/airnode-adapter/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"test:watch": "yarn test:ts --watch"
2020
},
2121
"dependencies": {
22-
"@api3/ois": "2.3.2",
22+
"@api3/ois": "3.0.0",
2323
"@api3/promise-utils": "^0.4.0",
2424
"axios": "^1.12.2",
2525
"bignumber.js": "^9.1.2",

packages/airnode-adapter/test/fixtures/ois.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { OIS } from '@api3/ois';
22

33
export function buildOIS(overrides?: Partial<OIS>): OIS {
44
return {
5-
oisFormat: '2.3.2',
5+
oisFormat: '3.0.0',
66
version: '1.2.3',
77
title: 'Currency Converter API',
88
apiSpecifications: {

packages/airnode-admin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"cli": "ts-node bin/admin.ts",
1717
"compile": "tsc --build tsconfig.json",
1818
"pack": "yarn pack",
19-
"test:e2e": "jest --selectProjects e2e",
19+
"test:e2e": "jest --selectProjects e2e --runInBand",
2020
"test:e2e:update-snapshot": "yarn test:e2e --updateSnapshot",
2121
"test:e2e:watch": "yarn test:e2e --watch",
2222
"test": "SILENCE_LOGGER=true jest --selectProjects unit",

packages/airnode-admin/test/e2e/cli.feature.ts

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ it('has disabled DEBUG_COMMANDS flag', () => {
2525
});
2626

2727
describe('CLI', () => {
28-
jest.setTimeout(45_000);
28+
jest.setTimeout(300_000);
2929

3030
let provider: ethers.providers.StaticJsonRpcProvider;
3131
let deployer: ethers.providers.JsonRpcSigner;
@@ -333,7 +333,19 @@ Template data:
333333
describe('withdrawal', () => {
334334
let sponsor: ethers.Wallet;
335335
let sponsorWallet: ethers.Wallet;
336-
const sponsorBalance = () => sponsor.getBalance();
336+
337+
// Helper to retry async operations that may fail due to transient connection issues in CI
338+
const withRetry = async <T>(fn: () => Promise<T>, maxRetries = 3, delayMs = 1000): Promise<T> => {
339+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
340+
try {
341+
return await fn();
342+
} catch (error) {
343+
if (attempt === maxRetries) throw error;
344+
await new Promise((resolve) => setTimeout(resolve, delayMs * attempt));
345+
}
346+
}
347+
throw new Error('Unreachable');
348+
};
337349

338350
beforeEach(async () => {
339351
// Prepare for derivation of designated wallet - see test for designated wallet derivation for details
@@ -371,13 +383,23 @@ Template data:
371383

372384
expect(checkWithdrawalStatus()).toBe('Withdrawal request is not fulfilled yet');
373385

374-
const balanceBefore = await sponsorBalance();
386+
// Use retry for balance fetches to handle transient ECONNRESET errors in CI
387+
const balanceBefore = await withRetry(() => sponsor.getBalance());
375388
airnodeRrp = airnodeRrp.connect(sponsorWallet);
376-
await admin.fulfillWithdrawal(airnodeRrp, withdrawalRequestId, airnodeWallet.address, sponsor.address, '0.8');
377-
expect(checkWithdrawalStatus()).toBe('Withdrawn amount: 800000000000000000');
378-
expect((await sponsorBalance()).toString()).toBe(
379-
balanceBefore.add(ethers.BigNumber.from('800000000000000000')).toString()
389+
390+
const fulfillResult = await admin.fulfillWithdrawal(
391+
airnodeRrp,
392+
withdrawalRequestId,
393+
airnodeWallet.address,
394+
sponsor.address,
395+
'0.8'
380396
);
397+
expect(fulfillResult).not.toBeNull();
398+
399+
expect(checkWithdrawalStatus()).toBe('Withdrawn amount: 800000000000000000');
400+
401+
const balanceAfter = await withRetry(() => sponsor.getBalance());
402+
expect(balanceAfter.toString()).toBe(balanceBefore.add(ethers.BigNumber.from('800000000000000000')).toString());
381403
});
382404
});
383405

packages/airnode-deployer/config/config.example.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"templates": [],
9595
"ois": [
9696
{
97-
"oisFormat": "2.3.2",
97+
"oisFormat": "3.0.0",
9898
"title": "CoinGecko basic request",
9999
"version": "1.0.0",
100100
"apiSpecifications": {

packages/airnode-deployer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"lodash": "^4.17.21",
4444
"ora": "^5.4.1",
4545
"yargs": "^17.7.2",
46-
"zod": "^3.22.4"
46+
"zod": "^4.2.1"
4747
},
4848
"devDependencies": {
4949
"@aws-sdk/util-stream-node": "^3.374.0",

packages/airnode-deployer/test/fixtures/config.aws.valid.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"templates": [],
9595
"ois": [
9696
{
97-
"oisFormat": "2.3.2",
97+
"oisFormat": "3.0.0",
9898
"title": "CoinGecko basic request",
9999
"version": "1.0.0",
100100
"apiSpecifications": {

packages/airnode-deployer/test/fixtures/config.gcp.valid.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
"templates": [],
9696
"ois": [
9797
{
98-
"oisFormat": "2.3.2",
98+
"oisFormat": "3.0.0",
9999
"title": "CoinGecko basic request",
100100
"version": "1.0.0",
101101
"apiSpecifications": {

packages/airnode-examples/integrations/authenticated-coinmarketcap/config.example.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"templates": [],
8484
"ois": [
8585
{
86-
"oisFormat": "2.3.2",
86+
"oisFormat": "3.0.0",
8787
"title": "CoinMarketCap Basic Authenticated Request",
8888
"version": "1.0.0",
8989
"apiSpecifications": {

0 commit comments

Comments
 (0)