Merge pull request #373 from privacy-ethereum/staging

Migrate to Node v20
This commit is contained in:
Nico Serrano
2026-03-29 01:27:48 -05:00
committed by GitHub
28 changed files with 5623 additions and 5209 deletions

View File

@@ -27,10 +27,10 @@ jobs:
with:
ref: ${{ inputs.branch }}
- name: Use Node.js 16
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
registry-url: "https://registry.npmjs.org"
- name: Update package.json dependencies and names
@@ -68,7 +68,7 @@ jobs:
- name: Deploy to Firebase
uses: docker://w9jds/firebase-action:master
with:
args: deploy --only functions --project ${{ inputs.firebase_project }}
args: deploy --only functions --project ${{ inputs.firebase_project }} --force
env:
GCP_SA_KEY: ${{ secrets.SERVICE_ACCOUNT_KEY }}
PROJECT_PATH: ./packages/backend

View File

@@ -27,10 +27,10 @@ jobs:
with:
ref: ${{ inputs.branch }}
- name: Use Node.js 16
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
registry-url: "https://registry.npmjs.org"
- name: Install npm packages and write env
@@ -52,7 +52,7 @@ jobs:
- name: Deploy to Firebase
uses: docker://w9jds/firebase-action:master
with:
args: deploy --only functions --project ${{ inputs.firebase_project }}
args: deploy --only functions --project ${{ inputs.firebase_project }} --force
env:
GCP_SA_KEY: ${{ secrets.SERVICE_ACCOUNT_KEY }}
PROJECT_PATH: ./packages/backend

View File

@@ -27,10 +27,10 @@ jobs:
with:
ref: ${{ inputs.branch }}
- name: Use Node.js 16
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
registry-url: "https://registry.npmjs.org"
- name: Update package.json dependencies and names
@@ -65,7 +65,7 @@ jobs:
- name: Deploy to Firebase
uses: docker://w9jds/firebase-action:master
with:
args: deploy --only functions --project ${{ inputs.firebase_project }}
args: deploy --only functions --project ${{ inputs.firebase_project }} --force
env:
GCP_SA_KEY: ${{ secrets.SERVICE_ACCOUNT_KEY }}
PROJECT_PATH: ./packages/backend

View File

@@ -13,10 +13,10 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
registry-url: "https://registry.npmjs.org"
cache: yarn

View File

@@ -11,10 +11,10 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
registry-url: "https://registry.npmjs.org"
cache: yarn

View File

@@ -13,10 +13,10 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
registry-url: "https://registry.npmjs.org"
cache: yarn

View File

@@ -13,10 +13,10 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
registry-url: "https://registry.npmjs.org"
cache: yarn

View File

@@ -46,7 +46,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
# Needed to run Firebase Emulator
- uses: actions/setup-java@v3

View File

@@ -36,7 +36,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
cache: yarn
- name: install dependencies

View File

@@ -69,7 +69,7 @@ yarn add @p0tion/actions
**Prerequisites**
- Node.js version 16.0 or higher.
- Node.js version 20.0 or higher.
- Yarn version 3.5.0 or higher.
Copy the `.env.default` file as `.env`:

View File

@@ -1,10 +1,12 @@
{
"extends": "../../tsconfig.json",
"extends": "./tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"declarationDir": "dist/types",
"moduleResolution": "Node16"
"moduleResolution": "nodenext",
"module": "ESNext",
"outDir": "dist"
},
"include": ["src"],
"files": ["./hardhat.config.ts"]

View File

