Specify artifacts version in `@semaphore-protocol/proof` package
cedoor opened this issue · 3 comments
Description
The version of the ZK artifacts to download when generating a proof needs to be specified, as the latest version will be used by default, and when a new version is released the old version would still point to the latest, which would no longer be the right version.
What we want is to pass a hardcoded version
parameter to the maybeGetSnarkArtifacts
function here, correct?
Where version is one of the @zk-kit/semaphore-artifacts
version published in npm?
curl https://registry.npmjs.com/@zk-kit/semaphore-artifacts | jq '.versions | keys'
What would be the best way?
-
hardcoding in line like:
- snarkArtifacts ??= await maybeGetSnarkArtifacts(Project.SEMAPHORE, { parameters: [merkleTreeDepth] }) + snarkArtifacts ??= await maybeGetSnarkArtifacts(Project.SEMAPHORE, { parameters: [merkleTreeDepth], version: '4.0.0-beta.11' })
-
having a custom field in the package json and reading it to pass it to
maybeGetSnarkArtifacts
, e.g.- snarkArtifacts ??= await maybeGetSnarkArtifacts(Project.SEMAPHORE, { parameters: [merkleTreeDepth] }) + const { artifactsVersion: version } = JSON.parse(readFileSync('../package.json', 'utf8')) + snarkArtifacts ??= await maybeGetSnarkArtifacts(Project.SEMAPHORE, { parameters: [merkleTreeDepth], version })
-
we stop defaulting to
latest
here, and makeversion
a required parameter ofgenerateProof
(breaking change) (worse UX imo)
I tend to prefer the first option. Re the third, are there any use cases where a package needs the latest?