Skip to content

Commit 62b65d3

Browse files
Circuits with different tree sizes for the trusted setup ceremony (#137)
* Circuits with different tree sizes for the trusted setup ceremony * Rename stateTransition circuit. Remove circuits variants that we will not do trusted setup for. * Add dummy square constraints to requestId & issuerID inputs * add credentialAtomicQueryV3Universal and linkedMultiQuery5 --------- Co-authored-by: Kolezhniuk <dmytro.k@privado.id>
1 parent a4e9bae commit 62b65d3

22 files changed

+2694
-853
lines changed

circuits/authV3-8-32.circom

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
pragma circom 2.1.1;
2+
3+
include "auth/authV3.circom";
4+
5+
/*
6+
* The identity authorization circuit.
7+
* User ownership of the identity verified by signed challenge.
8+
* Auth claim should be in the user state and not revoked.
9+
* User state should be genesis or added to the global state tree (available in the smart contract).
10+
* The state is verified out of circuits by a verifier.
11+
* public signals:
12+
- userID
13+
- challenge
14+
- gistRoot
15+
*/
16+
component main {public [challenge, gistRoot]} = AuthV3(8, 32); // IdOwnershipLevels, onChainLevels

circuits/authV3.circom

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ include "auth/authV3.circom";
1313
- challenge
1414
- gistRoot
1515
*/
16-
component main {public [challenge, gistRoot]} = AuthV3(40, 64);
16+
component main {public [challenge, gistRoot]} = AuthV3(40, 64); // IdOwnershipLevels, onChainLevels
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
pragma circom 2.1.1;
2+
3+
include "offchain/credentialAtomicQueryV3OffChain.circom";
4+
5+
/*
6+
public output signals:
7+
userID - user profile id
8+
merklized - `1` if claim is merklized
9+
issuerState - equals to issuerAuthState for sig, and to issuerClaimIdenState for mtp
10+
nullifier - sybil resistant user identifier for session id
11+
linkID - linked proof identifier
12+
*/
13+
component main{public [requestID,
14+
issuerID,
15+
issuerClaimNonRevState,
16+
claimSchema,
17+
slotIndex,
18+
claimPathKey,
19+
operator,
20+
value,
21+
valueArraySize,
22+
timestamp,
23+
isRevocationChecked,
24+
proofType,
25+
verifierID,
26+
nullifierSessionID
27+
]} = credentialAtomicQueryV3OffChain(16, 16, 64); // issuerLevels, claimLevels, maxValueArraySize

circuits/credentialAtomicQueryV3.circom

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ component main{public [requestID,
2424
proofType,
2525
verifierID,
2626
nullifierSessionID
27-
]} = credentialAtomicQueryV3OffChain(40, 32, 64);
27+
]} = credentialAtomicQueryV3OffChain(40, 32, 64); // issuerLevels, claimLevels, maxValueArraySize
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
pragma circom 2.1.1;
2+
3+
include "./onchain/credentialAtomicQueryV3OnChain.circom";
4+
5+
/*
6+
public output signals:
7+
userID - user profile id
8+
merklized - `1` if claim is merklized
9+
issuerState - equals to issuerAuthState for sig, and to issuerClaimIdenState for mtp
10+
nullifier - sybil resistant user identifier for session id
11+
linkID - linked proof identifier
12+
*/
13+
component main{public [requestID,
14+
issuerID,
15+
issuerClaimNonRevState,
16+
timestamp,
17+
challenge,
18+
gistRoot,
19+
proofType,
20+
isBJJAuthEnabled
21+
]} = credentialAtomicQueryV3OnChain(16, 16, 64, 16, 32); // issuerLevels, claimLevels, maxValueArraySize, idOwnershipLevels, onChainLevels

circuits/credentialAtomicQueryV3OnChain.circom

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ component main{public [requestID,
1818
gistRoot,
1919
proofType,
2020
isBJJAuthEnabled
21-
]} = credentialAtomicQueryV3OnChain(40, 32, 64, 40, 64);
21+
]} = credentialAtomicQueryV3OnChain(40, 32, 64, 40, 64); // issuerLevels, claimLevels, maxValueArraySize, idOwnershipLevels, onChainLevels
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
pragma circom 2.1.1;
2+
3+
include "universal/credentialAtomicQueryV3Universal.circom";
4+
5+
/*
6+
public outputsignal s:
7+
userID - user profile id
8+
merklized - `1` if claim is merklized
9+
issuerState - equals to issuerAuthState for sig, and to issuerClaimIdenState for mtp
10+
nullifier - sybil resistant user identifier for session id
11+
linkID - linked proof identifier
12+
circuitQueryHash - hash of the query
13+
*/
14+
component main{public [requestID,
15+
issuerID,
16+
issuerClaimNonRevState,
17+
claimSchema,
18+
slotIndex,
19+
claimPathKey,
20+
operator,
21+
value,
22+
valueArraySize,
23+
timestamp,
24+
isRevocationChecked,
25+
proofType,
26+
verifierID,
27+
nullifierSessionID
28+
]} = credentialAtomicQueryV3Universal(16, 16, 64); // issuerLevels, claimLevels, maxValueArraySize
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
pragma circom 2.1.1;
2+
3+
include "universal/credentialAtomicQueryV3Universal.circom";
4+
5+
/*
6+
public outputsignal s:
7+
userID - user profile id
8+
merklized - `1` if claim is merklized
9+
issuerState - equals to issuerAuthState for sig, and to issuerClaimIdenState for mtp
10+
nullifier - sybil resistant user identifier for session id
11+
linkID - linked proof identifier
12+
circuitQueryHash - hash of the query
13+
*/
14+
component main{public [requestID,
15+
issuerID,
16+
issuerClaimNonRevState,
17+
claimSchema,
18+
slotIndex,
19+
claimPathKey,
20+
operator,
21+
value,
22+
valueArraySize,
23+
timestamp,
24+
isRevocationChecked,
25+
proofType,
26+
verifierID,
27+
nullifierSessionID
28+
]} = credentialAtomicQueryV3Universal(40, 32, 64); // issuerLevels, claimLevels, maxValueArraySize

circuits/lib/stateTransition.circom

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ include "../../node_modules/circomlib/circuits/smt/smtprocessor.circom";
1010
include "utils/safeOne.circom";
1111
include "idOwnership.circom";
1212

13-
template StateTransition(IdOwnershipLevels) {
13+
template StateTransitionV3(IdOwnershipLevels) {
1414
signal input userID;
1515
signal input oldUserState;
1616
signal input newUserState;

circuits/linkedMultiQuery10.circom

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ pragma circom 2.1.1;
22

33
include "linked/multiQuery.circom";
44

5-
component main = LinkedMultiQuery(10, 32, 64); // 175331 constraints
5+
component main = LinkedMultiQuery(10, 32, 64); // N, claimLevels, maxValueArraySize

0 commit comments

Comments
 (0)