Skip to content

Commit

Permalink
chore(poseidon-proof): move tests outside source folder
Browse files Browse the repository at this point in the history
  • Loading branch information
cedoor committed Nov 24, 2023
1 parent 2dcd5c3 commit a7210dc
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 29 deletions.
3 changes: 2 additions & 1 deletion packages/poseidon-proof/build.tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"declarationDir": "dist/types"
"declarationDir": "dist/types",
"resolveJsonModule": true
},
"include": ["src"]
}
4 changes: 2 additions & 2 deletions packages/poseidon-proof/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zk-kit/poseidon-proof",
"version": "0.3.0",
"version": "0.4.0",
"description": "A library to generate and verify Poseidon proofs.",
"license": "MIT",
"main": "dist/index.js",
Expand Down Expand Up @@ -45,7 +45,7 @@
"@ethersproject/bignumber": "^5.7.0",
"@ethersproject/bytes": "^5.7.0",
"@ethersproject/keccak256": "^5.7.0",
"@zk-kit/groth16": "0.3.0",
"@zk-kit/groth16": "0.4.0",
"download": "^8.0.0",
"tmp": "^0.2.1"
}
Expand Down
5 changes: 1 addition & 4 deletions packages/poseidon-proof/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import pkg from "../package.json"

export const libraryName = pkg.name.split("/")[1]

// eslint-disable-next-line import/prefer-default-export
export const defaultSnarkArtifacts = {
wasmFilePath: "https://zkkit.cedoor.dev/poseidon-proof.wasm",
zkeyFilePath: "https://zkkit.cedoor.dev/poseidon-proof.zkey"
Expand Down
4 changes: 2 additions & 2 deletions packages/poseidon-proof/src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { NumericString, prove } from "@zk-kit/groth16"
import download from "download"
import fs from "fs"
import tmp from "tmp"
import { defaultSnarkArtifacts, libraryName } from "./config"
import { defaultSnarkArtifacts } from "./config"
import hash from "./hash"
import packProof from "./packProof"
import { PoseidonProof, SnarkArtifacts } from "./types"
Expand Down Expand Up @@ -34,7 +34,7 @@ export default async function generate(
/* istanbul ignore next */
if (!snarkArtifacts) {
if (isNode()) {
const tmpDir = libraryName
const tmpDir = "poseidon-proof"
const tmpPath = `${tmp.tmpdir}/${tmpDir}`

if (!fs.existsSync(tmpPath)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { buildBn128 } from "@zk-kit/groth16"
import { poseidon1, poseidon2 } from "poseidon-lite"
import generate from "./generate"
import packProof from "./packProof"
import { PoseidonProof } from "./types"
import unpackProof from "./unpackProof"
import verify from "./verify"
import hash from "./hash"
import generate from "../src/generate"
import packProof from "../src/packProof"
import { PoseidonProof } from "../src/types"
import unpackProof from "../src/unpackProof"
import verify from "../src/verify"
import hash from "../src/hash"

describe("PoseidonProof", () => {
const preimage = 2
Expand Down
5 changes: 4 additions & 1 deletion packages/poseidon-proof/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"extends": "../../tsconfig.json",
"include": ["src", "rollup.config.ts"]
"compilerOptions": {
"resolveJsonModule": true
},
"include": ["src", "tests", "rollup.config.ts"]
}
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"target": "ES5",
"module": "ES2020",
"moduleResolution": "node",
"resolveJsonModule": true,
"esModuleInterop": true,
"preserveConstEnums": true,
"skipLibCheck": true,
Expand Down
14 changes: 2 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4448,17 +4448,7 @@ __metadata:
languageName: node
linkType: hard

"@zk-kit/groth16@npm:0.3.0":
version: 0.3.0
resolution: "@zk-kit/groth16@npm:0.3.0"
dependencies:
circom_runtime: 0.1.24
ffjavascript: 0.2.60
checksum: f177fffd7e28c1f6617a67758c017bb962bde8829a6b90bea8053c0c164386b73b58cfe26c2481435bbc0de0c14d8301c23818e4a0450979bceb525f64e9db51
languageName: node
linkType: hard

"@zk-kit/groth16@workspace:packages/groth16":
"@zk-kit/[email protected], @zk-kit/groth16@workspace:packages/groth16":
version: 0.0.0-use.local
resolution: "@zk-kit/groth16@workspace:packages/groth16"
dependencies:
Expand Down Expand Up @@ -4526,7 +4516,7 @@ __metadata:
"@rollup/plugin-json": ^5.0.1
"@types/download": ^8.0.5
"@types/tmp": ^0.2.6
"@zk-kit/groth16": 0.3.0
"@zk-kit/groth16": 0.4.0
download: ^8.0.0
poseidon-lite: ^0.2.0
rollup-plugin-cleanup: ^3.2.1
Expand Down

0 comments on commit a7210dc

Please sign in to comment.