Skip to content

Commit

Permalink
feat: improve GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
roderik committed Sep 26, 2024
1 parent 49dd650 commit ac09d97
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions .github/workflows/solidity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,16 @@ jobs:
circom circuits/nf_anon_nullifier.circom --output ./js/lib --sym --wasm
circom circuits/nf_anon.circom --output ./js/lib --sym --wasm
- name: Create folder
- name: Create folders
if: github.repository == 'settlemint/solidity-zeto'
run: |
mkdir -p ./zeto/proving-keys
mkdir -p ./zeto/contracts-lib
- name: Download ptau
if: github.repository == 'settlemint/solidity-zeto'
working-directory: zeto/proving-keys/
run: |
cd zeto
cd proving-keys
wget -nv https://storage.googleapis.com/zkevm/ptau/powersOfTau28_hez_final_12.ptau
wget -nv https://storage.googleapis.com/zkevm/ptau/powersOfTau28_hez_final_13.ptau
wget -nv https://storage.googleapis.com/zkevm/ptau/powersOfTau28_hez_final_16.ptau
Expand All @@ -142,23 +142,20 @@ jobs:
- name: Generate R1CS circuit format
if: github.repository == 'settlemint/solidity-zeto'
working-directory: zeto/zkp/
run: |
cd zeto
cd zkp/
circom circuits/anon_enc_nullifier.circom --output ../proving-keys --r1cs
circom circuits/anon_enc.circom --output ../proving-keys --r1cs
circom circuits/anon_nullifier.circom --output ../proving-keys --r1cs
circom circuits/anon.circom --output ../proving-keys --r1cs
circom circuits/check-nullifiers.circom --output ../proving-keys --r1cs
circom circuits/nf_anon_nullifier.circom --output ../proving-keys --r1cs
circom circuits/nf_anon.circom --output ../proving-keys --r1cs
ls ../proving-keys -la
- name: Generate proving keys
if: github.repository == 'settlemint/solidity-zeto'
working-directory: zeto/zkp/
run: |
cd zeto
cd zkp/
snarkjs groth16 setup ../proving-keys/anon.r1cs ../proving-keys/powersOfTau28_hez_final_12.ptau ../proving-keys/anon.zkey
snarkjs groth16 setup ../proving-keys/anon_enc.r1cs ../proving-keys/powersOfTau28_hez_final_13.ptau ../proving-keys/anon_enc.zkey
snarkjs groth16 setup ../proving-keys/anon_nullifier.r1cs ../proving-keys/powersOfTau28_hez_final_16.ptau ../proving-keys/anon_nullifier.zkey
Expand All @@ -168,9 +165,8 @@ jobs:
- name: Per-circuit set up ceremony on proving keys
if: github.repository == 'settlemint/solidity-zeto'
working-directory: zeto/zkp/
run: |
cd zeto
cd zkp/
snarkjs zkey contribute ../proving-keys/anon.zkey ../proving-keys/anon_new.zkey --name="contribution" -v -e="random entropy"
snarkjs zkey contribute ../proving-keys/anon_enc.zkey ../proving-keys/anon_enc_new.zkey --name="contribution" -v -e="random entropy"
snarkjs zkey contribute ../proving-keys/anon_nullifier.zkey ../proving-keys/anon_nullifier_new.zkey --name="contribution" -v -e="random entropy"
Expand All @@ -180,10 +176,8 @@ jobs:
- name: Generate verfication keys
if: github.repository == 'settlemint/solidity-zeto'
working-directory: zeto/zkp/
run: |
cd zeto
cd zeto
cd zkp/
snarkjs zkey export verificationkey ../proving-keys/anon_new.zkey ../proving-keys/anon-vkey.json
snarkjs zkey export verificationkey ../proving-keys/anon_enc_new.zkey ../proving-keys/anon_enc-vkey.json
snarkjs zkey export verificationkey ../proving-keys/anon_nullifier_new.zkey ../proving-keys/anon_nullifier-vkey.json
Expand All @@ -193,24 +187,19 @@ jobs:
- name: Generate solidity verifier library
if: github.repository == 'settlemint/solidity-zeto'
working-directory: zeto/zkp/
run: |
mkdir -p ./zeto/contracts-lib
mkdir -p ./zeto/contracts-lib
cd zeto
cd zkp/
snarkjs zkey export solidityverifier ../proving-keys/anon_new.zkey ../contracts-lib/verifier_anon.sol
snarkjs zkey export solidityverifier ../proving-keys/anon_enc_new.zkey ../contracts-lib/verifier_anon_enc.sol
snarkjs zkey export solidityverifier ../proving-keys/anon_nullifier_new.zkey ../contracts-lib/verifier_anon_nullifier.sol
snarkjs zkey export solidityverifier ../proving-keys/anon_enc_nullifier_new.zkey ../contracts-lib/verifier_anon_enc_nullifier.sol
snarkjs zkey export solidityverifier ../proving-keys/nf_anon_new.zkey ../contracts-lib/verifier_nf_anon.sol
snarkjs zkey export solidityverifier ../proving-keys/nf_anon_nullifier_new.zkey ../contracts-lib/verifier_nf_anon_nullifier.sol
- name: Edit solidity files
if: github.repository == 'settlemint/solidity-zeto'
working-directory: zeto/contracts-lib/
run: |
cd zeto
cd contracts-lib
sed 's/Groth16Verifier/Groth16Verifier_Anon/' verifier_anon.sol > ../solidity/contracts/lib/verifier_anon.sol
sed 's/Groth16Verifier/Groth16Verifier_AnonEnc/' verifier_anon_enc.sol > ../solidity/contracts/lib/verifier_anon_enc.sol
sed 's/Groth16Verifier/Groth16Verifier_AnonNullifier/' verifier_anon_nullifier.sol > ../solidity/contracts/lib/verifier_anon_nullifier.sol
Expand Down

0 comments on commit ac09d97

Please sign in to comment.