Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"googleapis": "^118.0.0",
"rimraf": "^5.0.0",
"rollup": "^3.21.6",
"snarkjs": "0.7.3",
"snarkjs": "0.7.5",
"solc": "^0.8.19"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/actions/src/helpers/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export const compileContract = async (contractPath: string): Promise<any> => {
const input = {
language: "Solidity",
sources: {
Verifier: { content: data }
Groth16Verifier: { content: data }
},
settings: {
outputSelection: {
Expand All @@ -104,7 +104,7 @@ export const compileContract = async (contractPath: string): Promise<any> => {

try {
const compiled = JSON.parse(solc.compile(JSON.stringify(input), { import: { contents: "" } }))
return compiled.contracts.Verifier.Verifier
return compiled.contracts.Groth16Verifier.Groth16Verifier
} catch (error: any) {
throw new Error(
"There was an error while compiling the smart contract. Please check that the file is not corrupted and try again."
Expand Down
3 changes: 2 additions & 1 deletion packages/actions/src/helpers/verification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ export const exportVerifierAndVKey = async (
const verifierCode = await exportVerifierContract(finalZkeyPath, templatePath)
fs.writeFileSync(verifierLocalPath, verifierCode)
const verificationKeyJSONData = await exportVkey(finalZkeyPath)
fs.writeFileSync(vKeyLocalPath, JSON.stringify(verificationKeyJSONData))
// use same formatting as in snarkjs cli
fs.writeFileSync(vKeyLocalPath, JSON.stringify(verificationKeyJSONData, null, 1))
}

/**
Expand Down
Binary file modified packages/actions/test/data/artifacts/circuit.wasm
Binary file not shown.
Binary file modified packages/actions/test/data/artifacts/circuit_0000.zkey
Binary file not shown.
Binary file modified packages/actions/test/data/artifacts/circuit_0001.zkey
Binary file not shown.
Binary file modified packages/actions/test/data/artifacts/circuit_final.zkey
Binary file not shown.
427 changes: 171 additions & 256 deletions packages/actions/test/data/artifacts/circuit_verifier.sol

Large diffs are not rendered by default.

100 changes: 99 additions & 1 deletion packages/actions/test/data/artifacts/circuit_vkey.json
Original file line number Diff line number Diff line change
@@ -1 +1,99 @@
{"protocol":"groth16","curve":"bn128","nPublic":2,"vk_alpha_1":["20491192805390485299153009773594534940189261866228447918068658471970481763042","9383485363053290200918347156157836566562967994039712273449902621266178545958","1"],"vk_beta_2":[["6375614351688725206403948262868962793625744043794305715222011528459656738731","4252822878758300859123897981450591353533073413197771768651442665752259397132"],["10505242626370262277552901082094356697409835680220590971873171140371331206856","21847035105528745403288232691147584728191162732299865338377159692350059136679"],["1","0"]],"vk_gamma_2":[["10857046999023057135944570762232829481370756359578518086990519993285655852781","11559732032986387107991004021392285783925812861821192530917403151452391805634"],["8495653923123431417604973247489272438418190587263600148770280649306958101930","4082367875863433681332203403145435568316851327593401208105741076214120093531"],["1","0"]],"vk_delta_2":[["3351906943192106241258173069101062710430064441805762919435903448145435528973","3609814357773144717518631524459248007709624660755909037176309802677798373232"],["9069438153336502951158456788763587199974358703205747886284949853078455843859","15566461416342721154195875920091334398078943971015435069515020299158779682082"],["1","0"]],"vk_alphabeta_12":[[["2029413683389138792403550203267699914886160938906632433982220835551125967885","21072700047562757817161031222997517981543347628379360635925549008442030252106"],["5940354580057074848093997050200682056184807770593307860589430076672439820312","12156638873931618554171829126792193045421052652279363021382169897324752428276"],["7898200236362823042373859371574133993780991612861777490112507062703164551277","7074218545237549455313236346927434013100842096812539264420499035217050630853"]],[["7077479683546002997211712695946002074877511277312570035766170199895071832130","10093483419865920389913245021038182291233451549023025229112148274109565435465"],["4595479056700221319381530156280926371456704509942304414423590385166031118820","19831328484489333784475432780421641293929726139240675179672856274388269393268"],["11934129596455521040620786944827826205713621633706285934057045369193958244500","8037395052364110730298837004334506829870972346962140206007064471173334027475"]]],"IC":[["6819801395408938350212900248749732364821477541620635511814266536599629892365","9092252330033992554755034971584864587974280972948086568597554018278609861372","1"],["2494923446058214646639418591712156421366388762181821637289531085843728324281","5725178132428480568821403146496952551332721127066178100464798546821141271312","1"],["2949088342211450078770029559615904525423143982944239450257777566971809628121","14382936099891824927341970188446629554258856083543365916396703111259580806134","1"]]}
{
"protocol": "groth16",
"curve": "bn128",
"nPublic": 2,
"vk_alpha_1": [
"20491192805390485299153009773594534940189261866228447918068658471970481763042",
"9383485363053290200918347156157836566562967994039712273449902621266178545958",
"1"
],
"vk_beta_2": [
[
"6375614351688725206403948262868962793625744043794305715222011528459656738731",
"4252822878758300859123897981450591353533073413197771768651442665752259397132"
],
[
"10505242626370262277552901082094356697409835680220590971873171140371331206856",
"21847035105528745403288232691147584728191162732299865338377159692350059136679"
],
[
"1",
"0"
]
],
"vk_gamma_2": [
[
"10857046999023057135944570762232829481370756359578518086990519993285655852781",
"11559732032986387107991004021392285783925812861821192530917403151452391805634"
],
[
"8495653923123431417604973247489272438418190587263600148770280649306958101930",
"4082367875863433681332203403145435568316851327593401208105741076214120093531"
],
[
"1",
"0"
]
],
"vk_delta_2": [
[
"19161823989564835637737296466522796488831323246017837088464443058134921181657",
"13569086591555252324742313978174645740706554002370219057989907098718148871000"
],
[
"4066741413342306878075061042034421168947951521512600194522265512551626978759",
"16709452075148008867278058124867623625277614956338192445288288872896849628873"
],
[
"1",
"0"
]
],
"vk_alphabeta_12": [
[
[
"2029413683389138792403550203267699914886160938906632433982220835551125967885",
"21072700047562757817161031222997517981543347628379360635925549008442030252106"
],
[
"5940354580057074848093997050200682056184807770593307860589430076672439820312",
"12156638873931618554171829126792193045421052652279363021382169897324752428276"
],
[
"7898200236362823042373859371574133993780991612861777490112507062703164551277",
"7074218545237549455313236346927434013100842096812539264420499035217050630853"
]
],
[
[
"7077479683546002997211712695946002074877511277312570035766170199895071832130",
"10093483419865920389913245021038182291233451549023025229112148274109565435465"
],
[
"4595479056700221319381530156280926371456704509942304414423590385166031118820",
"19831328484489333784475432780421641293929726139240675179672856274388269393268"
],
[
"11934129596455521040620786944827826205713621633706285934057045369193958244500",
"8037395052364110730298837004334506829870972346962140206007064471173334027475"
]
]
],
"IC": [
[
"6819801395408938350212900248749732364821477541620635511814266536599629892365",
"9092252330033992554755034971584864587974280972948086568597554018278609861372",
"1"
],
[
"2494923446058214646639418591712156421366388762181821637289531085843728324281",
"5725178132428480568821403146496952551332721127066178100464798546821141271312",
"1"
],
[
"2949088342211450078770029559615904525423143982944239450257777566971809628121",
"14382936099891824927341970188446629554258856083543365916396703111259580806134",
"1"
]
]
}
4 changes: 2 additions & 2 deletions packages/actions/test/unit/contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ describe("Smart Contract", () => {
const inputsPath = `${cwd()}/test/data/artifacts/inputs.json`

before(async () => {
contractFactory = await ethers.getContractFactory("Verifier")
contractFactory = await ethers.getContractFactory("Groth16Verifier")
mockVerifier = await contractFactory.deploy()
})

describe("Deployment", () => {
it("should deploy the contract", async () => {
const factory = await ethers.getContractFactory("Verifier")
const factory = await ethers.getContractFactory("Groth16Verifier")
const contract = await factory.deploy()
expect(ethers.utils.isAddress(contract.address)).to.be.true
})
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/.default.env
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ CUSTOM_CLAIMS_COORDINATOR_EMAIL_ADDRESS_OR_DOMAIN="YOUR-EMAIL-ADDRESS-OR-DOMAIN"
CUSTOM_CONTRIBUTION_VERIFICATION_SOFTWARE_NAME="snarkjs"
# The version of the verification software (snarkjs) used to verify a contribution.
# NB. this must match the version specified on the package.json file.
CUSTOM_CONTRIBUTION_VERIFICATION_SOFTWARE_VERSION="0.5.0"
CUSTOM_CONTRIBUTION_VERIFICATION_SOFTWARE_VERSION="0.7.5"
# The commit hash of the version of the verification software (snarkjs) used to verify a contribution.
# NB. this must match the commit hash of the release of the version specified on the package.json file.
CUSTOM_CONTRIBUTION_VERIFICATION_SOFTWARE_COMMIT_HASH="6660254b81a3ed86b961df2a9c1b53ccdddc1216"
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"html-entities": "^2.3.3",
"rimraf": "^5.0.0",
"rollup": "^3.21.6",
"snarkjs": "0.7.3",
"snarkjs": "0.7.5",
"solc": "^0.8.19",
"timer-node": "^5.0.7",
"uuid": "^9.0.0",
Expand Down
79 changes: 77 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3872,6 +3872,16 @@ __metadata:
languageName: node
linkType: hard

"@iden3/binfileutils@npm:0.0.12":
version: 0.0.12
resolution: "@iden3/binfileutils@npm:0.0.12"
dependencies:
fastfile: 0.0.20
ffjavascript: ^0.3.0
checksum: aa7a7ad3de0c0abc290c484967d7145d0722287279724bd792fd51ae534284dbc1be10e1f155e7a9243a94a3f816cb68de02bfaaa6780f915ca6c7954d666242
languageName: node
linkType: hard

"@isaacs/cliui@npm:^8.0.2":
version: 8.0.2
resolution: "@isaacs/cliui@npm:8.0.2"
Expand Down Expand Up @@ -4749,7 +4759,7 @@ __metadata:
rollup-plugin-auto-external: ^2.0.0
rollup-plugin-cleanup: ^3.2.1
rollup-plugin-typescript2: ^0.34.1
snarkjs: 0.7.3
snarkjs: 0.7.5
solc: ^0.8.19
ts-node: ^10.9.1
typescript: ^5.0.4
Expand Down Expand Up @@ -4785,7 +4795,7 @@ __metadata:
rollup-plugin-auto-external: ^2.0.0
rollup-plugin-cleanup: ^3.2.1
rollup-plugin-typescript2: ^0.34.1
snarkjs: 0.7.3
snarkjs: 0.7.5
solc: ^0.8.19
timer-node: ^5.0.7
typescript: ^5.0.4
Expand Down Expand Up @@ -8091,6 +8101,17 @@ __metadata:
languageName: node
linkType: hard

"circom_runtime@npm:0.1.28":
version: 0.1.28
resolution: "circom_runtime@npm:0.1.28"
dependencies:
ffjavascript: 0.3.1
bin:
calcwit: calcwit.js
checksum: 1e0118c90e2257f1f7a7100413040decb92d0e3e1fe461e92263ee258ed33ba0c85ee19d7456e37df20c4ae0d8a4d8c00466aba6e9558f3bf8fa3397abc5c509
languageName: node
linkType: hard

"cjs-module-lexer@npm:^1.0.0":
version: 1.2.3
resolution: "cjs-module-lexer@npm:1.2.3"
Expand Down Expand Up @@ -10318,6 +10339,28 @@ __metadata:
languageName: node
linkType: hard

"ffjavascript@npm:0.3.0":
version: 0.3.0
resolution: "ffjavascript@npm:0.3.0"
dependencies:
wasmbuilder: 0.0.16
wasmcurves: 0.2.2
web-worker: 1.2.0
checksum: eb1c3ee979299d3b670f371336e1a65ec5319a085da3a896465218283a079453b164e340483a5d66588227d8f1e8cf2ddb890d556bb21931a6f5b70d06f3d894
languageName: node
linkType: hard

"ffjavascript@npm:0.3.1, ffjavascript@npm:^0.3.0":
version: 0.3.1
resolution: "ffjavascript@npm:0.3.1"
dependencies:
wasmbuilder: 0.0.16
wasmcurves: 0.2.2
web-worker: 1.2.0
checksum: fa43e35083873a7752d3049066d3e967604d6d35c5a3c9101ef4b68bebdc0837a0e0ffe006a3104a7caea0b2ff5d1d885f7f025006e017cb390631361589f427
languageName: node
linkType: hard

"figlet@npm:^1.6.0":
version: 1.7.0
resolution: "figlet@npm:1.7.0"
Expand Down Expand Up @@ -15851,6 +15894,18 @@ __metadata:
languageName: node
linkType: hard

"r1csfile@npm:0.0.48":
version: 0.0.48
resolution: "r1csfile@npm:0.0.48"
dependencies:
"@iden3/bigarray": 0.0.2
"@iden3/binfileutils": 0.0.12
fastfile: 0.0.20
ffjavascript: 0.3.0
checksum: 8929285ece5d0e8e560572e3a202e84165c5de3855cd04f221fec474b289c8bf9f3d0f734fc7303482fdc75f650e09ca0633bf5769c3367f642df93e83dbb90e
languageName: node
linkType: hard

"randombytes@npm:^2.1.0":
version: 2.1.0
resolution: "randombytes@npm:2.1.0"
Expand Down Expand Up @@ -16915,6 +16970,26 @@ __metadata:
languageName: node
linkType: hard

"snarkjs@npm:0.7.5":
version: 0.7.5
resolution: "snarkjs@npm:0.7.5"
dependencies:
"@iden3/binfileutils": 0.0.12
bfj: ^7.0.2
blake2b-wasm: ^2.4.0
circom_runtime: 0.1.28
ejs: ^3.1.6
fastfile: 0.0.20
ffjavascript: 0.3.1
js-sha3: ^0.8.0
logplease: ^1.2.15
r1csfile: 0.0.48
bin:
snarkjs: build/cli.cjs
checksum: afc1bebc40d34637133b726ec229674984205c5b2779d834c541d6a02a77d4f682510f0580d87a6b00097e6dc60d5783d1bb7eded2d4c34e4fe6f3e8fb929fdb
languageName: node
linkType: hard

"socks-proxy-agent@npm:^8.0.1, socks-proxy-agent@npm:^8.0.2":
version: 8.0.2
resolution: "socks-proxy-agent@npm:8.0.2"
Expand Down