Skip to content

Commit 56a08f9

Browse files
authored
Merge pull request #39 from iden3/fix/issuer-non-rev-sate-on-mtp
Fix/proofs signals
2 parents 48b8cf3 + c29609b commit 56a08f9

File tree

6 files changed

+71
-66
lines changed

6 files changed

+71
-66
lines changed

circuits/credentialAtomicQueryMTP.circom

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ component main{public [challenge,
77
userState,
88
issuerID,
99
issuerClaimIdenState,
10+
issuerClaimNonRevState,
1011
claimSchema,
1112
slotIndex,
1213
operator,

circuits/credentialAtomicQuerySig.circom

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ component main{public [challenge,
66
userID,
77
userState,
88
issuerID,
9-
issuerState,
109
issuerClaimNonRevState,
1110
claimSchema,
1211
slotIndex,

circuits/lib/query/credentialAtomicQuerySig.circom

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ template CredentialAtomicQuerySig(IdOwnershipLevels, IssuerLevels, valueArraySiz
6464

6565
// issuer state
6666
signal input issuerID;
67-
signal input issuerState;
68-
signal input issuerClaimsTreeRoot;
69-
signal input issuerRevTreeRoot;
70-
signal input issuerRootsTreeRoot;
71-
7267

7368
signal input issuerAuthClaim[8];
7469
signal input issuerAuthClaimMtp[IssuerLevels];

test/circuits/query/credentialAtomicQuerySigTest.circom

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ pragma circom 2.0.0;
33
include "../../../circuits/lib/query/credentialAtomicQuerySig.circom";
44

55
component main{public [challenge,
6-
userID,
7-
userState,
8-
claimSchema,
9-
slotIndex,
10-
operator,
11-
value,
12-
timestamp]} = CredentialAtomicQuerySig(32, 32, 64);
6+
userID,
7+
userState,
8+
issuerID,
9+
issuerClaimNonRevState,
10+
claimSchema,
11+
slotIndex,
12+
operator,
13+
value,
14+
timestamp]} = CredentialAtomicQuerySig(32, 32, 64);

test/query/credentialAtomicQueryMTP.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@ describe("Test credential atomic query", function () {
6969
timestamp: "1642074362",
7070
value: ["10", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"],
7171
}
72-
7372
const expOut = {
7473
challenge: "1",
7574
userID: "379949150130214723420589610911161895495647789006649785264738141299135414272",
7675
claimSchema: "180410020913331409885634153623124536270",
76+
userState: "18656147546666944484453899241916469544090258810192803949522794490493271005313",
77+
issuerClaimIdenState: "18605292738057394742004097311192572049290380262377486632479765119429313092475",
78+
issuerClaimNonRevState: "18605292738057394742004097311192572049290380262377486632479765119429313092475",
7779
slotIndex: "2",
7880
operator: "1",
7981
timestamp: "1642074362",

test/query/credentialAtomicQuerySig.test.ts

Lines changed: 58 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const assert = chai.assert;
77

88
export {};
99

10-
describe("Test CredentialAtomicQuerySig.circom", function () {
10+
describe("Test CredentialAtomicQuerySig.circom", function() {
1111

1212
this.timeout(600000);
1313

@@ -32,61 +32,67 @@ describe("Test CredentialAtomicQuerySig.circom", function () {
3232
it("credentialAtomicQuerySigTest", async () => {
3333
// inputs MUST be generated by GO-CIRCUITS library https://github.com/iden3/go-circuits (using corresponding test)
3434
const inputs = {
35-
"challenge": "84239",
36-
"challengeSignatureR8x": "14443879978900947038971926807837206222830804504916993621940925629433736033219",
37-
"challengeSignatureR8y": "12729002170022424539486365270180256739680472584306485783075800699487899204326",
38-
"challengeSignatureS": "836454431395954422103086501419117817962615640408892446754696281220237408543",
39-
"claimSchema": "210459579859058135404770043788028292398",
40-
"issuerAuthClaim": ["304427537360709784173770334266246861770", "0", "4003653841729095893886045954705542872794447955766102255759127797295285488487", "12432651117722474612070219664501364108487965088671769880828964159025685825181", "0", "0", "0", "0"],
41-
"issuerAuthClaimMtp": ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"],
42-
"issuerAuthClaimNonRevMtp": ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"],
43-
"issuerAuthClaimNonRevMtpAuxHi": "0",
44-
"issuerAuthClaimNonRevMtpAuxHv": "0",
45-
"issuerAuthClaimNonRevMtpNoAux": "1",
46-
"issuerAuthClaimsTreeRoot": "5123307644320232334601789092683659046372501933037132521592406792551396194285",
47-
"issuerAuthRevTreeRoot": "0",
48-
"issuerAuthRootsTreeRoot": "0",
49-
"issuerClaim": ["3613283249068442770038516118105710406958", "222712906379570502079611869905711649383946316867077911802139171411787317248", "19960424", "2", "227737578863135127229742293906", "0", "0", "0"],
50-
"issuerClaimNonRevClaimsTreeRoot": "15223488090497480996164278132154256642649856052781941842012430126901504694315",
51-
"issuerClaimNonRevMtp": ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"],
52-
"issuerClaimNonRevMtpAuxHi": "0",
53-
"issuerClaimNonRevMtpAuxHv": "0",
54-
"issuerClaimNonRevMtpNoAux": "1",
55-
"issuerClaimNonRevRevTreeRoot": "0",
56-
"issuerClaimNonRevRootsTreeRoot": "4990132952129040175987903194901426383880983865057110565659262312741936794566",
57-
"issuerClaimNonRevState": "19221836623970007220538457599669851375427558847917606787084815224761802529201",
58-
"issuerClaimSignatureR8x": "19045858395840746612549877977108164799354042570658196386453619850564787233776",
59-
"issuerClaimSignatureR8y": "739473645024068689033722089826774751642222247621407780021799744545508322878",
60-
"issuerClaimSignatureS": "649122636969614974711413717869822497148719098417447361410598803181314860028",
61-
"issuerClaimsTreeRoot": "5123307644320232334601789092683659046372501933037132521592406792551396194285",
62-
"issuerID": "330477016068568275516898063887311212065482015025379036159122139014924926976",
63-
"issuerRevTreeRoot": "0",
64-
"issuerRootsTreeRoot": "0",
65-
"issuerState": "11672667429383627660992648216772306271234451162443612055001584519010749218959",
66-
"operator": 2,
67-
"slotIndex": 2,
68-
"timestamp": "1651850376",
69-
"userAuthClaim": ["304427537360709784173770334266246861770", "0", "11151655580697319947882291674102291730051706338247314064771322625319070352517", "17002319580480461745556995341522831877523489413849835052106266233588801210277", "0", "0", "0", "0"],
70-
"userAuthClaimMtp": ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"],
71-
"userAuthClaimNonRevMtp": ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"],
72-
"userAuthClaimNonRevMtpAuxHi": "0",
73-
"userAuthClaimNonRevMtpAuxHv": "0",
74-
"userAuthClaimNonRevMtpNoAux": "1",
75-
"userClaimsTreeRoot": "19778093938750740790275490062389575839849129769112681857212084478032253498250",
76-
"userID": "222712906379570502079611869905711649383946316867077911802139171411787317248",
77-
"userRevTreeRoot": "0",
78-
"userRootsTreeRoot": "0",
79-
"userState": "7608718875990494885422326673876913565155307854054144181362485232187902102852",
80-
"value": ["20000101", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"]
35+
userAuthClaim: ["304427537360709784173770334266246861770", "0", "17640206035128972995519606214765283372613874593503528180869261482403155458945", "20634138280259599560273310290025659992320584624461316485434108770067472477956", "15930428023331155902", "0", "0", "0"],
36+
userAuthClaimMtp: ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"],
37+
userAuthClaimNonRevMtp: ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"],
38+
userAuthClaimNonRevMtpAuxHi: "0",
39+
userAuthClaimNonRevMtpAuxHv: "0",
40+
userAuthClaimNonRevMtpNoAux: "1",
41+
userClaimsTreeRoot: "9763429684850732628215303952870004997159843236039795272605841029866455670219",
42+
userState: "18656147546666944484453899241916469544090258810192803949522794490493271005313",
43+
userRevTreeRoot: "0",
44+
userRootsTreeRoot: "0",
45+
userID: "379949150130214723420589610911161895495647789006649785264738141299135414272",
46+
challenge: "1",
47+
challengeSignatureR8x: "8553678144208642175027223770335048072652078621216414881653012537434846327449",
48+
challengeSignatureR8y: "5507837342589329113352496188906367161790372084365285966741761856353367255709",
49+
challengeSignatureS: "2093461910575977345603199789919760192811763972089699387324401771367839603655",
50+
issuerClaim: ["3583233690122716044519380227940806650830", "379949150130214723420589610911161895495647789006649785264738141299135414272", "10", "0", "30803922965249841627828060161", "0", "0", "0"],
51+
issuerClaimNonRevClaimsTreeRoot: "3077200351284676204723270374054827783313480677490603169533924119235084704890",
52+
issuerClaimNonRevRevTreeRoot: "0",
53+
issuerClaimNonRevRootsTreeRoot: "0",
54+
issuerClaimNonRevState: "18605292738057394742004097311192572049290380262377486632479765119429313092475",
55+
issuerClaimNonRevMtp: ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"],
56+
issuerClaimNonRevMtpAuxHi: "0",
57+
issuerClaimNonRevMtpAuxHv: "0",
58+
issuerClaimNonRevMtpNoAux: "1",
59+
claimSchema: "180410020913331409885634153623124536270",
60+
issuerID: "26599707002460144379092755370384635496563807452878989192352627271768342528",
61+
operator: 1,
62+
slotIndex: 2,
63+
timestamp: "1642074362",
64+
value: ["10", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"],
65+
issuerClaimSignatureR8x: "18625305647089498634672127449050652473073470525382360069529718632627474482386",
66+
issuerClaimSignatureR8y: "14539700345423181413201048131770723125531044953576671601029329833956725811279",
67+
issuerClaimSignatureS: "772934080142423067561028786350670095248312416624185973552603152377549415467",
68+
issuerAuthClaim: ["304427537360709784173770334266246861770", "0", "9582165609074695838007712438814613121302719752874385708394134542816240804696", "18271435592817415588213874506882839610978320325722319742324814767882756910515", "11203087622270641253", "0", "0", "0"],
69+
issuerAuthClaimMtp: ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"],
70+
issuerAuthClaimNonRevMtp: ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"],
71+
issuerAuthClaimNonRevMtpAuxHi: "0",
72+
issuerAuthClaimNonRevMtpAuxHv: "0",
73+
issuerAuthClaimNonRevMtpNoAux: "1",
74+
issuerAuthClaimsTreeRoot: "18337129644116656308842422695567930755039142442806278977230099338026575870840",
75+
issuerAuthRevTreeRoot: "0",
76+
issuerAuthRootsTreeRoot: "0",
8177
}
8278

79+
// signal input issuerState;
80+
// signal input issuerClaimsTreeRoot;
81+
// signal input issuerRevTreeRoot;
82+
// signal input issuerRootsTreeRoot;
83+
8384
const expOut = {
84-
challenge: "84239",
85-
userID: "222712906379570502079611869905711649383946316867077911802139171411787317248",
86-
claimSchema: "210459579859058135404770043788028292398",
85+
userState: "18656147546666944484453899241916469544090258810192803949522794490493271005313",
86+
issuerID: "26599707002460144379092755370384635496563807452878989192352627271768342528",
87+
issuerAuthState: "6317996369756476782464660619835940615734517981889733696047139451453239145426",
88+
issuerClaimNonRevState: "18605292738057394742004097311192572049290380262377486632479765119429313092475",
89+
challenge: "1",
90+
userID: "379949150130214723420589610911161895495647789006649785264738141299135414272",
91+
claimSchema: "180410020913331409885634153623124536270",
8792
slotIndex: "2",
88-
operator: "2",
89-
timestamp: "1651850376",
93+
operator: "1",
94+
value: ["10", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"],
95+
timestamp: "1642074362",
9096
}
9197
const w = await circuit.calculateWitness(inputs, true);
9298
await circuit.assertOut(w, expOut);

0 commit comments

Comments
 (0)