#!/bin/sh
# Runs the complete verification flow from the repository root.
# See README.md in this directory for what each step proves.
set -eu
cd "$(dirname "$0")/.."

# (1) circom sources -> R1CS
yarn workspace @privacy-pool-core/circuits compile

# (2) fetch both phase-1 powers-of-tau files and check their hashes
node verification/scripts/fetch_ptau

# (3) control: locally generated build zkeys against the Hermez phase 1
node verification/scripts/verify_zkeys --kind build

# (4) main claim: ceremony final zkeys against PPoT #80 phase 1
node verification/scripts/verify_zkeys --kind final

# (5) checked-in final vkeys are exactly the vkeys of the final zkeys
node verification/scripts/verify_final_vkeys

echo
echo "All verification steps passed."
