Skip to content

Commit

Permalink
test: use local test package for poseidon test
Browse files Browse the repository at this point in the history
  • Loading branch information
sripwoud committed Sep 21, 2024
1 parent 77bb121 commit 63fbff2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions packages/poseidon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"devDependencies": {
"@ethersproject/bignumber": "^5.7.0",
"@types/snarkjs": "^0.7.8",
"@zk-kit/artifacts": "workspace:^",
"@zk-kit/poseidon-proof": "1.0.0-beta.4",
"@zk-kit/test": "workspace:^",
"ffjavascript": "^0.3.0"
}
Expand Down
12 changes: 9 additions & 3 deletions packages/poseidon/test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { generatePoseidonProof, verifyPoseidonProof } from '@zk-kit/test'
import { Project } from '@zk-kit/artifacts'
import { generate } from '@zk-kit/poseidon-proof'
import { SCOPE, verifyPoseidonProof } from '@zk-kit/test'
import { getCurveFromName } from 'ffjavascript'
import { join } from 'node:path'

const INPUTS = Array.from({ length: 16 }, (_, i) => i + 1).map(i => ({
inputs: Array.from({ length: i }, (_, j) => j + 1),
Expand All @@ -19,8 +22,11 @@ describe('poseidon', () => {

it.each(INPUTS)(
'Should verify a poseidon proof with $numberOfInputs input(s)',
async ({ inputs }) => {
const proof = await generatePoseidonProof(inputs)
async ({ inputs, numberOfInputs }) => {
const proof = await generate(inputs, SCOPE, {
wasm: join(__dirname, '..', `${Project.POSEIDON}-${numberOfInputs}.wasm`),
zkey: join(__dirname, '..', `${Project.POSEIDON}-${numberOfInputs}.zkey`),
})
const result = await verifyPoseidonProof(proof)
expect(result).toBe(true)
},
Expand Down
6 changes: 6 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 63fbff2

Please sign in to comment.