Skip to content

Commit

Permalink
Update Airnode to use Node 18 (#1647)
Browse files Browse the repository at this point in the history
* Bump Node.js from 14 to 18

* Required hardhat bump from 2.9.9

* Reduce hardhat account count

* Fix noNetwork airnode-node test error

* Update terraform runtimes
  • Loading branch information
dcroote authored Feb 14, 2023
1 parent 5b2c060 commit a4929ee
Show file tree
Hide file tree
Showing 19 changed files with 100 additions and 94 deletions.
14 changes: 14 additions & 0 deletions .changeset/short-donuts-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
'@api3/airnode-adapter': minor
'@api3/airnode-admin': minor
'@api3/airnode-deployer': minor
'@api3/airnode-examples': minor
'@api3/airnode-node': minor
'@api3/airnode-operation': minor
'@api3/airnode-protocol': minor
'@api3/airnode-utilities': minor
'@api3/airnode-abi': minor
'@api3/airnode-validator': minor
---

Bump Node.js from 14 to 18
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

env:
DOCKER_BUILDKIT: 1
TARGET_NODE_VERSION: '14.19.3'
TARGET_NODE_VERSION: '18.14.0'

jobs:
documentation:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/protocol-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

env:
DOCKER_BUILDKIT: 1
TARGET_NODE_VERSION: '14.19.3'
TARGET_NODE_VERSION: '18.14.0'

jobs:
pre-build:
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14.19.3-alpine3.15 AS environment
FROM node:18.14.0-alpine3.17 AS environment

ENV appDir="/app" \
buildDir="/build" \
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.0",
"private": true,
"engines": {
"node": "^14.19.3"
"node": "^18.14.0"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@types/mocha": "^10.0.0",
"chai": "^4.3.6",
"ethereum-waffle": "^3.4.4",
"hardhat": "2.9.9",
"hardhat": "2.10.2",
"jest": "^29.2.2",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
Expand Down
8 changes: 4 additions & 4 deletions packages/airnode-admin/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14.19.3-alpine3.15
FROM node:18.14.0-alpine3.17

ARG npmRegistryUrl=https://registry.npmjs.org/
ARG npmTag=latest
Expand All @@ -8,9 +8,9 @@ ENV name="airnode-admin" \
ENV packageName="@api3/${name}"

LABEL application=${name} \
description="Airnode Admin CLI"
description="Airnode Admin CLI"

# Install airnode-admin
# Install airnode-admin
RUN npm set registry ${npmRegistryUrl} && \
yarn global add ${packageName}@${npmTag} && \
ln -s /usr/local/share/.config/yarn/global/node_modules/${packageName}/dist ${appDir} && \
Expand All @@ -21,4 +21,4 @@ WORKDIR ${appDir}

USER ${name}

ENTRYPOINT ["airnode-admin"]
ENTRYPOINT ["airnode-admin"]
6 changes: 3 additions & 3 deletions packages/airnode-deployer/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14.19.3-alpine3.15
FROM node:18.14.0-alpine3.17

ARG npmRegistryUrl=https://registry.npmjs.org/
ARG npmTag=latest
Expand All @@ -9,7 +9,7 @@ ENV name="airnode-deployer" \
ENV packageName="@api3/${name}"

LABEL application=${name} \
description="Airnode Deployer CLI"
description="Airnode Deployer CLI"

COPY ./entrypoint.sh /entrypoint.sh

Expand All @@ -34,4 +34,4 @@ WORKDIR ${appDir}

ENV GOOGLE_APPLICATION_CREDENTIALS=/app/config/gcp.json

ENTRYPOINT ["/entrypoint.sh"]
ENTRYPOINT ["/entrypoint.sh"]
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ resource "aws_lambda_function" "lambda" {
function_name = var.name
handler = var.handler
memory_size = var.memory_size
runtime = "nodejs14.x"
runtime = "nodejs18.x"
role = aws_iam_role.lambda_role.arn
timeout = var.timeout
reserved_concurrent_executions = var.reserved_concurrent_executions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ resource "google_storage_bucket_object" "function_zip" {

resource "google_cloudfunctions_function" "function" {
name = var.name
runtime = "nodejs14"
runtime = "nodejs18"

available_memory_mb = var.memory_size
source_archive_bucket = google_storage_bucket_object.function_zip.bucket
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"chalk": "^4.1.2",
"dotenv": "^16.0.3",
"ethereum-waffle": "^3.4.4",
"hardhat": "2.9.9",
"hardhat": "2.10.2",
"jest": "^29.2.2",
"prompts": "^2.4.2",
"ts-jest": "^29.0.3",
Expand Down
8 changes: 4 additions & 4 deletions packages/airnode-node/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14.19.3-alpine3.15
FROM node:18.14.0-alpine3.17

ARG npmRegistryUrl=https://registry.npmjs.org/
ARG npmTag=latest
Expand All @@ -9,12 +9,12 @@ ENV name="airnode-client" \
ENV cronjob="/etc/cron.d/${name}"

LABEL application=${name} \
description="Airnode Client"
description="Airnode Client"

COPY airnode-crontab ${cronjob}
COPY entrypoint.sh /entrypoint.sh

# Install Tini to correctly pass signals
# Install Tini to correctly pass signals
RUN apk add --update --no-cache tini dos2unix && \
# Install airnode-node
npm set registry ${npmRegistryUrl} && \
Expand All @@ -31,4 +31,4 @@ RUN apk add --update --no-cache tini dos2unix && \
WORKDIR ${appDir}

# We need to run the cron daemon as root but the Airnode itself is run under the airnode user
ENTRYPOINT ["tini", "--", "/entrypoint.sh"]
ENTRYPOINT ["tini", "--", "/entrypoint.sh"]
10 changes: 8 additions & 2 deletions packages/airnode-node/src/handlers/initialize-provider.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import { ethers } from 'ethers';
import { initializeProvider } from './initialize-provider';
import * as evmHandler from '../evm/handlers/initialize-provider';
import * as fixtures from '../../test/fixtures';

describe('initializeProvider', () => {
jest.setTimeout(30_000);
fixtures.setEnvVariables({ AIRNODE_WALLET_PRIVATE_KEY: fixtures.getAirnodeWalletPrivateKey() });

it('initializes EVM providers', () => {
it('initializes EVM providers', async () => {
const getBlockNumberSpy = jest.spyOn(ethers.providers.JsonRpcProvider.prototype, 'getBlockNumber');
const currentBlockNumber = 18;
getBlockNumberSpy.mockResolvedValueOnce(currentBlockNumber);

const initializeSpy = jest.spyOn(evmHandler, 'initializeProvider');
const state = fixtures.buildEVMProviderState();
initializeProvider(state);
await initializeProvider(state);
expect(initializeSpy).toHaveBeenCalledTimes(1);
expect(initializeSpy).toHaveBeenCalledWith(state);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function buildConfigWithEndpoint(endpoint?: Endpoint) {
}

describe('processHttpRequest', () => {
jest.setTimeout(10_000);
it('returns an error if endpoint testability is turned off', async () => {
const endpoint = fixtures.buildOIS().endpoints[0];
const config = buildConfigWithEndpoint(endpoint);
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-operation/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const config: HardhatUserConfig = {
// related accounts. Make sure they have more than enough ETH to
// do this (1m ETH each).
accountsBalance: '1000000000000000000000000',
count: 1000,
count: 100,
},
},
localhost: {
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-operation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@api3/airnode-utilities": "^0.10.0",
"ethers": "^5.7.2",
"express": "^4.18.2",
"hardhat": "2.9.9",
"hardhat": "2.10.2",
"morgan": "^1.10.0",
"pm2": "^5.2.2"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"chai": "^4.3.6",
"copyfiles": "^2.4.1",
"ethereum-waffle": "^3.4.4",
"hardhat": "2.9.9",
"hardhat": "2.10.2",
"hardhat-deploy": "^0.11.19",
"hardhat-gas-reporter": "^1.0.9",
"replace-in-file": "^6.3.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-utilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@nomiclabs/hardhat-ethers": "^2.2.1",
"@types/jest": "^29.2.0",
"@types/node": "^17.0.18",
"hardhat": "2.9.9",
"hardhat": "2.10.2",
"jest": "^29.2.2",
"rimraf": "^3.0.2",
"ts-node": "^10.9.1",
Expand Down
Loading

0 comments on commit a4929ee

Please sign in to comment.