Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ build
.idea
.vscode
.DS_Store
powersOfTau28_hez_final_17.ptau
powersOfTau28_hez_final_*.ptau
testvectorgen/**/testdata
38 changes: 34 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@ The circuits of this repository are compatible with the [go-iden3-core implement

# Building and trusted setup

First install the npm dependencies:
1. Install the npm dependencies:

```bash
npm ci
```

Then build the circuit and do the "trusted" setup:
2. Download corresponding powersOfTau file to be able to compile circuits:

```bash
wget https://storage.googleapis.com/zkevm/ptau/powersOfTau28_hez_final_18.ptau
Comment thread
daveroga marked this conversation as resolved.
```

3. Then build the circuit and do the "trusted" setup:

```bash
./compile-circuit.sh CIRCUIT_PATH PTAU_FILE_PATH
Expand All @@ -21,8 +27,8 @@ Then build the circuit and do the "trusted" setup:
Examples:

```bash
./compile-circuit.sh circuits/auth.circom build/powersOfTau28_hez_final_16.ptau
./compile-circuit.sh circuits/stateTransition.circom build/powersOfTau28_hez_final_16.ptau
./compile-circuit.sh circuits/auth.circom build/powersOfTau28_hez_final_18.ptau
./compile-circuit.sh circuits/stateTransition.circom build/powersOfTau28_hez_final_18.ptau
```

## Work with `s3_util.js` script
Expand Down Expand Up @@ -78,5 +84,29 @@ node s3_util.js rm v1
...
```

## Generate data folders with JSON files with proofs for contracts repo validators testing

Scripts for generating the data with proofs for contracts repo for testing are placed in folders `testvectorgen` and `update-contract-data`.
Example: Generate data for v3 tests in contracts repo (you should have the repo cloned in local)

1. Go to folder `testvectorgen/contract_data/v3`
```bash
cd testvectorgen/contract_data/v3
```
2. Generate executable for v3
```bash
go test -c -o v3_test
```
3. Execute inputs data generation for generating proofs
```bash
./v3_test
```
4. You will see a folder `testdata` generated in the same folder with files with inputs for generating the different proofs.
5. In root folder of the repo you can execute the Node script to generate the JSON files with proofs that will be copied to contracts repo
```bash
node update-contract-data/update-contract-data-v3-stable.js
```
6. You will see in your `../contracts/test/validators/v3/data` and `../contracts/test/validators/common-data` the JSON files generated with the proofs needed for the validators tests in contracts.
Comment thread
daveroga marked this conversation as resolved.

## Security Audits
1. [Trail of Bits](https://github.com/trailofbits/publications/tree/master/reviews) has performed a security audit of our circuits and compiled a report on May 3, 2024: [2024-05-polygonlabs-iden3circuits-securityreview.pdf](https://raw.githubusercontent.com/iden3/audits/adc81d1bce9a7bde9577eb4389998d60cfac9619/circuits/2024-05-polygonlabs-iden3circuits-securityreview.pdf)
2 changes: 1 addition & 1 deletion compile-circuit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ compile_and_ts() {
if [ "$#" -ne 2 ]
then
echo "Usage: $0 CIRCUIT_PATH $1 PTAU_PATH">&2
echo "Example: ./compile-circuit.sh example.circom powersOfTau28_hez_final_15.ptau" >&2
echo "Example: ./compile-circuit.sh example.circom powersOfTau28_hez_final_18.ptau" >&2
exit 1
fi

Expand Down
8 changes: 4 additions & 4 deletions testvectorgen/auth/authV3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ func generateAuthTestData(t *testing.T, profile, genesis, isSecondAuthClaim bool

nonce := big.NewInt(0)

challenge := big.NewInt(12345)

challenge, ok := new(big.Int).SetString("5212973139745638668633720237501954966656555739014896868936311397139229290378", 10)
require.True(t, ok)
user := utils.NewIdentity(t, userPK)

var err error
Expand All @@ -117,7 +117,7 @@ func generateAuthTestData(t *testing.T, profile, genesis, isSecondAuthClaim bool

gisTree, err := merkletree.NewMerkleTree(context.Background(), memory.NewMemoryStorage(), 40)
require.Nil(t, err)
gisTree.Add(context.Background(), big.NewInt(1), big.NewInt(1))
//gisTree.Add(context.Background(), big.NewInt(1), big.NewInt(1))
Comment thread
daveroga marked this conversation as resolved.
Outdated

if genesis == false {
// extract pubKey
Expand Down Expand Up @@ -154,7 +154,7 @@ func generateAuthTestData(t *testing.T, profile, genesis, isSecondAuthClaim bool
require.NoError(t, err)

gistRoot := gisTree.Root()
gistProof, gistNodAux := utils.PrepareProof(gistProofRaw, utils.GistLevels)
gistProof, gistNodAux := utils.PrepareProof(gistProofRaw, utils.OnChainLevels)

inputs := AuthV3Inputs{
UserGenesisID: user.ID.BigInt().String(),
Expand Down
Loading
Loading