From 0dd968d98f046039d8ad2070e0c079fb23bb2b28 Mon Sep 17 00:00:00 2001 From: Rob Knight Date: Thu, 31 Oct 2024 06:24:56 +0700 Subject: [PATCH 1/3] Add vitest config which helps with importing commonjs modules when running as nodejs --- apps/passport-client/vitest.config.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 apps/passport-client/vitest.config.ts diff --git a/apps/passport-client/vitest.config.ts b/apps/passport-client/vitest.config.ts new file mode 100644 index 0000000000..311f3bbcee --- /dev/null +++ b/apps/passport-client/vitest.config.ts @@ -0,0 +1,11 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + server: { + deps: { + inline: ["@zk-kit/eddsa-poseidon"] + } + } + } +}); From f1214e28c6652b6e29298752f1338e2da8774138 Mon Sep 17 00:00:00 2001 From: Rob Knight Date: Thu, 31 Oct 2024 06:45:04 +0700 Subject: [PATCH 2/3] Added explanatory comment --- apps/passport-client/vitest.config.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/passport-client/vitest.config.ts b/apps/passport-client/vitest.config.ts index 311f3bbcee..976f5e13a4 100644 --- a/apps/passport-client/vitest.config.ts +++ b/apps/passport-client/vitest.config.ts @@ -4,6 +4,9 @@ export default defineConfig({ test: { server: { deps: { + // This is added to fix an issue where @zk-kit/eddsa-poseidon imports + // a CommonJS module using import syntax, which causes a problem. + // See https://github.com/vitest-dev/vitest/issues/4852 for more info. inline: ["@zk-kit/eddsa-poseidon"] } } From 94d08eb36a7d65afed2e354439be3c338eef4f2c Mon Sep 17 00:00:00 2001 From: Andrew Twyman Date: Wed, 30 Oct 2024 19:00:40 -0700 Subject: [PATCH 3/3] Update eddsa-poseidon to 1.1.0 --- apps/consumer-client/package.json | 2 +- packages/lib/pod/package.json | 2 +- packages/lib/podspec/package.json | 2 +- packages/pcd/eddsa-pcd/package.json | 2 +- packages/pcd/semaphore-identity-pcd/package.json | 2 +- .../pcd/zk-eddsa-event-ticket-pcd/package.json | 2 +- packages/pcd/zk-eddsa-frog-pcd/package.json | 2 +- yarn.lock | 15 +++++++++++++-- 8 files changed, 20 insertions(+), 9 deletions(-) diff --git a/apps/consumer-client/package.json b/apps/consumer-client/package.json index 6ffd5fb748..6b4d573dbb 100644 --- a/apps/consumer-client/package.json +++ b/apps/consumer-client/package.json @@ -37,7 +37,7 @@ "@semaphore-protocol/identity": "^3.15.2", "@simplewebauthn/browser": "^7.2.0", "@simplewebauthn/server": "^7.2.0", - "@zk-kit/eddsa-poseidon": "~1.0.4", + "@zk-kit/eddsa-poseidon": "^1.1.0", "dotenv": "^16.0.3", "ethers": "^5.7.2", "json-bigint": "^1.0.0", diff --git a/packages/lib/pod/package.json b/packages/lib/pod/package.json index f10e1c6bc2..7e061f293e 100644 --- a/packages/lib/pod/package.json +++ b/packages/lib/pod/package.json @@ -39,7 +39,7 @@ }, "dependencies": { "@pcd/util": "0.8.0", - "@zk-kit/eddsa-poseidon": "~1.0.4", + "@zk-kit/eddsa-poseidon": "^1.1.0", "@zk-kit/lean-imt": "^2.2.1", "@zk-kit/utils": "^1.2.1", "js-sha256": "^0.10.1", diff --git a/packages/lib/podspec/package.json b/packages/lib/podspec/package.json index 09bfb8a996..b07249fe3a 100644 --- a/packages/lib/podspec/package.json +++ b/packages/lib/podspec/package.json @@ -35,7 +35,7 @@ "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/uuid": "^9.0.0", - "@zk-kit/eddsa-poseidon": "~1.0.4", + "@zk-kit/eddsa-poseidon": "^1.1.0", "eslint": "^8.57.0", "mocha": "^10.2.0", "ts-mocha": "^10.0.0", diff --git a/packages/pcd/eddsa-pcd/package.json b/packages/pcd/eddsa-pcd/package.json index e0d60ec4dd..227184b5c6 100644 --- a/packages/pcd/eddsa-pcd/package.json +++ b/packages/pcd/eddsa-pcd/package.json @@ -34,7 +34,7 @@ "dependencies": { "@pcd/pcd-types": "0.14.0", "@pcd/util": "0.8.0", - "@zk-kit/eddsa-poseidon": "~1.0.4", + "@zk-kit/eddsa-poseidon": "^1.1.0", "poseidon-lite": "^0.3.0", "uuid": "^9.0.0" }, diff --git a/packages/pcd/semaphore-identity-pcd/package.json b/packages/pcd/semaphore-identity-pcd/package.json index 56ddfd54da..24d02b5f2a 100644 --- a/packages/pcd/semaphore-identity-pcd/package.json +++ b/packages/pcd/semaphore-identity-pcd/package.json @@ -38,7 +38,7 @@ "@pcd/util": "0.8.0", "@semaphore-protocol/identity": "^4.5.0", "@types/json-bigint": "^1.0.3", - "@zk-kit/eddsa-poseidon": "~1.0.4", + "@zk-kit/eddsa-poseidon": "^1.1.0", "@zk-kit/utils": "^1.2.1", "js-sha256": "^0.11.0", "json-bigint": "^1.0.0", diff --git a/packages/pcd/zk-eddsa-event-ticket-pcd/package.json b/packages/pcd/zk-eddsa-event-ticket-pcd/package.json index 124cc63e0d..6c1c683ef2 100644 --- a/packages/pcd/zk-eddsa-event-ticket-pcd/package.json +++ b/packages/pcd/zk-eddsa-event-ticket-pcd/package.json @@ -42,7 +42,7 @@ "@pcd/snarkjs": "0.10.0", "@pcd/util": "0.8.0", "@semaphore-protocol/identity": "^3.15.2", - "@zk-kit/eddsa-poseidon": "~1.0.4", + "@zk-kit/eddsa-poseidon": "^1.1.0", "json-bigint": "^1.0.0", "snarkjs": "^0.7.4", "uuid": "^9.0.0" diff --git a/packages/pcd/zk-eddsa-frog-pcd/package.json b/packages/pcd/zk-eddsa-frog-pcd/package.json index 6964c3a488..6a0246fee8 100644 --- a/packages/pcd/zk-eddsa-frog-pcd/package.json +++ b/packages/pcd/zk-eddsa-frog-pcd/package.json @@ -41,7 +41,7 @@ "@pcd/semaphore-signature-pcd": "0.14.0", "@pcd/util": "0.8.0", "@semaphore-protocol/identity": "^3.15.2", - "@zk-kit/eddsa-poseidon": "~1.0.4", + "@zk-kit/eddsa-poseidon": "^1.1.0", "json-bigint": "^1.0.0", "snarkjs": "^0.7.4", "uuid": "^9.0.0" diff --git a/yarn.lock b/yarn.lock index ac3ca62ff3..b00f0349e0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8284,7 +8284,7 @@ dependencies: circomlib "^2.0.5" -"@zk-kit/eddsa-poseidon@1.0.4", "@zk-kit/eddsa-poseidon@~1.0.4": +"@zk-kit/eddsa-poseidon@1.0.4": version "1.0.4" resolved "https://registry.yarnpkg.com/@zk-kit/eddsa-poseidon/-/eddsa-poseidon-1.0.4.tgz#80e20fd94eca610002e58a5dc8c1716458f0cb60" integrity sha512-w0HrF5F+Kh+77+VK/p9qzB7wvitiZMAoWnqrmzPUM+MWlaNp0ipmtuO8KTLxnj8ACjt98GAK4voxl7XeWjC4XQ== @@ -8294,6 +8294,17 @@ buffer "6.0.3" poseidon-lite "0.3.0" +"@zk-kit/eddsa-poseidon@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@zk-kit/eddsa-poseidon/-/eddsa-poseidon-1.1.0.tgz#08ef95ccbb2fbb5260617b6b5120dfb25a25229b" + integrity sha512-Djc+zOZjd73FpLLf32/XeVZi8GX4ShPQJGS4Iig1QMAR/2CggEi++6Jrkr9N2FM3M4MRCH1qxz2u22DjOLtASg== + dependencies: + "@zk-kit/baby-jubjub" "1.0.3" + "@zk-kit/utils" "1.2.1" + blakejs "^1.2.1" + buffer "6.0.3" + poseidon-lite "0.3.0" + "@zk-kit/groth16@0.3.0": version "0.3.0" resolved "https://registry.yarnpkg.com/@zk-kit/groth16/-/groth16-0.3.0.tgz#74240beb26e98e4ea3546159108ca968ed7c019b" @@ -9190,7 +9201,7 @@ blake2b@^2.1.3: blake2b-wasm "^2.4.0" nanoassert "^2.0.0" -blakejs@^1.1.0: +blakejs@^1.1.0, blakejs@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.2.1.tgz#5057e4206eadb4a97f7c0b6e197a505042fc3814" integrity sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==