Skip to content
Merged
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
20 changes: 7 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ jobs:
dir: mantle
env:
VERSION: ${{ needs.setup.outputs.version }}
PTAU_URL: "https://drive.proton.me/urls/5AY6RPBKV0#iGKMHCXR1qU5"
PTAU_FILE: "powersOfTau28_hez_final_17.ptau"
PTAU_SHA256: "6b662a324867139fb1a20a324d90b6ff61856dfb23f59326909f14b0e2483ae0"
steps:
- name: Checkout
uses: actions/checkout@8edcb1bdb4e267140fa742c62e395cd74f332709
Expand Down Expand Up @@ -130,19 +130,13 @@ jobs:
- name: Install snarkjs
run: npm install -g snarkjs@0.7.6

- name: Cache Powers of Tau
id: cache-ptau
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ${{ env.PTAU_FILE }}
key: ptau-${{ env.PTAU_FILE }}

- name: Download Powers of Tau
if: steps.cache-ptau.outputs.cache-hit != 'true'
- name: Assemble Powers of Tau
run: |
echo "Downloading Powers of Tau file (this may take a while, ~3GB)..."
curl -L -o "${{ env.PTAU_FILE }}" "${{ env.PTAU_URL }}"
echo "Download complete."
# The ~151MB ptau is stored in-repo as sub-100MB chunks (GitHub rejects
# larger single files). Upstream hosting at storage.googleapis.com/zkevm
# now returns 403, so the file is vendored rather than downloaded.
cat ptau/${{ env.PTAU_FILE }}.part* > "${{ env.PTAU_FILE }}"
echo "${{ env.PTAU_SHA256 }} ${{ env.PTAU_FILE }}" | sha256sum -c -

- name: Generate Proving Key
run: |
Expand Down
2 changes: 1 addition & 1 deletion blend/generate_inputs_for_poq.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def PoseidonSponge(data, capacity, output_len):

# PoW inputs
pow_nonce = F(randrange(0,p,1))
pow_ticket = poseidon2_hash([F(15269183337130546179674033218),F(epoch_nonce), F(pow_nonce)])
pow_ticket = poseidon2_hash([F(pow_nonce),F(epoch_nonce)])
if role_selector == 2:
pow_difficulty = pow_ticket + 1
else:
Expand Down
6 changes: 2 additions & 4 deletions blend/poq.circom
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,9 @@ template ProofOfQuota(nLevelsPK, bitsQuota) {


// Get the blend PoW result
component pow_dst = BLEND_POW_V1();
component pow_ticket = Poseidon2_hash(3);
pow_ticket.inp[0] <== pow_dst.out;
component pow_ticket = Poseidon2_hash(2);
pow_ticket.inp[0] <== pow_nonce;
pow_ticket.inp[1] <== pol_epoch_nonce;
pow_ticket.inp[2] <== pow_nonce;
component is_winning_pow = SafeFullLessThan();
is_winning_pow.a <== pow_ticket.out;
is_winning_pow.b <== pow_blend_difficulty;
Expand Down
6 changes: 0 additions & 6 deletions misc/constants.circom
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,4 @@ template REWARD_VOUCHER(){
template VOUCHER_NF(){
signal output out;
out <== 332011368467182873038678;
}

// int.from_bytes(b"BLEND_POW_V1", byteorder="little") = 15269183337130546179674033218
template BLEND_POW_V1(){
signal output out;
out <== 15269183337130546179674033218;
}
33 changes: 33 additions & 0 deletions ptau/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Powers of Tau

`powersOfTau28_hez_final_17.ptau` — the phase-1 trusted setup used by
`snarkjs groth16 setup` in [`.github/workflows/ci.yml`](../.github/workflows/ci.yml).

It was previously downloaded from
`https://storage.googleapis.com/zkevm/ptau/powersOfTau28_hez_final_17.ptau`,
which now returns `403 AccessDenied` for anonymous callers. The known mirrors
(`hermez.s3-eu-west-1.amazonaws.com`, `pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com`)
are also gone, so the file is vendored here instead.

## Layout

GitHub rejects any single file over 100 MB, and the ptau is ~151 MB, so it is
stored as two chunks:

powersOfTau28_hez_final_17.ptau.part00 76,000,000 bytes
powersOfTau28_hez_final_17.ptau.part01 75,078,040 bytes

Reassemble with:

cat ptau/powersOfTau28_hez_final_17.ptau.part* > powersOfTau28_hez_final_17.ptau

Expected sha256 of the reassembled file (pinned as `PTAU_SHA256` in the CI workflow):

6b662a324867139fb1a20a324d90b6ff61856dfb23f59326909f14b0e2483ae0

## Properties

Curve BN254 (`0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47`),
power 17 (2^17 = 131072 constraints), phase-2 ready — it carries the Lagrange
evaluation sections 12-15 that `groth16 setup` requires. The largest circuit in
this repo (PoL) uses 20460 constraints.
Binary file added ptau/powersOfTau28_hez_final_17.ptau.part00
Binary file not shown.
Binary file added ptau/powersOfTau28_hez_final_17.ptau.part01
Binary file not shown.
Loading