@@ -14,7 +14,7 @@
"main": "dist/index.node.js",
"types": "dist/types/src/index.d.ts",
"engines": {
"node": ">=16.14.0"
"node": ">=20.0.0"
},
"files": [
"dist/",
@@ -31,8 +31,8 @@
"circom"
],
"scripts": {
"build": "rimraf dist && rollup -c rollup.config.ts --configPlugin typescript",
"build:watch": "rollup -c rollup.config.ts -w --configPlugin typescript",
"build": "rimraf dist && rollup -c rollup.config.ts --configPlugin typescript --bundleConfigAsCjs",
"build:watch": "rollup -c rollup.config.ts -w --configPlugin typescript --bundleConfigAsCjs",
"pre:publish": "yarn build",
"compile:contracts": "hardhat compile",
"test:contracts": "GOOGLE_APPLICATION_CREDENTIALS=\"../backend/serviceAccountKey.json\" && NODE_ENV=prod && TS_NODE_FILES=true hardhat test test/unit/contract.test.ts",
@@ -63,6 +63,7 @@
"@ethersproject/providers": "^5.7.2",
"@nomicfoundation/hardhat-chai-matchers": "^1.0.6",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@rollup/plugin-typescript": "^11.1.6",
"@typechain/ethers-v5": "^10.2.1",
"@typechain/hardhat": "^6.1.6",
"@types/mocha": "^10.0.1",
@@ -70,7 +71,6 @@
"hardhat": "^2.14.0",
"rollup-plugin-auto-external": "^2.0.0",
"rollup-plugin-cleanup": "^3.2.1",
"rollup-plugin-typescript2": "^0.34.1",
"ts-node": "^10.9.1",
"typescript": "^5.0.4",
"winston": "^3.8.2"

View File

@@ -1,5 +1,5 @@
import * as fs from "fs"
import typescript from "rollup-plugin-typescript2"
import typescript from "@rollup/plugin-typescript"
import cleanup from "rollup-plugin-cleanup"
import autoExternal from "rollup-plugin-auto-external"
@@ -13,7 +13,7 @@ const banner = `/**
* @see [Github]{@link ${pkg.homepage}}
*/`
export default {
const config = {
input: "src/index.ts",
output: [
{ file: pkg.exports.require, format: "cjs", banner, exports: "auto" },
@@ -24,8 +24,10 @@ export default {
autoExternal(),
(typescript as any)({
tsconfig: "./build.tsconfig.json",
useTsconfigDeclarationDir: true
sourceMap: true
}),
cleanup({ comments: "jsdoc" })
]
}
export default config

View File

@@ -24,7 +24,11 @@ export const blake512FromPath = async (path: fs.PathLike): Promise<string> => {
const hash: string = await new Promise((resolve) => {
fs.createReadStream(path)
.on("data", (chunk: Buffer) => {
.on("data", (chunk: string | Buffer) => {
if (typeof chunk === "string") {
chunk = Buffer.from(chunk)
}
blake.blake2bUpdate(context, chunk)
})
.on("end", () => {

View File

@@ -327,7 +327,7 @@ export const createCustomLoggerForFile = (filename: string, level: winston.Logge
level,
transports: new winston.transports.File({
filename,
format: winston.format.printf((log) => log.message),
format: winston.format.printf((log) => log.message as string),
level
})
})

View File

@@ -154,14 +154,14 @@ describe("Verification utilities", () => {
})
})
describe("verifyGROTH16 Proof", () => {
it("should return true for a valid proof", async () => {
// generate
const inputs = {
const inputs = {
x1: "13",
x2: "7",
x3: "4",
x4: "2"
}
it("should return true for a valid proof", async () => {
const { proof, publicSignals } = await generateGROTH16Proof(inputs, finalZkeyPath, wasmPath)
expect(proof).to.not.be.undefined
@@ -170,8 +170,9 @@ describe("Verification utilities", () => {
expect(success).to.be.true
})
it("should fail when given an invalid vkey", async () => {
const { proof, publicSignals } = await generateGROTH16Proof(inputs, finalZkeyPath, wasmPath)
// verify
await expect(verifyGROTH16Proof(invalidVKey, ["3", "4"], {})).to.be.rejected
await expect(verifyGROTH16Proof(invalidVKey, publicSignals, proof)).to.be.rejected
})
})
describe("exportVerifierContract", () => {

View File

@@ -1,4 +1,4 @@
import { DeleteBucketCommand, DeleteObjectCommand, S3Client, PutObjectCommand } from "@aws-sdk/client-s3"
import { DeleteBucketCommand, DeleteObjectCommand, S3Client, PutObjectCommand, ObjectCannedACL } from "@aws-sdk/client-s3"
import fs from "fs"
import {
CeremonyDocumentReferenceAndData,
@@ -107,7 +107,7 @@ export const uploadFileToS3 = async (bucketName: string, objectKey: string, path
Bucket: bucketName,
Key: objectKey,
Body: fs.createReadStream(path),
ACL: "public-read"
ACL: ObjectCannedACL.public_read
}
const command = new PutObjectCommand(params)

View File

@@ -3,8 +3,15 @@
"compilerOptions": {
"baseUrl": ".",
"skipLibCheck": true,
"moduleResolution": "Node16"
"moduleResolution": "nodenext",
"module": "nodenext"
},
"include": ["src/**/*", "test/**/*", "rollup.config.ts"],
"files": ["./hardhat.config.ts"]
"include": [
"src/**/*",
"test/**/*",
"rollup.config.ts"
],
"files": [
"./hardhat.config.ts"
]
}

View File

@@ -4,7 +4,10 @@
"baseUrl": ".",
"declaration": true,
"declarationDir": "dist/types",
"moduleResolution": "Node16"
"moduleResolution": "node",
"module": "esnext"
},
"include": ["src"]
"include": [
"src"
]
}

View File

@@ -13,7 +13,7 @@
},
"types": "dist/types/types/index.d.ts",
"engines": {
"node": "16"
"node": "20"
},
"files": [
"dist/",
@@ -32,8 +32,8 @@
"circom"
],
"scripts": {
"build": "rimraf dist && rollup -c rollup.config.ts --configPlugin typescript",
"build:watch": "rollup -c rollup.config.ts -w --configPlugin typescript",
"build": "rimraf dist && rollup -c rollup.config.ts --configPlugin typescript --bundleConfigAsCjs",
"build:watch": "rollup -c rollup.config.ts -w --configPlugin typescript --bundleConfigAsCjs",
"firebase:login": "firebase login",
"firebase:logout": "firebase logout",
"firebase:init": "firebase init",
@@ -51,13 +51,13 @@
},
"devDependencies": {
"@firebase/rules-unit-testing": "^2.0.7",
"@rollup/plugin-typescript": "^11.1.6",
"@types/rollup-plugin-auto-external": "^2.0.2",
"@types/uuid": "^9.0.1",
"firebase-functions-test": "^3.1.0",
"firebase-tools": "^12.0.0",
"rollup-plugin-auto-external": "^2.0.0",
"rollup-plugin-cleanup": "^3.2.1",
"rollup-plugin-typescript2": "^0.34.1",
"typescript": "^5.0.4"
},
"dependencies": {

View File

@@ -1,5 +1,5 @@
import * as fs from "fs"
import typescript from "rollup-plugin-typescript2"
import typescript from "@rollup/plugin-typescript"
import cleanup from "rollup-plugin-cleanup"
import autoExternal from "rollup-plugin-auto-external"
@@ -23,7 +23,6 @@ export default {
autoExternal(),
(typescript as any)({
tsconfig: "./build.tsconfig.json",
useTsconfigDeclarationDir: true
}),
cleanup({ comments: "jsdoc" })
]

View File

@@ -3,7 +3,12 @@
"compilerOptions": {
"baseUrl": ".",
"skipLibCheck": true,
"moduleResolution": "Node16"
"moduleResolution": "node",
"module": "commonjs"
},
"include": ["src/**/*", "test/**/*", "rollup.config.ts"]
"include": [
"src/**/*",
"test/**/*",
"rollup.config.ts"
]
}

View File

@@ -3,10 +3,12 @@
"baseUrl": ".",
"target": "es2020",
"module": "ESNext",
"moduleResolution": "Node16",
"moduleResolution": "nodenext",
"allowSyntheticDefaultImports": true,
"declaration": true,
"declarationDir": "dist/types"
},
"include": ["src"]
"include": [
"src"
]
}

View File

@@ -32,7 +32,7 @@
"scripts": {
"build": "rimraf dist && rollup -c rollup.config.ts --configPlugin typescript",
"build:watch": "rollup -c rollup.config.ts -w --configPlugin typescript",
"start": "ts-node --esm ./src/index.ts",
"start": "node --loader ts-node/esm ./src/index.ts",
"auth": "yarn start auth",
"auth:siwe": "yarn start auth-siwe",
"auth:bandada": "yarn start auth-bandada",
@@ -48,6 +48,7 @@
"docs": "typedoc src/**/*.ts --out ../../docs/phase2cli"
},
"devDependencies": {
"@rollup/plugin-typescript": "^11.1.6",
"@types/clear": "^0.1.2",
"@types/cli-progress": "^3.11.0",
"@types/figlet": "^1.5.6",
@@ -61,7 +62,6 @@
"rollup-plugin-auto-external": "^2.0.0",
"rollup-plugin-cleanup": "^3.2.1",
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-typescript2": "^0.34.1",
"solc": "^0.8.19",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"

View File

@@ -1,5 +1,5 @@
import * as fs from "fs"
import typescript from "rollup-plugin-typescript2"
import typescript from "@rollup/plugin-typescript"
import autoExternal from "rollup-plugin-auto-external"
import cleanup from "rollup-plugin-cleanup"
import copy from "rollup-plugin-copy"
@@ -23,7 +23,7 @@ export default {
autoExternal(),
(typescript as any)({
tsconfig: "./build.tsconfig.json",
useTsconfigDeclarationDir: true
sourceMap: true
}),
(copy as any)({
targets: [{ src: "public/*", dest: "dist/public" }]

View File

@@ -2,10 +2,13 @@
"compilerOptions": {
"baseUrl": ".",
"target": "es2020",
"module": "ESNext",
"moduleResolution": "Node16",
"module": "nodenext",
"moduleResolution": "nodenext",
"skipLibCheck": true,
"allowSyntheticDefaultImports": true
},
"include": ["src/**/*", "rollup.config.ts"]
"include": [
"src/**/*",
"rollup.config.ts"
]
}

View File

@@ -4,7 +4,7 @@
"strict": true,
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"moduleResolution": "nodenext",
"esModuleInterop": true,
"resolveJsonModule": true,
"preserveConstEnums": true,
@@ -13,15 +13,20 @@
"declarationMap": true,
"allowSyntheticDefaultImports": true,
"declarationDir": "types",
"typeRoots": ["node_modules/@types", "types"],
"typeRoots": [
"node_modules/@types",
"types"
],
"paths": {
"@p0tion/*": ["packages/*/src"]
"@p0tion/*": [
"packages/*/src"
]
}
},
"ts-node": {
"compilerOptions": {
"target": "esnext",
"module": "commonjs"
"module": "nodenext"
}
}
}

10673
yarn.lock

File diff suppressed because it is too large Load Diff