Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
9 changes: 9 additions & 0 deletions .changeset/blue-jeans-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@api3/airnode-validator": minor
"@api3/airnode-deployer": minor
"@api3/airnode-examples": minor
"@api3/airnode-adapter": minor
"@api3/airnode-node": minor
---

Bump zod to v4 and OIS to v3
2 changes: 1 addition & 1 deletion packages/airnode-adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"test:watch": "yarn test:ts --watch"
},
"dependencies": {
"@api3/ois": "2.3.2",
"@api3/ois": "3.0.0",
"@api3/promise-utils": "^0.4.0",
"axios": "^1.12.2",
"bignumber.js": "^9.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-adapter/test/fixtures/ois.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { OIS } from '@api3/ois';

export function buildOIS(overrides?: Partial<OIS>): OIS {
return {
oisFormat: '2.3.2',
oisFormat: '3.0.0',
version: '1.2.3',
title: 'Currency Converter API',
apiSpecifications: {
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"cli": "ts-node bin/admin.ts",
"compile": "tsc --build tsconfig.json",
"pack": "yarn pack",
"test:e2e": "jest --selectProjects e2e",
"test:e2e": "jest --selectProjects e2e --runInBand",
"test:e2e:update-snapshot": "yarn test:e2e --updateSnapshot",
"test:e2e:watch": "yarn test:e2e --watch",
"test": "SILENCE_LOGGER=true jest --selectProjects unit",
Expand Down
36 changes: 29 additions & 7 deletions packages/airnode-admin/test/e2e/cli.feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ it('has disabled DEBUG_COMMANDS flag', () => {
});

describe('CLI', () => {
jest.setTimeout(45_000);
jest.setTimeout(300_000);

let provider: ethers.providers.StaticJsonRpcProvider;
let deployer: ethers.providers.JsonRpcSigner;
Expand Down Expand Up @@ -333,7 +333,19 @@ Template data:
describe('withdrawal', () => {
let sponsor: ethers.Wallet;
let sponsorWallet: ethers.Wallet;
const sponsorBalance = () => sponsor.getBalance();

// Helper to retry async operations that may fail due to transient connection issues in CI
const withRetry = async <T>(fn: () => Promise<T>, maxRetries = 3, delayMs = 1000): Promise<T> => {
for (let attempt = 1; attempt <= maxRetries; attempt++) {
try {
return await fn();
} catch (error) {
if (attempt === maxRetries) throw error;
await new Promise((resolve) => setTimeout(resolve, delayMs * attempt));
}
}
throw new Error('Unreachable');
};

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

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

const balanceBefore = await sponsorBalance();
// Use retry for balance fetches to handle transient ECONNRESET errors in CI
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must have caused headaches :/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh definitely a massive headache, but I hope now the issue is behind us

const balanceBefore = await withRetry(() => sponsor.getBalance());
airnodeRrp = airnodeRrp.connect(sponsorWallet);
await admin.fulfillWithdrawal(airnodeRrp, withdrawalRequestId, airnodeWallet.address, sponsor.address, '0.8');
expect(checkWithdrawalStatus()).toBe('Withdrawn amount: 800000000000000000');
expect((await sponsorBalance()).toString()).toBe(
balanceBefore.add(ethers.BigNumber.from('800000000000000000')).toString()

const fulfillResult = await admin.fulfillWithdrawal(
airnodeRrp,
withdrawalRequestId,
airnodeWallet.address,
sponsor.address,
'0.8'
);
expect(fulfillResult).not.toBeNull();

expect(checkWithdrawalStatus()).toBe('Withdrawn amount: 800000000000000000');

const balanceAfter = await withRetry(() => sponsor.getBalance());
expect(balanceAfter.toString()).toBe(balanceBefore.add(ethers.BigNumber.from('800000000000000000')).toString());
});
});

Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-deployer/config/config.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"templates": [],
"ois": [
{
"oisFormat": "2.3.2",
"oisFormat": "3.0.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-deployer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"lodash": "^4.17.21",
"ora": "^5.4.1",
"yargs": "^17.7.2",
"zod": "^3.22.4"
"zod": "^4.2.1"
},
"devDependencies": {
"@aws-sdk/util-stream-node": "^3.374.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"templates": [],
"ois": [
{
"oisFormat": "2.3.2",
"oisFormat": "3.0.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"templates": [],
"ois": [
{
"oisFormat": "2.3.2",
"oisFormat": "3.0.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"templates": [],
"ois": [
{
"oisFormat": "2.3.2",
"oisFormat": "3.0.0",
"title": "CoinMarketCap Basic Authenticated Request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '2.3.2',
oisFormat: '3.0.0',
title: 'CoinMarketCap Basic Authenticated Request',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"templates": [],
"ois": [
{
"oisFormat": "2.3.2",
"oisFormat": "3.0.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '2.3.2',
oisFormat: '3.0.0',
title: 'CoinGecko basic request',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"templates": [],
"ois": [
{
"oisFormat": "2.3.2",
"oisFormat": "3.0.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '2.3.2',
oisFormat: '3.0.0',
title: 'CoinGecko basic request',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"templates": [],
"ois": [
{
"oisFormat": "2.3.2",
"oisFormat": "3.0.0",
"title": "CoinGecko coins markets request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '2.3.2',
oisFormat: '3.0.0',
title: 'CoinGecko coins markets request',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"templates": [],
"ois": [
{
"oisFormat": "2.3.2",
"oisFormat": "3.0.0",
"title": "CoinGecko history data request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '2.3.2',
oisFormat: '3.0.0',
title: 'CoinGecko history data request',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
],
"ois": [
{
"oisFormat": "2.3.2",
"oisFormat": "3.0.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
],
ois: [
{
oisFormat: '2.3.2',
oisFormat: '3.0.0',
title: 'CoinGecko basic request',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"templates": [],
"ois": [
{
"oisFormat": "2.3.2",
"oisFormat": "3.0.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '2.3.2',
oisFormat: '3.0.0',
title: 'CoinGecko basic request',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"templates": [],
"ois": [
{
"oisFormat": "2.3.2",
"oisFormat": "3.0.0",
"title": "Failure Example",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '2.3.2',
oisFormat: '3.0.0',
title: 'Failure Example',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"templates": [],
"ois": [
{
"oisFormat": "2.3.2",
"oisFormat": "3.0.0",
"title": "Relay Security Schemes via httpbin",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '2.3.2',
oisFormat: '3.0.0',
title: 'Relay Security Schemes via httpbin',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"templates": [],
"ois": [
{
"oisFormat": "2.3.2",
"oisFormat": "3.0.0",
"title": "OpenWeather Multiple Encoded Values",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '2.3.2',
oisFormat: '3.0.0',
title: 'OpenWeather Multiple Encoded Values',
version: '1.0.0',
apiSpecifications: {
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-node/config/config.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"templates": [],
"ois": [
{
"oisFormat": "2.3.2",
"oisFormat": "3.0.0",
"version": "1.2.3",
"title": "Currency Converter API",
"apiSpecifications": {
Expand Down
4 changes: 2 additions & 2 deletions packages/airnode-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@api3/airnode-validator": "^0.15.0",
"@api3/chains": "^8.1.1",
"@api3/commons": "^0.9.0",
"@api3/ois": "2.3.2",
"@api3/ois": "3.0.0",
"@api3/promise-utils": "^0.4.0",
"@aws-sdk/client-lambda": "^3.525.0",
"date-fns": "^3.6.0",
Expand All @@ -41,7 +41,7 @@
"google-auth-library": "^9.6.3",
"lodash": "^4.17.21",
"yargs": "^17.7.2",
"zod": "^3.22.4"
"zod": "^4.2.1"
},
"devDependencies": {
"@api3/airnode-operation": "^0.15.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-node/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const readConfig = (configPath: string): unknown => {
};

export function addDefaultContractAddresses(config: configTypes.Config): configTypes.Config {
const ctx = { addIssue: () => {}, path: [] }; // Unused, but required by validator functions
const ctx = { addIssue: () => {}, path: [], value: null, issues: [] }; // Unused, but required by validator functions
const chains = config.chains.map((chain) => {
const { contracts } = configTypes.ensureConfigValidAirnodeRrp(chain, ctx);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function verifyEndpointId(
config: Config,
endpointId: unknown,
gateway: 'http' | 'httpSignedData'
): VerificationResult<z.SafeParseSuccess<string>> {
): VerificationResult<z.ZodSafeParseSuccess<string>> {
const parsedEndpointId = endpointIdSchema.safeParse(endpointId);
if (!parsedEndpointId.success) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"templates": [],
"ois": [
{
"oisFormat": "2.3.2",
"oisFormat": "3.0.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-node/test/fixtures/config/ois.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { OIS } from '@api3/ois';

export function buildOIS(ois?: Partial<OIS>): OIS {
return {
oisFormat: '2.3.2',
oisFormat: '3.0.0',
version: '1.2.3',
title: 'Currency Converter API',
apiSpecifications: {
Expand Down
4 changes: 2 additions & 2 deletions packages/airnode-validator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
"dependencies": {
"@api3/airnode-protocol": "^0.15.0",
"@api3/commons": "^0.9.0",
"@api3/ois": "2.3.2",
"@api3/ois": "3.0.0",
"@api3/promise-utils": "^0.4.0",
"dotenv": "^16.4.7",
"ethers": "^5.7.2",
"lodash": "^4.17.21",
"ora": "^5.4.1",
"yargs": "^17.7.2",
"zod": "^3.22.4"
"zod": "^4.2.1"
},
"devDependencies": {
"@types/yargs": "^17.0.32",
Expand Down
Loading
Loading