From 46ecf80cff18680a9afc028961f751ecee3712f4 Mon Sep 17 00:00:00 2001 From: Julien Date: Thu, 4 Apr 2024 09:27:25 -0700 Subject: [PATCH] chore: support node 18 and 20 (#164) * chore: support node 18 and 20 * chore: workaround github * chore: remove node 14 --- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 2 +- benchmark/package.json | 4 ++-- package.json | 6 +++--- test/switch.ts | 21 ++++----------------- 5 files changed, 11 insertions(+), 24 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f5425d0..a952225 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,7 +35,7 @@ jobs: - name: Setup Nodejs uses: actions/setup-node@v1 with: - node-version: "14.x" + node-version: "20.x" registry-url: "https://registry.npmjs.org" - name: Install dependencies run: yarn install --non-interactive --frozen-lockfile diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9bd068f..e8b780b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - node: [14, 16] + node: [18, 20] steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 diff --git a/benchmark/package.json b/benchmark/package.json index 7649593..181377a 100644 --- a/benchmark/package.json +++ b/benchmark/package.json @@ -5,8 +5,8 @@ "exports": "./index.js", "license": "MIT", "scripts": { - "benchmark": "ts-node-esm index", - "benchmark:all": "ts-node-esm index && ts-node-esm noble && ts-node-esm verifyMultipleSignaturesSavings" + "benchmark": "node --loader ts-node/esm index", + "benchmark:all": "node --loader ts-node/esm index.ts && node --loader ts-node/esm noble.ts && node --loader ts-node/esm verifyMultipleSignaturesSavings.ts" }, "dependencies": { "noble-bls12-381": "^0.7.2" diff --git a/package.json b/package.json index f03146d..336d5c8 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "7.1.3", "description": "Implementation of bls signature verification for ethereum 2.0", "engines": { - "node": ">=14.8.0" + "node": ">=18" }, "type": "module", "exports": { @@ -73,9 +73,9 @@ "test:coverage": "nyc --cache-dir .nyc_output/.cache -r lcov -e .ts mocha 'test/unit/**/*.test.ts' && nyc report", "test:spec": "mocha 'test/spec/**/*.test.ts'", "test": "yarn run test:unit && yarn run test:spec", - "download-test-cases": "ts-node-esm test/downloadSpecTests.ts", + "download-test-cases": "node --loader ts-node/esm test/downloadSpecTests.ts", "coverage": "codecov -F bls", - "benchmark": "ts-node-esm benchmark", + "benchmark": "node --loader ts-node/esm benchmark/index.ts", "benchmark:all": "cd benchmark && yarn install && yarn benchmark:all" }, "dependencies": { diff --git a/test/switch.ts b/test/switch.ts index 7cad321..1db4c24 100644 --- a/test/switch.ts +++ b/test/switch.ts @@ -1,24 +1,11 @@ -import blst from "../src/blst-native/index.js"; -import herumi from "../src/herumi/index.js"; -import {IBls} from "../src/types.js"; - -export type Implementation = "blst" | "herumi"; - -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -export function getBls(implementation: Implementation): IBls { - switch (implementation) { - case "blst": - return blst; - case "herumi": - return herumi; - } -} +import {getImplementation} from "../src/getImplementation.js"; +import {IBls, Implementation} from "../src/types.js"; export async function runForAllImplementations( callback: (bls: IBls, implementation: Implementation) => void ): Promise { - for (const implementation of ["blst", "herumi"] as Implementation[]) { - const bls = getBls(implementation); + for (const implementation of ["blst-native", "herumi"] as Implementation[]) { + const bls = await getImplementation(implementation); callback(bls, implementation); } }