From f2cf5f5c3509661229fd416a9d3f4e0f7de3b466 Mon Sep 17 00:00:00 2001 From: vmidyllic <74898029+vmidyllic@users.noreply.github.com> Date: Thu, 7 Dec 2023 19:55:20 +0200 Subject: [PATCH 01/14] add onchainTestData --- .../credentialAtomicQueryV3OnChain.test.ts | 4 +- .../v3/testdata/mtp/auth_check_disabled.json | 1 - .../v3/testdata/mtp/onchainIdentity.json | 1 + .../v3/testdata/sig/auth_check_disabled.json | 1 - .../v3/testdata/sig/onchainIdentity.json | 1 + .../credentials/onchain/v3/v3_test.go | 88 ++++++++++++++----- testvectorgen/go.mod | 11 ++- testvectorgen/go.sum | 10 +++ testvectorgen/utils/identity.go | 45 ++++++++++ 9 files changed, 132 insertions(+), 30 deletions(-) delete mode 100644 testvectorgen/credentials/onchain/v3/testdata/mtp/auth_check_disabled.json create mode 100644 testvectorgen/credentials/onchain/v3/testdata/mtp/onchainIdentity.json delete mode 100644 testvectorgen/credentials/onchain/v3/testdata/sig/auth_check_disabled.json create mode 100644 testvectorgen/credentials/onchain/v3/testdata/sig/onchainIdentity.json diff --git a/test/onchain/credentialAtomicQueryV3OnChain.test.ts b/test/onchain/credentialAtomicQueryV3OnChain.test.ts index 8a035c94..c8729103 100644 --- a/test/onchain/credentialAtomicQueryV3OnChain.test.ts +++ b/test/onchain/credentialAtomicQueryV3OnChain.test.ts @@ -42,7 +42,7 @@ describe("Test credentialAtomicQueryV3OnChain.circom", function () { require(`${sigBasePath}/nullify.json`), require(`${sigBasePath}/revoked_claim_without_revocation_check.json`), require(`${sigBasePath}/jsonld_non_inclusion.json`), - require(`${sigBasePath}/auth_check_disabled.json`), + require(`${sigBasePath}/onchainIdentity.json`), // mtp require(`${mtpBasePath}/claimIssuedOnProfileID.json`), @@ -56,7 +56,7 @@ describe("Test credentialAtomicQueryV3OnChain.circom", function () { require(`${mtpBasePath}/selective_disclosure.json`), require(`${mtpBasePath}/nullify.json`), require(`${mtpBasePath}/revoked_claim_without_revocation_check.json`), - require(`${mtpBasePath}/auth_check_disabled.json`), + require(`${mtpBasePath}/onchainIdentity.json`), ]; tests.forEach(({ desc, inputs, expOut }) => { diff --git a/testvectorgen/credentials/onchain/v3/testdata/mtp/auth_check_disabled.json b/testvectorgen/credentials/onchain/v3/testdata/mtp/auth_check_disabled.json deleted file mode 100644 index 156974bf..00000000 --- a/testvectorgen/credentials/onchain/v3/testdata/mtp/auth_check_disabled.json +++ /dev/null @@ -1 +0,0 @@ -{"desc":"Skip Auth V2 check","inputs":{"requestID":"41","userGenesisID":"23273167900576580892722615617815475823351560716009055944677723144398443009","profileNonce":"0","claimSubjectProfileNonce":"0","authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimIncMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","challenge":"12345","challengeSignatureR8x":"15829360093371098546177008474519342171461782120259125067189481965541223738777","challengeSignatureR8y":"10840522802382821290541462398953040493080116495308402635486440290351677745960","challengeSignatureS":"1196477404779941775725836688033485533497812196897664950083199167075327114562","userClaimsTreeRoot":"8162166103065016664685834856644195001371303013149727027131225893397958846382","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"8039964009611210398788855768060749920589777058607598891238307089541758339342","gistRoot":"1243904711429961858774220647610724273798918457991486031567244100767259239747","gistMtp":["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","0"],"gistMtpAuxHi":"1","gistMtpAuxHv":"1","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["3583233690122716044519380227940806650830","23273167900576580892722615617815475823351560716009055944677723144398443009","10","0","30803922965249841627828060161","0","0","0"],"issuerClaimMtp":["0","20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"822392840143531676250086160084530040476172248252065459222610568880934884086","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"595634593597118989354040083735120083650459900146875299094425656479483321655","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"822392840143531676250086160084530040476172248252065459222610568880934884086","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"595634593597118989354040083735120083650459900146875299094425656479483321655","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"180410020913331409885634153623124536270","claimPathNotExists":"0","claimPathMtp":["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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"0","claimPathValue":"0","operator":9,"slotIndex":2,"timestamp":"1642074362","value":["8","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"],"issuerClaimSignatureR8x":"0","issuerClaimSignatureR8y":"0","issuerClaimSignatureS":"0","issuerAuthClaim":["0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"0","issuerAuthClaimsTreeRoot":"0","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"0","proofType":"2","linkNonce":"0","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","authEnabled":0},"expOut":{"requestID":"41","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"595634593597118989354040083735120083650459900146875299094425656479483321655","circuitQueryHash":"1200197573263720781403876012067624377690459697223785410935360278236612478754","gistRoot":"1243904711429961858774220647610724273798918457991486031567244100767259239747","timestamp":"1642074362","merklized":"0","proofType":"2","isRevocationChecked":"1","challenge":"12345","issuerState":"595634593597118989354040083735120083650459900146875299094425656479483321655","linkID":"0","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","operatorOutput":"0","nullifier":"0","authEnabled":"0"}} \ No newline at end of file diff --git a/testvectorgen/credentials/onchain/v3/testdata/mtp/onchainIdentity.json b/testvectorgen/credentials/onchain/v3/testdata/mtp/onchainIdentity.json new file mode 100644 index 00000000..1b00b839 --- /dev/null +++ b/testvectorgen/credentials/onchain/v3/testdata/mtp/onchainIdentity.json @@ -0,0 +1 @@ +{"desc":"Skip Auth V2 check. Onchain identity (based on ethereum address)","inputs":{"requestID":"41","userGenesisID":"131133180589020711961260361383263483596571070471237344548087960252191233","profileNonce":"0","claimSubjectProfileNonce":"0","authClaim":null,"authClaimIncMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"0","challenge":"\u003cnil\u003e","challengeSignatureR8x":"0","challengeSignatureR8y":"0","challengeSignatureS":"0","userClaimsTreeRoot":"0","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"5317387130258456662214331362918410991734007599705406860481038345552731150762","gistRoot":"0","gistMtp":["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","0"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["3583233690122716044519380227940806650830","131133180589020711961260361383263483596571070471237344548087960252191233","10","0","30803922965249841627828060161","0","0","0"],"issuerClaimMtp":["0","20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"19254747036210529128865168332662848827124379407444944453553402819234148971289","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"3790535331679047042267219825047704753928308239645137564498543078716403663426","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"19254747036210529128865168332662848827124379407444944453553402819234148971289","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"3790535331679047042267219825047704753928308239645137564498543078716403663426","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"180410020913331409885634153623124536270","claimPathNotExists":"0","claimPathMtp":["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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"0","claimPathValue":"0","operator":2,"slotIndex":2,"timestamp":"1642074362","value":["11","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"],"issuerClaimSignatureR8x":"0","issuerClaimSignatureR8y":"0","issuerClaimSignatureS":"0","issuerAuthClaim":["0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"0","issuerAuthClaimsTreeRoot":"0","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"0","proofType":"2","linkNonce":"0","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","authEnabled":0},"expOut":{"requestID":"41","userID":"131133180589020711961260361383263483596571070471237344548087960252191233","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"3790535331679047042267219825047704753928308239645137564498543078716403663426","circuitQueryHash":"18553675390142770485013045767457680022963441687516601992912695379143100497483","gistRoot":"0","timestamp":"1642074362","merklized":"0","proofType":"2","isRevocationChecked":"1","challenge":"\u003cnil\u003e","issuerState":"3790535331679047042267219825047704753928308239645137564498543078716403663426","linkID":"0","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","operatorOutput":"0","nullifier":"0","authEnabled":"0"}} \ No newline at end of file diff --git a/testvectorgen/credentials/onchain/v3/testdata/sig/auth_check_disabled.json b/testvectorgen/credentials/onchain/v3/testdata/sig/auth_check_disabled.json deleted file mode 100644 index 48e69e99..00000000 --- a/testvectorgen/credentials/onchain/v3/testdata/sig/auth_check_disabled.json +++ /dev/null @@ -1 +0,0 @@ -{"desc":"Skip Auth V2 check","inputs":{"requestID":"41","userGenesisID":"23273167900576580892722615617815475823351560716009055944677723144398443009","profileNonce":"0","claimSubjectProfileNonce":"0","authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimIncMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","challenge":"12345","challengeSignatureR8x":"15829360093371098546177008474519342171461782120259125067189481965541223738777","challengeSignatureR8y":"10840522802382821290541462398953040493080116495308402635486440290351677745960","challengeSignatureS":"1196477404779941775725836688033485533497812196897664950083199167075327114562","userClaimsTreeRoot":"8162166103065016664685834856644195001371303013149727027131225893397958846382","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"8039964009611210398788855768060749920589777058607598891238307089541758339342","gistRoot":"1243904711429961858774220647610724273798918457991486031567244100767259239747","gistMtp":["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","0"],"gistMtpAuxHi":"1","gistMtpAuxHv":"1","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["3583233690122716044519380227940806650830","23273167900576580892722615617815475823351560716009055944677723144398443009","10","0","30803922965249841627828060161","0","0","0"],"issuerClaimMtp":["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"],"issuerClaimClaimsTreeRoot":"0","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"0","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"2943483356559152311923412925436024635269538717812859789851139200242297094","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"180410020913331409885634153623124536270","claimPathNotExists":"0","claimPathMtp":["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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"0","claimPathValue":"0","operator":9,"slotIndex":2,"timestamp":"1642074362","value":["8","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"],"issuerClaimSignatureR8x":"18262561750263096492861752748754743906945572174055032086325388282426101240690","issuerClaimSignatureR8y":"14777804679308849100286667012936457253902973107784217502520093733745548996472","issuerClaimSignatureS":"1421398207022438431063604515262670377383544443354258420146919173860813767426","issuerAuthClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"1","issuerAuthClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"2943483356559152311923412925436024635269538717812859789851139200242297094","proofType":"1","linkNonce":"0","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","authEnabled":0},"expOut":{"requestID":"41","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"2943483356559152311923412925436024635269538717812859789851139200242297094","circuitQueryHash":"1200197573263720781403876012067624377690459697223785410935360278236612478754","gistRoot":"1243904711429961858774220647610724273798918457991486031567244100767259239747","timestamp":"1642074362","merklized":"0","proofType":"1","isRevocationChecked":"1","challenge":"12345","issuerState":"2943483356559152311923412925436024635269538717812859789851139200242297094","linkID":"0","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","operatorOutput":"0","nullifier":"0","authEnabled":"0"}} \ No newline at end of file diff --git a/testvectorgen/credentials/onchain/v3/testdata/sig/onchainIdentity.json b/testvectorgen/credentials/onchain/v3/testdata/sig/onchainIdentity.json new file mode 100644 index 00000000..44ebdfeb --- /dev/null +++ b/testvectorgen/credentials/onchain/v3/testdata/sig/onchainIdentity.json @@ -0,0 +1 @@ +{"desc":"Skip Auth V2 check. Onchain identity (based on ethereum address)","inputs":{"requestID":"41","userGenesisID":"131133180589020711961260361383263483596571070471237344548087960252191233","profileNonce":"0","claimSubjectProfileNonce":"0","authClaim":null,"authClaimIncMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"0","challenge":"\u003cnil\u003e","challengeSignatureR8x":"0","challengeSignatureR8y":"0","challengeSignatureS":"0","userClaimsTreeRoot":"0","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"5317387130258456662214331362918410991734007599705406860481038345552731150762","gistRoot":"0","gistMtp":["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","0"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["3583233690122716044519380227940806650830","131133180589020711961260361383263483596571070471237344548087960252191233","10","0","30803922965249841627828060161","0","0","0"],"issuerClaimMtp":["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"],"issuerClaimClaimsTreeRoot":"0","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"0","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"2943483356559152311923412925436024635269538717812859789851139200242297094","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"180410020913331409885634153623124536270","claimPathNotExists":"0","claimPathMtp":["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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"0","claimPathValue":"0","operator":2,"slotIndex":2,"timestamp":"1642074362","value":["11","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"],"issuerClaimSignatureR8x":"17120289433100148896070355789101578872617075744128485094918820340403187607368","issuerClaimSignatureR8y":"21049119501588062036761975456791446169482633603928367513417711978587825202691","issuerClaimSignatureS":"135004040175400248934376052669593172812688250227741585910258454432486139497","issuerAuthClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"1","issuerAuthClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"2943483356559152311923412925436024635269538717812859789851139200242297094","proofType":"1","linkNonce":"0","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","authEnabled":0},"expOut":{"requestID":"41","userID":"131133180589020711961260361383263483596571070471237344548087960252191233","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"2943483356559152311923412925436024635269538717812859789851139200242297094","circuitQueryHash":"18553675390142770485013045767457680022963441687516601992912695379143100497483","gistRoot":"0","timestamp":"1642074362","merklized":"0","proofType":"1","isRevocationChecked":"1","challenge":"\u003cnil\u003e","issuerState":"2943483356559152311923412925436024635269538717812859789851139200242297094","linkID":"0","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","operatorOutput":"0","nullifier":"0","authEnabled":"0"}} \ No newline at end of file diff --git a/testvectorgen/credentials/onchain/v3/v3_test.go b/testvectorgen/credentials/onchain/v3/v3_test.go index 2de119b9..aa88b51e 100644 --- a/testvectorgen/credentials/onchain/v3/v3_test.go +++ b/testvectorgen/credentials/onchain/v3/v3_test.go @@ -7,9 +7,11 @@ import ( "strconv" "testing" + "github.com/iden3/go-iden3-crypto/babyjub" "test/utils" core "github.com/iden3/go-iden3-core/v2" + "github.com/iden3/go-iden3-crypto/poseidon" "github.com/iden3/go-merkletree-sql/v2" "github.com/iden3/go-merkletree-sql/v2/db/memory" @@ -18,9 +20,10 @@ import ( ) const ( - userPK = "28156abe7fe2fd433dc9df969286b96666489bac508612d0e16593e944c4f69e" - issuerPK = "28156abe7fe2fd433dc9df969286b96666489bac508612d0e16593e944c4f69d" - timestamp = "1642074362" + userPK = "28156abe7fe2fd433dc9df969286b96666489bac508612d0e16593e944c4f69e" + issuerPK = "28156abe7fe2fd433dc9df969286b96666489bac508612d0e16593e944c4f69d" + timestamp = "1642074362" + ethAddress = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" ) var requestID = big.NewInt(41) @@ -261,13 +264,13 @@ func Test_Between(t *testing.T) { generateTestDataWithOperator(t, desc, isUserIDProfile, isSubjectIDProfile, "0", "sig/between_operator", utils.BETWEEN, &value, Sig, 1) } -func Test_No_AuthV2_Check(t *testing.T) { - desc := "Skip Auth V2 check" +func Test_OnchainIdentity(t *testing.T) { + desc := "Skip Auth V2 check. Onchain identity (based on ethereum address)" isUserIDProfile := false isSubjectIDProfile := false - value := utils.PrepareStrArray([]string{"8", "10"}, 64) - generateTestDataWithOperator(t, desc, isUserIDProfile, isSubjectIDProfile, "0", "mtp/auth_check_disabled", utils.BETWEEN, &value, Mtp, 0) - generateTestDataWithOperator(t, desc, isUserIDProfile, isSubjectIDProfile, "0", "sig/auth_check_disabled", utils.BETWEEN, &value, Sig, 0) + value := utils.PrepareStrArray([]string{"11"}, 64) + generateTestDataWithOperator(t, desc, isUserIDProfile, isSubjectIDProfile, "0", "mtp/onchainIdentity", utils.LT, &value, Mtp, 0) + generateTestDataWithOperator(t, desc, isUserIDProfile, isSubjectIDProfile, "0", "sig/onchainIdentity", utils.LT, &value, Sig, 0) } func Test_Less_Than_Eq(t *testing.T) { @@ -308,7 +311,14 @@ func generateTestDataWithOperatorAndRevCheck(t *testing.T, desc string, isUserID valueInput = *value } - user := utils.NewIdentity(t, userPK) + var user *utils.IdentityTest + + if authEnabled == 1 { + user = utils.NewIdentity(t, userPK) + } else { + // generate onchain identity + user = utils.NewEthereumBasedIdentity(t, "ethereum address") + } issuer := utils.NewIdentity(t, issuerPK) userProfileID := user.ID @@ -448,24 +458,56 @@ func generateTestDataWithOperatorAndRevCheck(t *testing.T, desc string, isUserID issuerClaimNonRevMtp, issuerClaimNonRevAux := issuer.ClaimRevMTP(t, claim) - challenge := big.NewInt(12345) - gisTree, err := merkletree.NewMerkleTree(context.Background(), memory.NewMemoryStorage(), 64) require.Nil(t, err) err = gisTree.Add(context.Background(), big.NewInt(1), big.NewInt(1)) require.NoError(t, err) - // user - authMTProof := user.AuthMTPStrign(t) - - authNonRevMTProof, nodeAuxNonRev := user.ClaimRevMTP(t, user.AuthClaim) - sig := user.Sign(challenge) + var authMTProof []string + var challenge *big.Int + var authNonRevMTProof []string + var nodeAuxNonRev utils.NodeAuxValue + var sig *babyjub.Signature + var gistRoot *merkletree.Hash + var gistProof []string + var gistNodeAux utils.NodeAuxValue + // user + if authEnabled == 1 { + challenge = big.NewInt(12345) + authMTProof = user.AuthMTPStrign(t) + authNonRevMTProof, nodeAuxNonRev = user.ClaimRevMTP(t, user.AuthClaim) + sig = user.Sign(challenge) + gistProofRaw, _, err := gisTree.GenerateProof(context.Background(), user.IDHash(t), nil) + require.NoError(t, err) + gistRoot = gisTree.Root() + gistProof, gistNodeAux = utils.PrepareProof(gistProofRaw, utils.GistLevels) - gistProofRaw, _, err := gisTree.GenerateProof(context.Background(), user.IDHash(t), nil) - require.NoError(t, err) + } else { - gistRoot := gisTree.Root() - gistProof, gistNodAux := utils.PrepareProof(gistProofRaw, utils.GistLevels) + emptyArr := make([]*merkletree.Hash, 0) + authMTProof = utils.PrepareSiblingsStr(emptyArr, utils.IdentityTreeLevels) + authNonRevMTProof = utils.PrepareSiblingsStr(emptyArr, utils.IdentityTreeLevels) + nodeAuxNonRev = utils.NodeAuxValue{ + Key: merkletree.HashZero.String(), + Value: merkletree.HashZero.String(), + NoAux: "0", + } + sig = &babyjub.Signature{ + R8: &babyjub.Point{ + X: new(big.Int), + Y: new(big.Int), + }, + S: new(big.Int), + } + + gistRoot = &merkletree.HashZero + gistProof = utils.PrepareSiblingsStr(emptyArr, utils.GistLevels) + gistNodeAux = utils.NodeAuxValue{ + Key: merkletree.HashZero.String(), + Value: merkletree.HashZero.String(), + NoAux: "0", + } + } inputs := Inputs{ RequestID: requestID.String(), @@ -487,9 +529,9 @@ func generateTestDataWithOperatorAndRevCheck(t *testing.T, desc string, isUserID UserState: user.State(t).String(), GistRoot: gistRoot.BigInt().String(), GistMtp: gistProof, - GistMtpAuxHi: gistNodAux.Key, - GistMtpAuxHv: gistNodAux.Value, - GistMtpNoAux: gistNodAux.NoAux, + GistMtpAuxHi: gistNodeAux.Key, + GistMtpAuxHv: gistNodeAux.Value, + GistMtpNoAux: gistNodeAux.NoAux, ClaimSubjectProfileNonce: nonceSubject.String(), IssuerID: issuer.ID.BigInt().String(), IssuerClaim: claim, diff --git a/testvectorgen/go.mod b/testvectorgen/go.mod index 55d73db8..154427d2 100644 --- a/testvectorgen/go.mod +++ b/testvectorgen/go.mod @@ -10,13 +10,18 @@ require ( github.com/stretchr/testify v1.8.4 ) +require ( + github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect + github.com/holiman/uint256 v1.2.3 // indirect +) + require ( github.com/benbjohnson/clock v1.3.5 // indirect github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dchest/blake512 v1.0.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect - github.com/ethereum/go-ethereum v1.10.26 + github.com/ethereum/go-ethereum v1.13.5 github.com/ipfs/boxo v0.8.0 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/ipfs/go-ipfs-api v0.6.0 // indirect @@ -40,8 +45,8 @@ require ( github.com/pquerna/cachecontrol v0.1.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/whyrusleeping/tar-utils v0.0.0-20201201191210-20a61371de5b // indirect - golang.org/x/crypto v0.7.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/sys v0.13.0 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.2.1 // indirect diff --git a/testvectorgen/go.sum b/testvectorgen/go.sum index e849877c..184a1d09 100644 --- a/testvectorgen/go.sum +++ b/testvectorgen/go.sum @@ -1,5 +1,7 @@ github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= +github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927 h1:SKI1/fuSdodxmNNyVBR8d7X/HuLnRpvvFO0AgyQk764= github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 h1:HVTnpeuvF6Owjd5mniCL8DEXo7uYXdQEmOP4FJbV5tg= github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3/go.mod h1:p1d6YEZWvFzEh4KLyvBcVSnrfNDDvK2zfK/4x2v/4pE= @@ -13,9 +15,13 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etly github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/ethereum/go-ethereum v1.10.26 h1:i/7d9RBBwiXCEuyduBQzJw/mKmnvzsN14jqBmytw72s= github.com/ethereum/go-ethereum v1.10.26/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= +github.com/ethereum/go-ethereum v1.13.5 h1:U6TCRciCqZRe4FPXmy1sMGxTfuk8P7u2UoinF3VbaFk= +github.com/ethereum/go-ethereum v1.13.5/go.mod h1:yMTu38GSuyxaYzQMViqNmQ1s3cE84abZexQmTgenWk0= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o= +github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= github.com/iden3/go-iden3-core/v2 v2.0.0 h1:sQEuuq3RLfyYSY8qPiqxQ6YBpGbiAwepHJD/vjf1adA= github.com/iden3/go-iden3-core/v2 v2.0.0/go.mod h1:L9PxhWPvoS9qTb3inEkZBm1RpjHBt+VTwvxssdzbAdw= github.com/iden3/go-iden3-crypto v0.0.15 h1:4MJYlrot1l31Fzlo2sF56u7EVFeHHJkxGXXZCtESgK4= @@ -77,9 +83,13 @@ github.com/whyrusleeping/tar-utils v0.0.0-20201201191210-20a61371de5b h1:wA3QeTs github.com/whyrusleeping/tar-utils v0.0.0-20201201191210-20a61371de5b/go.mod h1:xT1Y5p2JR2PfSZihE0s4mjdJaRGp1waCTf5JzhQLBck= golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= diff --git a/testvectorgen/utils/identity.go b/testvectorgen/utils/identity.go index a4cf3eed..fd6ad38f 100644 --- a/testvectorgen/utils/identity.go +++ b/testvectorgen/utils/identity.go @@ -5,6 +5,7 @@ import ( "math/big" "testing" + "github.com/ethereum/go-ethereum/common" core "github.com/iden3/go-iden3-core/v2" "github.com/iden3/go-iden3-crypto/babyjub" "github.com/iden3/go-iden3-crypto/poseidon" @@ -171,6 +172,50 @@ func NewIdentity(t testing.TB, privKHex string) *IdentityTest { return &it } +func NewEthereumBasedIdentity(t testing.TB, ethAddr string) *IdentityTest { + + it := IdentityTest{} + var err error + + // init claims tree + + it.Clt, err = merkletree.NewMerkleTree(context.Background(), memory.NewMemoryStorage(), IdentityTreeLevels) + if err != nil { + t.Fatalf("Error creating Claims merkle tree: %v", err) + } + it.Ret, err = merkletree.NewMerkleTree(context.Background(), memory.NewMemoryStorage(), IdentityTreeLevels) + if err != nil { + t.Fatalf("Error creating Revocation merkle tree: %v", err) + } + it.Rot, err = merkletree.NewMerkleTree(context.Background(), memory.NewMemoryStorage(), IdentityTreeLevels) + if err != nil { + t.Fatalf("Error creating Roots merkle tree: %v", err) + } + + addr := common.HexToAddress(ethAddr) + currentState := core.GenesisFromEthAddress(addr) + if err != nil { + t.Fatalf("Error creating genesis state from address: %v", err) + } + + didType, err := core.BuildDIDType(core.DIDMethodIden3, core.Polygon, core.Mumbai) + if err != nil { + t.Fatalf("Error creating did type: %v", err) + } + + did, err := core.NewDID(didType, currentState) + if err != nil { + t.Fatalf("Error creating new did : %v", err) + } + + it.ID, err = core.IDFromDID(*did) + if err != nil { + t.Fatalf("Error creating id from did: %v", err) + } + + return &it +} + type NodeAuxValue struct { Key string Value string From bd3c040ed9727b396dd52cdc93918e816ea5792d Mon Sep 17 00:00:00 2001 From: vmidyllic <74898029+vmidyllic@users.noreply.github.com> Date: Fri, 8 Dec 2023 18:00:58 +0200 Subject: [PATCH 02/14] add right test generator to test validators --- .../contract_data/generate_json_test.go | 20 +- testvectorgen/contract_data/v3_test.go | 549 ++++++++++++++++++ .../credentials/onchain/v3/v3_test.go | 2 +- testvectorgen/credentials/v3/v3_test.go | 2 +- testvectorgen/go.mod | 6 +- testvectorgen/go.sum | 17 +- .../statetransition/stateTransition_test.go | 6 +- testvectorgen/utils/constants.go | 31 + testvectorgen/utils/utils.go | 38 ++ update-contract-data-v3.js | 55 ++ update-contract-data.js | 60 ++ 11 files changed, 760 insertions(+), 26 deletions(-) create mode 100644 testvectorgen/contract_data/v3_test.go create mode 100644 update-contract-data-v3.js create mode 100644 update-contract-data.js diff --git a/testvectorgen/contract_data/generate_json_test.go b/testvectorgen/contract_data/generate_json_test.go index 29f96c14..bfe09453 100644 --- a/testvectorgen/contract_data/generate_json_test.go +++ b/testvectorgen/contract_data/generate_json_test.go @@ -235,11 +235,11 @@ type TestDataSigV2 struct { func Test_Generate_Test_Cases(t *testing.T) { - id, issuerFirstState := generateStateTransitionData(t, false, IssuerPK, UserPK, "Issuer from genesis state", "issuer_genesis_state") - nextId, userFirstState := generateStateTransitionData(t, false, UserPK, IssuerPK, "User from genesis transition", "user_state_transition") + id, issuerFirstState := generateStateTransitionData(t, false, IssuerPK, UserPK, "Issuer from genesis state", "issuer_genesis_state", false) + nextId, userFirstState := generateStateTransitionData(t, false, UserPK, IssuerPK, "User from genesis transition", "user_state_transition", false) - generateStateTransitionData(t, true, IssuerPK, UserPK, "Issuer next transition state", "issuer_next_state_transition") - generateStateTransitionData(t, true, UserPK, IssuerPK, "User next transition state", "user_next_state_transition") + generateStateTransitionData(t, true, IssuerPK, UserPK, "Issuer next transition state", "issuer_next_state_transition", false) + generateStateTransitionData(t, true, UserPK, IssuerPK, "User next transition state", "user_next_state_transition", false) generateMTPData(t, "MTP: Issuer first state", []*gistData{ {id, issuerFirstState}, @@ -272,8 +272,9 @@ type gistData struct { state *big.Int } -func generateStateTransitionData(t *testing.T, nextState bool, primaryPK, secondaryPK, desc, fileName string) (*big.Int, *big.Int) { +func generateStateTransitionData(t *testing.T, nextState bool, primaryPK, secondaryPK, desc, fileName string, isSubjectIDProfile bool) (*big.Int, *big.Int) { + var err error primaryEntity := utils.NewIdentity(t, primaryPK) secondaryEntity := utils.NewIdentity(t, secondaryPK) @@ -291,7 +292,14 @@ func generateStateTransitionData(t *testing.T, nextState bool, primaryPK, second //if genesis == false { // extract pubKey - _, secondaryEntityClaim := utils.DefaultJSONUserClaim(t, secondaryEntity.ID) + subjectID := secondaryEntity.ID + if isSubjectIDProfile { + nonceSubject := big.NewInt(999) + subjectID, err = core.ProfileID(secondaryEntity.ID, nonceSubject) + require.NoError(t, err) + } + + _, secondaryEntityClaim := utils.DefaultJSONNormalUserClaim(t, subjectID) primaryEntity.AddClaim(t, secondaryEntityClaim) if nextState { diff --git a/testvectorgen/contract_data/v3_test.go b/testvectorgen/contract_data/v3_test.go new file mode 100644 index 00000000..9e2e8cc1 --- /dev/null +++ b/testvectorgen/contract_data/v3_test.go @@ -0,0 +1,549 @@ +package contractdata + +import ( + "context" + "encoding/json" + "math/big" + "strconv" + "testing" + + core "github.com/iden3/go-iden3-core/v2" + "github.com/iden3/go-iden3-crypto/babyjub" + "github.com/iden3/go-iden3-crypto/poseidon" + "github.com/iden3/go-merkletree-sql/v2" + "github.com/iden3/go-merkletree-sql/v2/db/memory" + "github.com/iden3/go-schema-processor/v2/merklize" + "github.com/iden3/go-schema-processor/v2/verifiable" + "github.com/stretchr/testify/require" + "test/utils" +) + +const ( + ethAddress = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" +) + +func Test_Generate_Test_CasesV3(t *testing.T) { + + issuerId, issuerFirstState := generateStateTransitionData(t, false, IssuerPK, UserPK, "Issuer from genesis state", "v3/issuer_genesis_state_v3", true) + //userId, userFirstState := generateStateTransitionData(t, false, UserPK, IssuerPK, "User from genesis transition", "user_state_transition") + + //generateStateTransitionData(t, true, IssuerPK, UserPK, "Issuer next transition state", "issuer_next_state_transition") + //generateStateTransitionData(t, true, UserPK, IssuerPK, "User next transition state", "user_next_state_transition") + + generateData(t, "BJJ: Issuer first state / user - genesis state", []*gistData{ + {issuerId, issuerFirstState}, + }, false, "v3/valid_bjj_user_genesis_v3", verifiable.BJJSignatureProofType, 1) + //generateMTPData(t, "MTP: User non genesis but latest", []*gistData{ + // {id, issuerFirstState}, + // {nextId, userFirstState}, + //}, true, "valid_mtp_user_non_genesis", false) + //generateMTPData(t, "MTP: User sign with address challenge genesis", []*gistData{ + // {id, issuerFirstState}, + // {nextId, userFirstState}, + //}, true, "valid_mtp_user_non_genesis_challenge_address", true) + // + //generateSigData(t, "Sig: Issuer first state", []*gistData{ + // {id, issuerFirstState}, + //}, false, "valid_sig_user_genesis", false) + //generateSigData(t, "Sig: User non genesis latest", []*gistData{ + // {id, issuerFirstState}, + // {nextId, userFirstState}, + //}, true, "valid_sig_user_non_genesis", false) + //generateSigData(t, "Sig: User sign with address challenge genesis", []*gistData{ + // {id, issuerFirstState}, + // {nextId, userFirstState}, + //}, true, "valid_sig_user_non_genesis_challenge_address", true) + +} + +func generateData(t *testing.T, desc string, gistData []*gistData, nextState bool, fileName string, testProofType verifiable.ProofType, authEnabled int) { + + var linkNonce = "18" + var nullifierSessionID string = "1234569" + operator := utils.LT + isRevocationChecked := 1 // checked + isJSONLD := true // merklized for now + var err error + + const isRevoked = false + const isSubjectIDProfile = true + + valueInput := utils.PrepareStrArray([]string{"20010101"}, 64) + + var user *utils.IdentityTest + + if authEnabled == 1 { + user = utils.NewIdentity(t, UserPK) + } else { + // generate onchain identity + user = utils.NewEthereumBasedIdentity(t, ethAddress) + } + issuer := utils.NewIdentity(t, IssuerPK) + + userProfileID := user.ID + nonce := big.NewInt(0) + + subjectID := user.ID + + var nonceSubject = new(big.Int) + if isSubjectIDProfile { + nonceSubject = big.NewInt(999) + subjectID, err = core.ProfileID(user.ID, nonceSubject) + require.NoError(t, err) + } + + var claim *core.Claim + var mz *merklize.Merklizer + var claimPathMtp []string + var claimPathMtpNoAux, claimPathMtpAuxHi, claimPathMtpAuxHv, claimPathKey, claimPathValue, merklized string + var pathKey *big.Int + var slotIndex int + + if isJSONLD { + mz, claim = utils.DefaultJSONNormalUserClaim(t, subjectID) + path, err := merklize.NewPath( + "https://www.w3.org/2018/credentials#credentialSubject", + "https://github.com/iden3/claim-schema-vocab/blob/main/credentials/kyc.md#birthday") + require.NoError(t, err) + jsonP, value, err := mz.Proof(context.Background(), path) + require.NoError(t, err) + valueKey, err := value.MtEntry() + require.NoError(t, err) + claimPathValue = valueKey.String() + + var claimJSONLDProofAux utils.NodeAuxValue + claimPathMtp, claimJSONLDProofAux = utils.PrepareProof(jsonP, utils.ClaimLevels) + claimPathMtpNoAux = claimJSONLDProofAux.NoAux + claimPathMtpAuxHi = claimJSONLDProofAux.Key + claimPathMtpAuxHv = claimJSONLDProofAux.Value + pathKey, err = path.MtEntry() + require.NoError(t, err) + claimPathKey = pathKey.String() + slotIndex = 0 + + //valueInput = utils.PrepareStrArray([]string{claimPathValue}, 64) + merklized = "1" + + } else { + claim = utils.DefaultUserClaim(t, subjectID) + claimPathMtp = utils.PrepareStrArray([]string{}, 32) + claimPathMtpNoAux = "0" + claimPathMtpAuxHi = "0" + claimPathMtpAuxHv = "0" + claimPathKey = "0" + claimPathValue = "0" + merklized = "0" + slotIndex = 2 + pathKey = big.NewInt(0) + } + if nextState { + _, claim1 := utils.DefaultJSONUserClaim(t, issuer.ID) + user.AddClaim(t, claim1) + } + if isRevoked { + revNonce := claim.GetRevocationNonce() + revNonceBigInt := new(big.Int).SetUint64(revNonce) + issuer.Ret.Add(context.Background(), revNonceBigInt, big.NewInt(0)) + } + + var issuerClaimMtp, issuerAuthClaimMtp []string + var issuerClaimClaimsTreeRoot, issuerClaimRevTreeRoot, issuerClaimRootsTreeRoot *merkletree.Hash + var issuerClaimSignatureR8X, issuerClaimSignatureR8Y, issuerClaimSignatureS, + issuerAuthClaimNonRevMtpAuxHi, issuerAuthClaimNonRevMtpAuxHv, issuerAuthClaimNonRevMtpNoAux, + issuerClaimIdenState, proofType, issuerAuthClaimsTreeRoot, + issuerAuthRevTreeRoot, issuerAuthRootsTreeRoot, issuerAuthState string + var issuerAuthClaim *core.Claim + if testProofType == verifiable.BJJSignatureProofType { + // Sig claim + claimSig := issuer.SignClaim(t, claim) + var issuerAuthClaimNodeAux utils.NodeAuxValue + issuerAuthClaimMtp, issuerAuthClaimNodeAux = issuer.ClaimRevMTP(t, issuer.AuthClaim) + + issuerClaimMtp = utils.PrepareStrArray([]string{}, 40) + issuerClaimClaimsTreeRoot = &merkletree.HashZero + issuerClaimRevTreeRoot = &merkletree.HashZero + issuerClaimRootsTreeRoot = &merkletree.HashZero + + issuerAuthClaimNonRevMtpAuxHi = issuerAuthClaimNodeAux.Key + issuerAuthClaimNonRevMtpAuxHv = issuerAuthClaimNodeAux.Value + issuerAuthClaimNonRevMtpNoAux = issuerAuthClaimNodeAux.NoAux + + issuerClaimSignatureR8X = claimSig.R8.X.String() + issuerClaimSignatureR8Y = claimSig.R8.Y.String() + issuerClaimSignatureS = claimSig.S.String() + + issuerAuthClaim = issuer.AuthClaim + + issuerClaimIdenState = "0" + + issuerAuthClaimsTreeRoot = issuer.Clt.Root().BigInt().String() + issuerAuthRevTreeRoot = issuer.Ret.Root().BigInt().String() + issuerAuthRootsTreeRoot = issuer.Rot.Root().BigInt().String() + + issuerAuthState = issuer.State(t).String() + + proofType = "1" + } else { + issuer.AddClaim(t, claim) + issuerClaimMtp, _ = issuer.ClaimMTP(t, claim) + issuerClaimIdenState = issuer.State(t).String() + + issuerClaimClaimsTreeRoot = issuer.Clt.Root() + issuerClaimRevTreeRoot = issuer.Ret.Root() + issuerClaimRootsTreeRoot = issuer.Rot.Root() + + issuerClaimSignatureR8X = "0" + issuerClaimSignatureR8Y = "0" + issuerClaimSignatureS = "0" + + issuerAuthClaimNonRevMtpAuxHi = "0" + issuerAuthClaimNonRevMtpAuxHv = "0" + issuerAuthClaimNonRevMtpNoAux = "0" + + issuerAuthClaimMtp = utils.PrepareStrArray([]string{}, 40) + + issuerAuthClaim = &core.Claim{} + + issuerAuthClaimsTreeRoot = "0" + issuerAuthRevTreeRoot = "0" + issuerAuthRootsTreeRoot = "0" + + issuerAuthState = "0" + + slotIndex = 2 + proofType = "2" + } + + issuerClaimNonRevMtp, issuerClaimNonRevAux := issuer.ClaimRevMTP(t, claim) + + gisTree, err := merkletree.NewMerkleTree(context.Background(), memory.NewMemoryStorage(), 64) + require.Nil(t, err) + + for _, data := range gistData { + idPoseidonHash, _ := poseidon.Hash([]*big.Int{data.id}) + err = gisTree.Add(context.Background(), idPoseidonHash, data.state) + require.Nil(t, err) + } + + var authMTProof []string + var challenge *big.Int + var authNonRevMTProof []string + var nodeAuxNonRev utils.NodeAuxValue + var sig *babyjub.Signature + var gistRoot *merkletree.Hash + var gistProof []string + var gistNodeAux utils.NodeAuxValue + // user + if authEnabled == 1 { + challenge = big.NewInt(12345) + authMTProof = user.AuthMTPStrign(t) + authNonRevMTProof, nodeAuxNonRev = user.ClaimRevMTP(t, user.AuthClaim) + sig = user.Sign(challenge) + gistProofRaw, _, err := gisTree.GenerateProof(context.Background(), user.IDHash(t), nil) + require.NoError(t, err) + gistRoot = gisTree.Root() + gistProof, gistNodeAux = utils.PrepareProof(gistProofRaw, utils.GistLevels) + + } else { + + emptyArr := make([]*merkletree.Hash, 0) + authMTProof = utils.PrepareSiblingsStr(emptyArr, utils.IdentityTreeLevels) + authNonRevMTProof = utils.PrepareSiblingsStr(emptyArr, utils.IdentityTreeLevels) + nodeAuxNonRev = utils.NodeAuxValue{ + Key: merkletree.HashZero.String(), + Value: merkletree.HashZero.String(), + NoAux: "0", + } + sig = &babyjub.Signature{ + R8: &babyjub.Point{ + X: new(big.Int), + Y: new(big.Int), + }, + S: new(big.Int), + } + + gistRoot = &merkletree.HashZero + gistProof = utils.PrepareSiblingsStr(emptyArr, utils.GistLevels) + gistNodeAux = utils.NodeAuxValue{ + Key: merkletree.HashZero.String(), + Value: merkletree.HashZero.String(), + NoAux: "0", + } + } + + inputs := Inputs{ + RequestID: requestID, + UserGenesisID: user.ID.BigInt().String(), + ProfileNonce: nonce.String(), + UserAuthClaim: user.AuthClaim, + UserAuthClaimMtp: authMTProof, + UserAuthClaimNonRevMtp: authNonRevMTProof, + UserAuthClaimNonRevMtpAuxHi: nodeAuxNonRev.Key, + UserAuthClaimNonRevMtpAuxHv: nodeAuxNonRev.Value, + UserAuthClaimNonRevMtpNoAux: nodeAuxNonRev.NoAux, + Challenge: challenge.String(), + ChallengeSignatureR8X: sig.R8.X.String(), + ChallengeSignatureR8Y: sig.R8.Y.String(), + ChallengeSignatureS: sig.S.String(), + UserClaimsTreeRoot: user.Clt.Root().BigInt().String(), + UserRevTreeRoot: user.Ret.Root().BigInt().String(), + UserRootsTreeRoot: user.Rot.Root().BigInt().String(), + UserState: user.State(t).String(), + GistRoot: gistRoot.BigInt().String(), + GistMtp: gistProof, + GistMtpAuxHi: gistNodeAux.Key, + GistMtpAuxHv: gistNodeAux.Value, + GistMtpNoAux: gistNodeAux.NoAux, + ClaimSubjectProfileNonce: nonceSubject.String(), + IssuerID: issuer.ID.BigInt().String(), + IssuerClaim: claim, + IssuerClaimMtp: issuerClaimMtp, + IssuerClaimClaimsTreeRoot: issuerClaimClaimsTreeRoot, + IssuerClaimRevTreeRoot: issuerClaimRevTreeRoot, + IssuerClaimRootsTreeRoot: issuerClaimRootsTreeRoot, + IssuerClaimIdenState: issuerClaimIdenState, + IssuerClaimNonRevClaimsTreeRoot: issuer.Clt.Root(), + IssuerClaimNonRevRevTreeRoot: issuer.Ret.Root(), + IssuerClaimNonRevRootsTreeRoot: issuer.Rot.Root(), + IssuerClaimNonRevState: issuer.State(t).String(), + IssuerClaimNonRevMtp: issuerClaimNonRevMtp, + IssuerClaimNonRevMtpAuxHi: issuerClaimNonRevAux.Key, + IssuerClaimNonRevMtpAuxHv: issuerClaimNonRevAux.Value, + IssuerClaimNonRevMtpNoAux: issuerClaimNonRevAux.NoAux, + ClaimSchema: "267831521922558027206082390043321796944", + ClaimPathNotExists: "0", // 0 for inclusion, 1 for non-inclusion + ClaimPathMtp: claimPathMtp, + ClaimPathMtpNoAux: claimPathMtpNoAux, + ClaimPathMtpAuxHi: claimPathMtpAuxHi, + ClaimPathMtpAuxHv: claimPathMtpAuxHv, + ClaimPathKey: claimPathKey, + ClaimPathValue: claimPathValue, + IsRevocationChecked: isRevocationChecked, + Operator: operator, + SlotIndex: slotIndex, + Timestamp: timestamp, + Value: valueInput, + + IssuerClaimSignatureR8X: issuerClaimSignatureR8X, + IssuerClaimSignatureR8Y: issuerClaimSignatureR8Y, + IssuerClaimSignatureS: issuerClaimSignatureS, + IssuerAuthClaim: issuerAuthClaim, + IssuerAuthClaimMtp: issuerAuthClaimMtp, + IssuerAuthClaimNonRevMtp: issuerAuthClaimMtp, + IssuerAuthClaimNonRevMtpAuxHi: issuerAuthClaimNonRevMtpAuxHi, + IssuerAuthClaimNonRevMtpAuxHv: issuerAuthClaimNonRevMtpAuxHv, + IssuerAuthClaimNonRevMtpNoAux: issuerAuthClaimNonRevMtpNoAux, + IssuerAuthClaimsTreeRoot: issuerAuthClaimsTreeRoot, + IssuerAuthRevTreeRoot: issuerAuthRevTreeRoot, + IssuerAuthRootsTreeRoot: issuerAuthRootsTreeRoot, + IssuerAuthState: issuerAuthState, + + LinkNonce: linkNonce, + + ProofType: proofType, + + VerifierID: "21929109382993718606847853573861987353620810345503358891473103689157378049", + NullifierSessionID: nullifierSessionID, + AuthEnabled: authEnabled, + } + + valuesHash, err := utils.PoseidonHashValue(utils.FromStringArrayToBigIntArray(inputs.Value)) + require.NoError(t, err) + claimSchemaInt, ok := big.NewInt(0).SetString(inputs.ClaimSchema, 10) + require.True(t, ok) + circuitQueryHash, err := poseidon.Hash([]*big.Int{ + claimSchemaInt, + big.NewInt(int64(inputs.SlotIndex)), + big.NewInt(int64(inputs.Operator)), + pathKey, + big.NewInt(0), + valuesHash, + }) + require.NoError(t, err) + + linkID, err := utils.CalculateLinkID(linkNonce, claim) + require.NoError(t, err) + + operatorOutput := "0" + nullifier := "0" + if inputs.NullifierSessionID != "0" { + claimSchema, ok := big.NewInt(0).SetString(inputs.ClaimSchema, 10) + require.True(t, ok) + + verifierID, ok := big.NewInt(0).SetString(inputs.VerifierID, 10) + require.True(t, ok) + + nullifierSessionID_, ok := big.NewInt(0).SetString(inputs.NullifierSessionID, 10) + require.True(t, ok) + + nullifier, err = utils.CalculateNullify( + user.ID.BigInt(), + nonceSubject, + claimSchema, + verifierID, + nullifierSessionID_, + ) + require.NoError(t, err) + } + + if operator == utils.SD { + operatorOutput = big.NewInt(10).String() + } + + var issuerState string + if proofType == "1" { + // sig + issuerState = issuerAuthState + } else { + // mtp + issuerState = issuerClaimIdenState + } + + out := Outputs{ + RequestID: requestID, + UserID: userProfileID.BigInt().String(), + IssuerID: issuer.ID.BigInt().String(), + IssuerClaimNonRevState: issuer.State(t).String(), + CircuitQueryHash: circuitQueryHash.String(), + Timestamp: timestamp, + Merklized: merklized, + Challenge: challenge.String(), + GistRoot: gistRoot.BigInt().String(), + IsRevocationChecked: strconv.Itoa(isRevocationChecked), + ProofType: proofType, + IssuerState: issuerState, + LinkID: linkID, + OperatorOutput: operatorOutput, + VerifierID: inputs.VerifierID, + NullifierSessionID: inputs.NullifierSessionID, + Nullifier: nullifier, + AuthEnabled: strconv.Itoa(authEnabled), + } + + jsonData, err := json.Marshal(TestData{ + desc, + inputs, + out, + }) + require.NoError(t, err) + + utils.SaveTestVector(t, fileName, string(jsonData)) +} + +type Inputs struct { + RequestID string `json:"requestID"` + + // user data + UserGenesisID string `json:"userGenesisID"` // + ProfileNonce string `json:"profileNonce"` // + ClaimSubjectProfileNonce string `json:"claimSubjectProfileNonce"` // + + UserAuthClaim *core.Claim `json:"authClaim"` + UserAuthClaimMtp []string `json:"authClaimIncMtp"` + UserAuthClaimNonRevMtp []string `json:"authClaimNonRevMtp"` + UserAuthClaimNonRevMtpAuxHi string `json:"authClaimNonRevMtpAuxHi"` + UserAuthClaimNonRevMtpAuxHv string `json:"authClaimNonRevMtpAuxHv"` + UserAuthClaimNonRevMtpNoAux string `json:"authClaimNonRevMtpNoAux"` + Challenge string `json:"challenge"` + ChallengeSignatureR8X string `json:"challengeSignatureR8x"` + ChallengeSignatureR8Y string `json:"challengeSignatureR8y"` + ChallengeSignatureS string `json:"challengeSignatureS"` + UserClaimsTreeRoot string `json:"userClaimsTreeRoot"` + UserRevTreeRoot string `json:"userRevTreeRoot"` + UserRootsTreeRoot string `json:"userRootsTreeRoot"` + UserState string `json:"userState"` + GistRoot string `json:"gistRoot"` + GistMtp []string `json:"gistMtp"` + GistMtpAuxHi string `json:"gistMtpAuxHi"` + GistMtpAuxHv string `json:"gistMtpAuxHv"` + GistMtpNoAux string `json:"gistMtpNoAux"` + + IssuerID string `json:"issuerID"` + // Claim + IssuerClaim *core.Claim `json:"issuerClaim"` + // Inclusion + IssuerClaimMtp []string `json:"issuerClaimMtp"` + IssuerClaimClaimsTreeRoot *merkletree.Hash `json:"issuerClaimClaimsTreeRoot"` + IssuerClaimRevTreeRoot *merkletree.Hash `json:"issuerClaimRevTreeRoot"` + IssuerClaimRootsTreeRoot *merkletree.Hash `json:"issuerClaimRootsTreeRoot"` + IssuerClaimIdenState string `json:"issuerClaimIdenState"` + + IsRevocationChecked int `json:"isRevocationChecked"` + IssuerClaimNonRevClaimsTreeRoot *merkletree.Hash `json:"issuerClaimNonRevClaimsTreeRoot"` + IssuerClaimNonRevRevTreeRoot *merkletree.Hash `json:"issuerClaimNonRevRevTreeRoot"` + IssuerClaimNonRevRootsTreeRoot *merkletree.Hash `json:"issuerClaimNonRevRootsTreeRoot"` + IssuerClaimNonRevState string `json:"issuerClaimNonRevState"` + IssuerClaimNonRevMtp []string `json:"issuerClaimNonRevMtp"` + IssuerClaimNonRevMtpAuxHi string `json:"issuerClaimNonRevMtpAuxHi"` + IssuerClaimNonRevMtpAuxHv string `json:"issuerClaimNonRevMtpAuxHv"` + IssuerClaimNonRevMtpNoAux string `json:"issuerClaimNonRevMtpNoAux"` + + ClaimSchema string `json:"claimSchema"` + + // Query + // JSON path + ClaimPathNotExists string `json:"claimPathNotExists"` // 0 for inclusion, 1 for non-inclusion + ClaimPathMtp []string `json:"claimPathMtp"` + ClaimPathMtpNoAux string `json:"claimPathMtpNoAux"` // 1 if aux node is empty, 0 if non-empty or for inclusion proofs + ClaimPathMtpAuxHi string `json:"claimPathMtpAuxHi"` // 0 for inclusion proof + ClaimPathMtpAuxHv string `json:"claimPathMtpAuxHv"` // 0 for inclusion proof + ClaimPathKey string `json:"claimPathKey"` // hash of path in merklized json-ld document + ClaimPathValue string `json:"claimPathValue"` // value in this path in merklized json-ld document + + Operator int `json:"operator"` + SlotIndex int `json:"slotIndex"` + Timestamp string `json:"timestamp"` + Value []string `json:"value"` + + // additional sig inputs + IssuerClaimSignatureR8X string `json:"issuerClaimSignatureR8x"` + IssuerClaimSignatureR8Y string `json:"issuerClaimSignatureR8y"` + IssuerClaimSignatureS string `json:"issuerClaimSignatureS"` + IssuerAuthClaim *core.Claim `json:"issuerAuthClaim"` + IssuerAuthClaimMtp []string `json:"issuerAuthClaimMtp"` + IssuerAuthClaimNonRevMtp []string `json:"issuerAuthClaimNonRevMtp"` + IssuerAuthClaimNonRevMtpAuxHi string `json:"issuerAuthClaimNonRevMtpAuxHi"` + IssuerAuthClaimNonRevMtpAuxHv string `json:"issuerAuthClaimNonRevMtpAuxHv"` + IssuerAuthClaimNonRevMtpNoAux string `json:"issuerAuthClaimNonRevMtpNoAux"` + IssuerAuthClaimsTreeRoot string `json:"issuerAuthClaimsTreeRoot"` + IssuerAuthRevTreeRoot string `json:"issuerAuthRevTreeRoot"` + IssuerAuthRootsTreeRoot string `json:"issuerAuthRootsTreeRoot"` + IssuerAuthState string `json:"issuerAuthState"` + + ProofType string `json:"proofType"` // 1 for sig, 2 for mtp + + // Private random nonce, used to generate LinkID + LinkNonce string `json:"linkNonce"` + + VerifierID string `json:"verifierID"` + NullifierSessionID string `json:"nullifierSessionID"` + + AuthEnabled int `json:"authEnabled"` +} + +type Outputs struct { + RequestID string `json:"requestID"` + UserID string `json:"userID"` + IssuerID string `json:"issuerID"` + IssuerClaimNonRevState string `json:"issuerClaimNonRevState"` + CircuitQueryHash string `json:"circuitQueryHash"` + GistRoot string `json:"gistRoot"` + Timestamp string `json:"timestamp"` + Merklized string `json:"merklized"` + ProofType string `json:"proofType"` // 1 for sig, 2 for mtp + IsRevocationChecked string `json:"isRevocationChecked"` + Challenge string `json:"challenge"` + IssuerState string `json:"issuerState"` + LinkID string `json:"linkID"` + VerifierID string `json:"verifierID"` + NullifierSessionID string `json:"nullifierSessionID"` + OperatorOutput string `json:"operatorOutput"` + Nullifier string `json:"nullifier"` + AuthEnabled string `json:"authEnabled"` +} + +type TestData struct { + Desc string `json:"desc"` + In Inputs `json:"inputs"` + Out Outputs `json:"expOut"` +} diff --git a/testvectorgen/credentials/onchain/v3/v3_test.go b/testvectorgen/credentials/onchain/v3/v3_test.go index aa88b51e..e2ec8b30 100644 --- a/testvectorgen/credentials/onchain/v3/v3_test.go +++ b/testvectorgen/credentials/onchain/v3/v3_test.go @@ -317,7 +317,7 @@ func generateTestDataWithOperatorAndRevCheck(t *testing.T, desc string, isUserID user = utils.NewIdentity(t, userPK) } else { // generate onchain identity - user = utils.NewEthereumBasedIdentity(t, "ethereum address") + user = utils.NewEthereumBasedIdentity(t, ethAddress) } issuer := utils.NewIdentity(t, issuerPK) diff --git a/testvectorgen/credentials/v3/v3_test.go b/testvectorgen/credentials/v3/v3_test.go index d7ed7b1f..2c7e924e 100644 --- a/testvectorgen/credentials/v3/v3_test.go +++ b/testvectorgen/credentials/v3/v3_test.go @@ -262,7 +262,7 @@ func generateTestDataWithOperator(t *testing.T, desc string, isUserIDProfile, is } func generateJSONLDTestData(t *testing.T, desc string, isUserIDProfile, isSubjectIDProfile bool, fileName string, proofType ProofType) { - generateTestDataWithOperatorAndRevCheck(t, desc, isUserIDProfile, isSubjectIDProfile, "0", "0", fileName, utils.EQ, nil, false, 1, true, proofType) + generateTestDataWithOperatorAndRevCheck(t, desc, isUserIDProfile, isSubjectIDProfile, "0", "0", fileName, utils.LT, nil, false, 1, true, proofType) } func generateTestDataWithOperatorAndRevCheck(t *testing.T, desc string, isUserIDProfile, isSubjectIDProfile bool, diff --git a/testvectorgen/go.mod b/testvectorgen/go.mod index 154427d2..1d7e8dca 100644 --- a/testvectorgen/go.mod +++ b/testvectorgen/go.mod @@ -3,6 +3,7 @@ module test go 1.18 require ( + github.com/iden3/go-iden3-core v1.0.2 github.com/iden3/go-iden3-core/v2 v2.0.0 github.com/iden3/go-iden3-crypto v0.0.15 github.com/iden3/go-merkletree-sql/v2 v2.0.6 @@ -10,10 +11,7 @@ require ( github.com/stretchr/testify v1.8.4 ) -require ( - github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect - github.com/holiman/uint256 v1.2.3 // indirect -) +require github.com/pkg/errors v0.9.1 // indirect require ( github.com/benbjohnson/clock v1.3.5 // indirect diff --git a/testvectorgen/go.sum b/testvectorgen/go.sum index 184a1d09..1fe891b0 100644 --- a/testvectorgen/go.sum +++ b/testvectorgen/go.sum @@ -1,7 +1,5 @@ github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= -github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927 h1:SKI1/fuSdodxmNNyVBR8d7X/HuLnRpvvFO0AgyQk764= github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 h1:HVTnpeuvF6Owjd5mniCL8DEXo7uYXdQEmOP4FJbV5tg= github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3/go.mod h1:p1d6YEZWvFzEh4KLyvBcVSnrfNDDvK2zfK/4x2v/4pE= @@ -13,15 +11,13 @@ github.com/dchest/blake512 v1.0.0/go.mod h1:FV1x7xPPLWukZlpDpWQ88rF/SFwZ5qbskrzh github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= -github.com/ethereum/go-ethereum v1.10.26 h1:i/7d9RBBwiXCEuyduBQzJw/mKmnvzsN14jqBmytw72s= -github.com/ethereum/go-ethereum v1.10.26/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= github.com/ethereum/go-ethereum v1.13.5 h1:U6TCRciCqZRe4FPXmy1sMGxTfuk8P7u2UoinF3VbaFk= github.com/ethereum/go-ethereum v1.13.5/go.mod h1:yMTu38GSuyxaYzQMViqNmQ1s3cE84abZexQmTgenWk0= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o= -github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/iden3/go-iden3-core v1.0.2 h1:HwNDFeqcUv4ybZj5tH+58JKWKarn/qqBpNCqTLxGP0Y= +github.com/iden3/go-iden3-core v1.0.2/go.mod h1:X4PjlJG8OsEQEsSbzzYqqAk2olYGZ2nuGqiUPyEYjOo= github.com/iden3/go-iden3-core/v2 v2.0.0 h1:sQEuuq3RLfyYSY8qPiqxQ6YBpGbiAwepHJD/vjf1adA= github.com/iden3/go-iden3-core/v2 v2.0.0/go.mod h1:L9PxhWPvoS9qTb3inEkZBm1RpjHBt+VTwvxssdzbAdw= github.com/iden3/go-iden3-crypto v0.0.15 h1:4MJYlrot1l31Fzlo2sF56u7EVFeHHJkxGXXZCtESgK4= @@ -69,6 +65,8 @@ github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/n github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= github.com/piprate/json-gold v0.5.1-0.20230111113000-6ddbe6e6f19f h1:HlPa7RcxTCrva5izPfTEfvYecO7LTahgmMRD1Qp13xg= github.com/piprate/json-gold v0.5.1-0.20230111113000-6ddbe6e6f19f/go.mod h1:WZ501QQMbZZ+3pXFPhQKzNwS1+jls0oqov3uQ2WasLs= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pquerna/cachecontrol v0.1.0 h1:yJMy84ti9h/+OEWa752kBTKv4XC30OtVVHYv/8cTqKc= @@ -81,17 +79,12 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/whyrusleeping/tar-utils v0.0.0-20201201191210-20a61371de5b h1:wA3QeTsaAXybLL2kb2cKhCAQTHgYTMwuI8lBlJSv5V8= github.com/whyrusleeping/tar-utils v0.0.0-20201201191210-20a61371de5b/go.mod h1:xT1Y5p2JR2PfSZihE0s4mjdJaRGp1waCTf5JzhQLBck= -golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= diff --git a/testvectorgen/statetransition/stateTransition_test.go b/testvectorgen/statetransition/stateTransition_test.go index b56969d5..21f735ff 100644 --- a/testvectorgen/statetransition/stateTransition_test.go +++ b/testvectorgen/statetransition/stateTransition_test.go @@ -13,8 +13,10 @@ import ( ) const ( - userPK = "28156abe7fe2fd433dc9df969286b96666489bac508612d0e16593e944c4f69e" - userPK2 = "28156abe7fe2fd433dc9df969286b96666489bac508612d0e16593e944c4f69d" + userPK = "28156abe7fe2fd433dc9df969286b96666489bac508612d0e16593e944c4f69e" + userPK2 = "28156abe7fe2fd433dc9df969286b96666489bac508612d0e16593e944c4f69d" + ethAddress = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" + timestamp = "1642074362" ) diff --git a/testvectorgen/utils/constants.go b/testvectorgen/utils/constants.go index 4d759ed5..e6634a38 100644 --- a/testvectorgen/utils/constants.go +++ b/testvectorgen/utils/constants.go @@ -53,6 +53,37 @@ const TestClaimDocument = `{ } }` +const TestNormalClaimDocument = ` +{ + "id": "urn:uuid:97fbd3d0-8eb7-11ee-8085-a27b3ddbdc29", + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://schema.iden3.io/core/jsonld/iden3proofs.jsonld", + "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json-ld/kyc-v4.jsonld" + ], + "type": [ + "VerifiableCredential", + "KYCAgeCredential" + ], + "expirationDate": "2361-03-21T21:14:48+02:00", + "issuanceDate": "2023-11-29T15:02:47.508637+02:00", + "credentialSubject": { + "birthday": 19960424, + "documentType": 2, + "id": "did:polygonid:polygon:mumbai:2qDAxLyxvGaGqBLmoDHwohHjtevVdYvpnWcYiK6AcK", + "type": "KYCAgeCredential" + }, + "credentialStatus": { + "id": "http://localhost:8001/api/v1/identities/did%3Apolygonid%3Apolygon%3Amumbai%3A2qGF2TDJZLxzNU1mP3x5PwcUF43vMgdrhRQhaM2HnG/claims/revocation/status/239691578", + "revocationNonce": 239691578, + "type": "SparseMerkleTreeProof" + }, + "issuer": "did:polygonid:polygon:mumbai:2qGF2TDJZLxzNU1mP3x5PwcUF43vMgdrhRQhaM2HnG", + "credentialSchema": { + "id": "https://raw.githubusercontent.com/iden3/claim-schema-vocab/test/cred-array/schemas/json/KYCAgeCredential-v4-arr-list.json", + "type": "JsonSchema2023" + }}` + const ( IdentityTreeLevels = 40 GistLevels = 64 diff --git a/testvectorgen/utils/utils.go b/testvectorgen/utils/utils.go index 9e0a59e3..0e73dbb2 100644 --- a/testvectorgen/utils/utils.go +++ b/testvectorgen/utils/utils.go @@ -59,6 +59,44 @@ func DefaultJSONUserClaim(t testing.TB, subject core.ID) (*merklize.Merklizer, * return mz, claim } +func DefaultJSONNormalUserClaim(t testing.TB, subject core.ID) (*merklize.Merklizer, *core.Claim) { + opts := loaders.WithEmbeddedDocumentBytes(w3cSchemaURL, w3cSchemaBody) + memoryCacheEngine, err := loaders.NewMemoryCacheEngine(opts) + if err != nil { + log.Fatalf("failed init memory cache engine: %v", err) + } + documentLoader := loaders.NewDocumentLoader(nil, "https://ipfs.io/", + loaders.WithCacheEngine(memoryCacheEngine)) + + merklizeOpts := []merklize.MerklizeOption{ + merklize.WithDocumentLoader(documentLoader), + } + mz, err := merklize.MerklizeJSONLD(context.Background(), strings.NewReader(TestNormalClaimDocument), merklizeOpts...) + if err != nil { + t.Fatalf("failed marklize claim: %v", err) + } + + schemaHash, err := core.NewSchemaHashFromHex("508991bcf0336ba99935ef498d797ec9") + if err != nil { + t.Fatalf("failed marklize claim: %v", err) + } + + nonce := 10 + + claim, err := core.NewClaim( + schemaHash, + core.WithIndexID(subject), + core.WithExpirationDate(time.Unix(1669884010, 0)), //Thu Dec 01 2022 08:40:10 GMT+0000 + core.WithRevocationNonce(uint64(nonce)), + core.WithIndexMerklizedRoot(mz.Root().BigInt())) + + if err != nil { + t.Fatalf("failed generate core claim %v", err) + } + + return mz, claim +} + func DefaultUserClaim(t testing.TB, subject core.ID) *core.Claim { dataSlotA, err := core.NewElemBytesFromInt(big.NewInt(10)) if err != nil { diff --git a/update-contract-data-v3.js b/update-contract-data-v3.js new file mode 100644 index 00000000..b785359d --- /dev/null +++ b/update-contract-data-v3.js @@ -0,0 +1,55 @@ +const dataFolder = './testvectorgen/contract_data/testdata/v3'; +const contractDataBaseFolder = '../contracts/test/validators/'; +const buildFolder = './build/'; +const fs = require('fs'); +const path = require('path'); +const { execSync, execFileSync } = require('child_process'); + +const files = fs.readdirSync(dataFolder); + +let circuitName = null; +let destinationFolder = null; +for (const file of files) { + + + if (file.includes('state')) { + circuitName = 'stateTransition' + destinationFolder = 'common-data' + } else { + circuitName = 'credentialAtomicQueryV3OnChain' + destinationFolder = 'v3/data' + } + const buildPath = `./build/${circuitName}/${circuitName}_js/`; + ['input.json', 'public.json', 'proof.json'].forEach((f) => { + const p = path.join(`./build/${circuitName}/${circuitName}_js`, f) + fs.existsSync(p) && + fs.unlinkSync(p); + console.log(`Deleted file: ${p}`); + }); + const { inputs } = require(`${dataFolder}/${file}`); + console.log(`Reading file: ${dataFolder}/${file}`); + + console.log(`Creating file: ${buildPath}/input.json`); + fs.writeFileSync(`${buildPath}/input.json`, JSON.stringify(inputs), 'utf-8'); + const child = execSync(`./generate.sh ${circuitName}`); + console.log(`execution completed`, new TextDecoder().decode(child)); + const pub_signals = JSON.parse(fs.readFileSync(`${buildPath}/public.json`).toString()); + console.log(pub_signals); + const proof = JSON.parse(fs.readFileSync(`${buildPath}/proof.json`).toString()); + console.log('Writing file: ', `${contractDataBaseFolder}/${destinationFolder}/${file}`); + fs.writeFileSync(`${contractDataBaseFolder}/${destinationFolder}/${file}`, JSON.stringify({ + pub_signals, + proof + }), 'utf-8'); + +} +// +// console.log('UPDATE verifiers'); +// for (const part of ['MTP', 'Sig']) { +// const circuitName = `credentialAtomicQuery${part}V2OnChain`; +// const contractName = `${buildFolder}${circuitName}/verifier.sol`; +// const contractContent = fs.readFileSync(contractName).toString(); +// const newContractContent = contractContent.replace('pragma solidity ^0.6.11;', 'pragma solidity ^0.8.0;').replace('contract Verifier', 'contract Verifier' + part); +// fs.writeFileSync(`../contracts/contracts/lib/verifier${part}.sol`, newContractContent, 'utf-8'); +// } +console.log('Done'); diff --git a/update-contract-data.js b/update-contract-data.js new file mode 100644 index 00000000..099a5e55 --- /dev/null +++ b/update-contract-data.js @@ -0,0 +1,60 @@ +const dataFolder = './testvectorgen/contract_data/testdata/v3'; +const contractDataBaseFolder = '../contracts/test/validators/v'; +const buildFolder = './build/'; +const fs = require('fs'); +const path = require('path'); +const { execSync, execFileSync } = require('child_process'); + +const files = fs.readdirSync(dataFolder); + +let circuitName = null; +let destinationFolder = null; +for (const file of files) { + + + if (file.includes('state')) { + circuitName = 'stateTransition' + destinationFolder = 'common-data' + } else if (file.includes('sig')) { + circuitName = 'credentialAtomicQuerySigV2OnChain' + destinationFolder = 'sig/data' + } else if (file.includes('mtp')) { + circuitName = 'credentialAtomicQueryMTPV2OnChain' + destinationFolder = 'mtp/data' + } else { + throw new Error('unknown circuit') + } + const buildPath = `./build/${circuitName}/${circuitName}_js/`; + ['input.json', 'public.json', 'proof.json'].forEach((f) => { + const p = path.join(`./build/${circuitName}/${circuitName}_js`, f) + fs.existsSync(p) && + fs.unlinkSync(p); + console.log(`Deleted file: ${p}`); + }); + const { inputs } = require(`${dataFolder}/${file}`); + console.log(`Reading file: ${dataFolder}/${file}`); + + console.log(`Creating file: ${buildPath}/input.json`); + fs.writeFileSync(`${buildPath}/input.json`, JSON.stringify(inputs), 'utf-8'); + const child = execSync(`./generate.sh ${circuitName}`); + console.log(`execution completed`, new TextDecoder().decode(child)); + const pub_signals = JSON.parse(fs.readFileSync(`${buildPath}/public.json`).toString()); + console.log(pub_signals); + const proof = JSON.parse(fs.readFileSync(`${buildPath}/proof.json`).toString()); + console.log('Writing file: ', `${contractDataBaseFolder}/${destinationFolder}/${file}`); + fs.writeFileSync(`${contractDataBaseFolder}/${destinationFolder}/${file}`, JSON.stringify({ + pub_signals, + proof + }), 'utf-8'); + +} + +console.log('UPDATE verifiers'); +for (const part of ['MTP', 'Sig']) { + const circuitName = `credentialAtomicQuery${part}V2OnChain`; + const contractName = `${buildFolder}${circuitName}/verifier.sol`; + const contractContent = fs.readFileSync(contractName).toString(); + const newContractContent = contractContent.replace('pragma solidity ^0.6.11;', 'pragma solidity ^0.8.0;').replace('contract Verifier', 'contract Verifier' + part); + fs.writeFileSync(`../contracts/contracts/lib/verifier${part}.sol`, newContractContent, 'utf-8'); +} +console.log('Done'); From 3ef4f7ea8576380441721152d106cc1d53745d84 Mon Sep 17 00:00:00 2001 From: vmidyllic <74898029+vmidyllic@users.noreply.github.com> Date: Mon, 11 Dec 2023 21:11:10 +0200 Subject: [PATCH 03/14] iteration 2; tests revocation state --- testvectorgen/contract_data/v3_test.go | 143 +++++++++++++++---------- 1 file changed, 87 insertions(+), 56 deletions(-) diff --git a/testvectorgen/contract_data/v3_test.go b/testvectorgen/contract_data/v3_test.go index 9e2e8cc1..d6ec812f 100644 --- a/testvectorgen/contract_data/v3_test.go +++ b/testvectorgen/contract_data/v3_test.go @@ -24,19 +24,35 @@ const ( func Test_Generate_Test_CasesV3(t *testing.T) { - issuerId, issuerFirstState := generateStateTransitionData(t, false, IssuerPK, UserPK, "Issuer from genesis state", "v3/issuer_genesis_state_v3", true) - //userId, userFirstState := generateStateTransitionData(t, false, UserPK, IssuerPK, "User from genesis transition", "user_state_transition") + // genesis => first => second + issuerId, issuerFirstState := generateStateTransitionData(t, false, IssuerPK, UserPK, "Issuer from genesis to first state transition", "v3/issuer_from_genesis_state_to_first_transition_v3", true) + userId, userFirstState := generateStateTransitionData(t, false, UserPK, IssuerPK, "User from genesis transition", "v3/user_from_genesis_state_to_first_transition_v3", false) - //generateStateTransitionData(t, true, IssuerPK, UserPK, "Issuer next transition state", "issuer_next_state_transition") - //generateStateTransitionData(t, true, UserPK, IssuerPK, "User next transition state", "user_next_state_transition") + _, issuerSecondState := generateStateTransitionData(t, true, IssuerPK, UserPK, "Issuer from first to second transition", "v3/issuer_from_first_state_to_second_transition_v3", true) + _, userSecondState := generateStateTransitionData(t, true, UserPK, IssuerPK, "User from first to second transition", "v3/user_from_first_state_to_second_transition_v3", false) generateData(t, "BJJ: Issuer first state / user - genesis state", []*gistData{ {issuerId, issuerFirstState}, - }, false, "v3/valid_bjj_user_genesis_v3", verifiable.BJJSignatureProofType, 1) - //generateMTPData(t, "MTP: User non genesis but latest", []*gistData{ - // {id, issuerFirstState}, - // {nextId, userFirstState}, - //}, true, "valid_mtp_user_non_genesis", false) + }, false, false, false, "v3/valid_bjj_user_genesis_v3", verifiable.BJJSignatureProofType, 1) + + generateData(t, "BJJ: Issuer first state / user first state - valid proof", []*gistData{ + + {issuerId, issuerFirstState}, + {userId, userFirstState}, + }, true, false, false, "v3/valid_bjj_user_first_v3", verifiable.BJJSignatureProofType, 1) + + generateData(t, "BJJ: Issuer second state / user first state - valid proof", []*gistData{ + + {userId, userFirstState}, + {issuerId, issuerSecondState}, + }, true, false, true, "v3/valid_bjj_user_first_issuer_second_v3", verifiable.BJJSignatureProofType, 1) + + generateData(t, "BJJ: Issuer first state / user second state - valid proof", []*gistData{ + + {userId, userSecondState}, + {issuerId, issuerSecondState}, + }, true, true, false, "v3/valid_bjj_user_second_issuer_first_v3", verifiable.BJJSignatureProofType, 1) + //generateMTPData(t, "MTP: User sign with address challenge genesis", []*gistData{ // {id, issuerFirstState}, // {nextId, userFirstState}, @@ -56,7 +72,7 @@ func Test_Generate_Test_CasesV3(t *testing.T) { } -func generateData(t *testing.T, desc string, gistData []*gistData, nextState bool, fileName string, testProofType verifiable.ProofType, authEnabled int) { +func generateData(t *testing.T, desc string, gistData []*gistData, userFirstState bool, userSecondState bool, issuerSecondState bool, fileName string, testProofType verifiable.ProofType, authEnabled int) { var linkNonce = "18" var nullifierSessionID string = "1234569" @@ -136,37 +152,68 @@ func generateData(t *testing.T, desc string, gistData []*gistData, nextState boo slotIndex = 2 pathKey = big.NewInt(0) } - if nextState { - _, claim1 := utils.DefaultJSONUserClaim(t, issuer.ID) + + if userFirstState { + _, claim1 := utils.DefaultJSONNormalUserClaim(t, issuer.ID) user.AddClaim(t, claim1) + + if userSecondState { + claim2 := utils.DefaultUserClaim(t, user.ID) + user.AddClaim(t, claim2) + } } + if isRevoked { revNonce := claim.GetRevocationNonce() revNonceBigInt := new(big.Int).SetUint64(revNonce) issuer.Ret.Add(context.Background(), revNonceBigInt, big.NewInt(0)) } - var issuerClaimMtp, issuerAuthClaimMtp []string + var issuerClaimMtp, issuerAuthClaimMtp, issuerAuthClaimNonRevMtp []string var issuerClaimClaimsTreeRoot, issuerClaimRevTreeRoot, issuerClaimRootsTreeRoot *merkletree.Hash var issuerClaimSignatureR8X, issuerClaimSignatureR8Y, issuerClaimSignatureS, issuerAuthClaimNonRevMtpAuxHi, issuerAuthClaimNonRevMtpAuxHv, issuerAuthClaimNonRevMtpNoAux, - issuerClaimIdenState, proofType, issuerAuthClaimsTreeRoot, - issuerAuthRevTreeRoot, issuerAuthRootsTreeRoot, issuerAuthState string + issuerClaimIdenState, proofType string + + var issuerAuthClaimsTreeRoot, issuerAuthRevTreeRoot, issuerAuthRootsTreeRoot string + var issuerAuthState string var issuerAuthClaim *core.Claim + + issuerAuthClaimsTreeRoot = issuer.Clt.Root().BigInt().String() + issuerAuthRevTreeRoot = issuer.Ret.Root().BigInt().String() + issuerAuthRootsTreeRoot = issuer.Rot.Root().BigInt().String() + + issuerAuthState = issuer.State(t).String() + + issuerAuthClaimMtp, _ = issuer.ClaimMTP(t, issuer.AuthClaim) + + issuer.AddClaim(t, claim) + + issuerClaimMtp, _ = issuer.ClaimMTP(t, claim) + require.NoError(t, err) + issuerClaimIdenState = issuer.State(t).String() + + issuerClaimClaimsTreeRoot = issuer.Clt.Root() + issuerClaimRevTreeRoot = issuer.Ret.Root() + issuerClaimRootsTreeRoot = issuer.Rot.Root() + + // add another claim to issuer if it is a second state + if issuerSecondState { + primaryEntityClaim := utils.DefaultUserClaim(t, issuer.ID) + issuer.AddClaim(t, primaryEntityClaim) + } + + // prove revocation on latest state of the issuer + issuerClaimNonRevMtp, issuerClaimNonRevAux := issuer.ClaimRevMTP(t, claim) + + issuerAuthClaimNonRevMtp, issuerAuthClaimNodeAux := issuer.ClaimRevMTP(t, issuer.AuthClaim) + issuerAuthClaimNonRevMtpNoAux = issuerAuthClaimNodeAux.NoAux + issuerAuthClaimNonRevMtpAuxHi = issuerAuthClaimNodeAux.Key + issuerAuthClaimNonRevMtpAuxHv = issuerAuthClaimNodeAux.Value + if testProofType == verifiable.BJJSignatureProofType { // Sig claim claimSig := issuer.SignClaim(t, claim) - var issuerAuthClaimNodeAux utils.NodeAuxValue - issuerAuthClaimMtp, issuerAuthClaimNodeAux = issuer.ClaimRevMTP(t, issuer.AuthClaim) - - issuerClaimMtp = utils.PrepareStrArray([]string{}, 40) - issuerClaimClaimsTreeRoot = &merkletree.HashZero - issuerClaimRevTreeRoot = &merkletree.HashZero - issuerClaimRootsTreeRoot = &merkletree.HashZero - - issuerAuthClaimNonRevMtpAuxHi = issuerAuthClaimNodeAux.Key - issuerAuthClaimNonRevMtpAuxHv = issuerAuthClaimNodeAux.Value - issuerAuthClaimNonRevMtpNoAux = issuerAuthClaimNodeAux.NoAux issuerClaimSignatureR8X = claimSig.R8.X.String() issuerClaimSignatureR8Y = claimSig.R8.Y.String() @@ -174,23 +221,8 @@ func generateData(t *testing.T, desc string, gistData []*gistData, nextState boo issuerAuthClaim = issuer.AuthClaim - issuerClaimIdenState = "0" - - issuerAuthClaimsTreeRoot = issuer.Clt.Root().BigInt().String() - issuerAuthRevTreeRoot = issuer.Ret.Root().BigInt().String() - issuerAuthRootsTreeRoot = issuer.Rot.Root().BigInt().String() - - issuerAuthState = issuer.State(t).String() - proofType = "1" } else { - issuer.AddClaim(t, claim) - issuerClaimMtp, _ = issuer.ClaimMTP(t, claim) - issuerClaimIdenState = issuer.State(t).String() - - issuerClaimClaimsTreeRoot = issuer.Clt.Root() - issuerClaimRevTreeRoot = issuer.Ret.Root() - issuerClaimRootsTreeRoot = issuer.Rot.Root() issuerClaimSignatureR8X = "0" issuerClaimSignatureR8Y = "0" @@ -204,9 +236,9 @@ func generateData(t *testing.T, desc string, gistData []*gistData, nextState boo issuerAuthClaim = &core.Claim{} - issuerAuthClaimsTreeRoot = "0" - issuerAuthRevTreeRoot = "0" - issuerAuthRootsTreeRoot = "0" + issuerAuthClaimsTreeRoot = (&merkletree.HashZero).BigInt().String() + issuerAuthRevTreeRoot = (&merkletree.HashZero).BigInt().String() + issuerAuthRootsTreeRoot = (&merkletree.HashZero).BigInt().String() issuerAuthState = "0" @@ -214,8 +246,6 @@ func generateData(t *testing.T, desc string, gistData []*gistData, nextState boo proofType = "2" } - issuerClaimNonRevMtp, issuerClaimNonRevAux := issuer.ClaimRevMTP(t, claim) - gisTree, err := merkletree.NewMerkleTree(context.Background(), memory.NewMemoryStorage(), 64) require.Nil(t, err) @@ -227,8 +257,8 @@ func generateData(t *testing.T, desc string, gistData []*gistData, nextState boo var authMTProof []string var challenge *big.Int - var authNonRevMTProof []string - var nodeAuxNonRev utils.NodeAuxValue + var userAuthNonRevMTProof []string + var userNodeAuxNonRev utils.NodeAuxValue var sig *babyjub.Signature var gistRoot *merkletree.Hash var gistProof []string @@ -237,7 +267,7 @@ func generateData(t *testing.T, desc string, gistData []*gistData, nextState boo if authEnabled == 1 { challenge = big.NewInt(12345) authMTProof = user.AuthMTPStrign(t) - authNonRevMTProof, nodeAuxNonRev = user.ClaimRevMTP(t, user.AuthClaim) + userAuthNonRevMTProof, userNodeAuxNonRev = user.ClaimRevMTP(t, user.AuthClaim) sig = user.Sign(challenge) gistProofRaw, _, err := gisTree.GenerateProof(context.Background(), user.IDHash(t), nil) require.NoError(t, err) @@ -248,8 +278,8 @@ func generateData(t *testing.T, desc string, gistData []*gistData, nextState boo emptyArr := make([]*merkletree.Hash, 0) authMTProof = utils.PrepareSiblingsStr(emptyArr, utils.IdentityTreeLevels) - authNonRevMTProof = utils.PrepareSiblingsStr(emptyArr, utils.IdentityTreeLevels) - nodeAuxNonRev = utils.NodeAuxValue{ + userAuthNonRevMTProof = utils.PrepareSiblingsStr(emptyArr, utils.IdentityTreeLevels) + userNodeAuxNonRev = utils.NodeAuxValue{ Key: merkletree.HashZero.String(), Value: merkletree.HashZero.String(), NoAux: "0", @@ -270,6 +300,7 @@ func generateData(t *testing.T, desc string, gistData []*gistData, nextState boo NoAux: "0", } } + t.Log(issuer.State(t).String()) inputs := Inputs{ RequestID: requestID, @@ -277,10 +308,10 @@ func generateData(t *testing.T, desc string, gistData []*gistData, nextState boo ProfileNonce: nonce.String(), UserAuthClaim: user.AuthClaim, UserAuthClaimMtp: authMTProof, - UserAuthClaimNonRevMtp: authNonRevMTProof, - UserAuthClaimNonRevMtpAuxHi: nodeAuxNonRev.Key, - UserAuthClaimNonRevMtpAuxHv: nodeAuxNonRev.Value, - UserAuthClaimNonRevMtpNoAux: nodeAuxNonRev.NoAux, + UserAuthClaimNonRevMtp: userAuthNonRevMTProof, + UserAuthClaimNonRevMtpAuxHi: userNodeAuxNonRev.Key, + UserAuthClaimNonRevMtpAuxHv: userNodeAuxNonRev.Value, + UserAuthClaimNonRevMtpNoAux: userNodeAuxNonRev.NoAux, Challenge: challenge.String(), ChallengeSignatureR8X: sig.R8.X.String(), ChallengeSignatureR8Y: sig.R8.Y.String(), @@ -329,7 +360,7 @@ func generateData(t *testing.T, desc string, gistData []*gistData, nextState boo IssuerClaimSignatureS: issuerClaimSignatureS, IssuerAuthClaim: issuerAuthClaim, IssuerAuthClaimMtp: issuerAuthClaimMtp, - IssuerAuthClaimNonRevMtp: issuerAuthClaimMtp, + IssuerAuthClaimNonRevMtp: issuerAuthClaimNonRevMtp, IssuerAuthClaimNonRevMtpAuxHi: issuerAuthClaimNonRevMtpAuxHi, IssuerAuthClaimNonRevMtpAuxHv: issuerAuthClaimNonRevMtpAuxHv, IssuerAuthClaimNonRevMtpNoAux: issuerAuthClaimNonRevMtpNoAux, From 7755b6f60976266afe520897efe9c8d28d62fc65 Mon Sep 17 00:00:00 2001 From: vmidyllic <74898029+vmidyllic@users.noreply.github.com> Date: Mon, 11 Dec 2023 21:15:31 +0200 Subject: [PATCH 04/14] iteration 2; tests revocation state --- .../v3/issuer_from_first_state_to_second_transition_v3.json | 1 + .../v3/issuer_from_genesis_state_to_first_transition_v3.json | 1 + .../v3/user_from_first_state_to_second_transition_v3.json | 1 + .../v3/user_from_genesis_state_to_first_transition_v3.json | 1 + .../testdata/v3/valid_bjj_user_first_issuer_second_v3.json | 1 + .../contract_data/testdata/v3/valid_bjj_user_first_v3.json | 1 + .../contract_data/testdata/v3/valid_bjj_user_genesis_v3.json | 1 + .../testdata/v3/valid_bjj_user_second_issuer_first_v3.json | 1 + 8 files changed, 8 insertions(+) create mode 100644 testvectorgen/contract_data/testdata/v3/issuer_from_first_state_to_second_transition_v3.json create mode 100644 testvectorgen/contract_data/testdata/v3/issuer_from_genesis_state_to_first_transition_v3.json create mode 100644 testvectorgen/contract_data/testdata/v3/user_from_first_state_to_second_transition_v3.json create mode 100644 testvectorgen/contract_data/testdata/v3/user_from_genesis_state_to_first_transition_v3.json create mode 100644 testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_issuer_second_v3.json create mode 100644 testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_v3.json create mode 100644 testvectorgen/contract_data/testdata/v3/valid_bjj_user_genesis_v3.json create mode 100644 testvectorgen/contract_data/testdata/v3/valid_bjj_user_second_issuer_first_v3.json diff --git a/testvectorgen/contract_data/testdata/v3/issuer_from_first_state_to_second_transition_v3.json b/testvectorgen/contract_data/testdata/v3/issuer_from_first_state_to_second_transition_v3.json new file mode 100644 index 00000000..94277687 --- /dev/null +++ b/testvectorgen/contract_data/testdata/v3/issuer_from_first_state_to_second_transition_v3.json @@ -0,0 +1 @@ +{"desc":"Issuer from first to second transition","inputs":{"authClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"authClaimMtp":["19312094904764700753580612047626022747021351711405324310595042214387140174291","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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","claimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","isOldStateGenesis":"0","newUserState":"16808564267715042565747150526413707826810779846518769996187201048333752158039","oldUserState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","revTreeRoot":"0","rootsTreeRoot":"0","signatureR8x":"4451980901190234783172959675720220799783150745288796139848355680802504233563","signatureR8y":"10290932997226499735765510823191924674555389218679230413227916096690464459049","signatureS":"1163959203067016102828885602064348515581217594742167104031647043621998266749","userID":"22057981499787921734624217749308316644136637822444794206796063681866502657","newAuthClaimMtp":["19312094904764700753580612047626022747021351711405324310595042214387140174291","0","1026244475062489506222121556222727427439303688002450713661892202849270557156","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"],"newClaimsTreeRoot":"12485282917430521519505497335419247027529713129159393099659489490556962297749","newRevTreeRoot":"0","newRootsTreeRoot":"0"},"expOut":{"userID":"22057981499787921734624217749308316644136637822444794206796063681866502657","newUserState":"16808564267715042565747150526413707826810779846518769996187201048333752158039","oldUserState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","isOldStateGenesis":"0"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/issuer_from_genesis_state_to_first_transition_v3.json b/testvectorgen/contract_data/testdata/v3/issuer_from_genesis_state_to_first_transition_v3.json new file mode 100644 index 00000000..36192a58 --- /dev/null +++ b/testvectorgen/contract_data/testdata/v3/issuer_from_genesis_state_to_first_transition_v3.json @@ -0,0 +1 @@ +{"desc":"Issuer from genesis to first state transition","inputs":{"authClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"authClaimMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","claimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","isOldStateGenesis":"1","newUserState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","oldUserState":"2943483356559152311923412925436024635269538717812859789851139200242297094","revTreeRoot":"0","rootsTreeRoot":"0","signatureR8x":"2085592444220100326031338035383829664902376711585650942234781493730544258667","signatureR8y":"14433656182623287405033639342255910220233755175759851077473054657433804146039","signatureS":"2016166231820509407081569470848556903128858457395765589051625149205478199879","userID":"22057981499787921734624217749308316644136637822444794206796063681866502657","newAuthClaimMtp":["19312094904764700753580612047626022747021351711405324310595042214387140174291","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"],"newClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","newRevTreeRoot":"0","newRootsTreeRoot":"0"},"expOut":{"userID":"22057981499787921734624217749308316644136637822444794206796063681866502657","newUserState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","oldUserState":"2943483356559152311923412925436024635269538717812859789851139200242297094","isOldStateGenesis":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/user_from_first_state_to_second_transition_v3.json b/testvectorgen/contract_data/testdata/v3/user_from_first_state_to_second_transition_v3.json new file mode 100644 index 00000000..7a3bdcfe --- /dev/null +++ b/testvectorgen/contract_data/testdata/v3/user_from_first_state_to_second_transition_v3.json @@ -0,0 +1 @@ +{"desc":"User from first to second transition","inputs":{"authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimMtp":["13207060137112832590622170449916258240813695457675295794859213606138142493259","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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","claimsTreeRoot":"11517767461750786409356202654343440087797799854420804212797270561286585478040","isOldStateGenesis":"0","newUserState":"14535482911083887650400775180811767777795251060472677534187665389233265353111","oldUserState":"13421062220305656807332040413142908746386531813676548741852291985659124697073","revTreeRoot":"0","rootsTreeRoot":"0","signatureR8x":"21425994227874849639621713954801342411347583342842970532936629246020892133979","signatureR8y":"15086628426692843647015969499067295691377525479353419204848333228839773797664","signatureS":"1087623318161920118901441488147535273639798840670857417654471854266718085600","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","newAuthClaimMtp":["5916548408689195262080688487922161094620378143892746801536708302227694602463","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"],"newClaimsTreeRoot":"2598859270528411339367298518235341436604032965606770354648007040260316541053","newRevTreeRoot":"0","newRootsTreeRoot":"0"},"expOut":{"userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","newUserState":"14535482911083887650400775180811767777795251060472677534187665389233265353111","oldUserState":"13421062220305656807332040413142908746386531813676548741852291985659124697073","isOldStateGenesis":"0"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/user_from_genesis_state_to_first_transition_v3.json b/testvectorgen/contract_data/testdata/v3/user_from_genesis_state_to_first_transition_v3.json new file mode 100644 index 00000000..36c57b7f --- /dev/null +++ b/testvectorgen/contract_data/testdata/v3/user_from_genesis_state_to_first_transition_v3.json @@ -0,0 +1 @@ +{"desc":"User from genesis transition","inputs":{"authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","claimsTreeRoot":"8162166103065016664685834856644195001371303013149727027131225893397958846382","isOldStateGenesis":"1","newUserState":"13421062220305656807332040413142908746386531813676548741852291985659124697073","oldUserState":"8039964009611210398788855768060749920589777058607598891238307089541758339342","revTreeRoot":"0","rootsTreeRoot":"0","signatureR8x":"449961878051830467803752640078635067041152234952600107462840793233843410165","signatureR8y":"7845209675226400751229009492576094478976760100350782830991248199240406213644","signatureS":"2039418463851899709325993105750594622966343716085071139691800933351597638583","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","newAuthClaimMtp":["13207060137112832590622170449916258240813695457675295794859213606138142493259","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"],"newClaimsTreeRoot":"11517767461750786409356202654343440087797799854420804212797270561286585478040","newRevTreeRoot":"0","newRootsTreeRoot":"0"},"expOut":{"userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","newUserState":"13421062220305656807332040413142908746386531813676548741852291985659124697073","oldUserState":"8039964009611210398788855768060749920589777058607598891238307089541758339342","isOldStateGenesis":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_issuer_second_v3.json b/testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_issuer_second_v3.json new file mode 100644 index 00000000..9a367201 --- /dev/null +++ b/testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_issuer_second_v3.json @@ -0,0 +1 @@ +{"desc":"BJJ: Issuer second state / user first state - valid proof","inputs":{"requestID":"32","userGenesisID":"23273167900576580892722615617815475823351560716009055944677723144398443009","profileNonce":"0","claimSubjectProfileNonce":"999","authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimIncMtp":["13207060137112832590622170449916258240813695457675295794859213606138142493259","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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","challenge":"12345","challengeSignatureR8x":"15829360093371098546177008474519342171461782120259125067189481965541223738777","challengeSignatureR8y":"10840522802382821290541462398953040493080116495308402635486440290351677745960","challengeSignatureS":"1196477404779941775725836688033485533497812196897664950083199167075327114562","userClaimsTreeRoot":"11517767461750786409356202654343440087797799854420804212797270561286585478040","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"13421062220305656807332040413142908746386531813676548741852291985659124697073","gistRoot":"3246149973995767198551331195301279032661034567528700100008644394827230835249","gistMtp":["0","0","0","0","0","6097144699697903255302393350153793559547643885208447897492320561902595462726","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"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","28275098119780158026040482722477442169764247619454891891569161278093595137","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"12485282917430521519505497335419247027529713129159393099659489490556962297749","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"16808564267715042565747150526413707826810779846518769996187201048333752158039","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":0,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"5472508197866388381206604816325335748616914118588758490396973216283757878391","issuerClaimSignatureR8y":"487022569097765756306556955967994377058095043087439728980694573045440494288","issuerClaimSignatureS":"406364656466382933476187938784383717878849985640796393410767792675250006948","issuerAuthClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"1","issuerAuthClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"2943483356559152311923412925436024635269538717812859789851139200242297094","proofType":"1","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","authEnabled":1},"expOut":{"requestID":"32","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"16808564267715042565747150526413707826810779846518769996187201048333752158039","circuitQueryHash":"12816522451235043383360844734477263990263633888892986646884788265975859605506","gistRoot":"3246149973995767198551331195301279032661034567528700100008644394827230835249","timestamp":"1642074362","merklized":"1","proofType":"1","isRevocationChecked":"1","challenge":"12345","issuerState":"2943483356559152311923412925436024635269538717812859789851139200242297094","linkID":"21264956840473518295367401759082248638554058714792654964349049745455799782226","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","operatorOutput":"0","nullifier":"21540438192236855564075143333896114176485819065040531615519987653057866936972","authEnabled":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_v3.json b/testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_v3.json new file mode 100644 index 00000000..0f6a41bb --- /dev/null +++ b/testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_v3.json @@ -0,0 +1 @@ +{"desc":"BJJ: Issuer first state / user first state - valid proof","inputs":{"requestID":"32","userGenesisID":"23273167900576580892722615617815475823351560716009055944677723144398443009","profileNonce":"0","claimSubjectProfileNonce":"999","authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimIncMtp":["13207060137112832590622170449916258240813695457675295794859213606138142493259","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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","challenge":"12345","challengeSignatureR8x":"15829360093371098546177008474519342171461782120259125067189481965541223738777","challengeSignatureR8y":"10840522802382821290541462398953040493080116495308402635486440290351677745960","challengeSignatureS":"1196477404779941775725836688033485533497812196897664950083199167075327114562","userClaimsTreeRoot":"11517767461750786409356202654343440087797799854420804212797270561286585478040","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"13421062220305656807332040413142908746386531813676548741852291985659124697073","gistRoot":"20586831885098765093977645199183344896684103637972080672236708215043596614295","gistMtp":["0","0","0","0","0","17553467291814895170405188828004896559375980578450652516838963090977259468266","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"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","28275098119780158026040482722477442169764247619454891891569161278093595137","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":0,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"5472508197866388381206604816325335748616914118588758490396973216283757878391","issuerClaimSignatureR8y":"487022569097765756306556955967994377058095043087439728980694573045440494288","issuerClaimSignatureS":"406364656466382933476187938784383717878849985640796393410767792675250006948","issuerAuthClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"1","issuerAuthClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"2943483356559152311923412925436024635269538717812859789851139200242297094","proofType":"1","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","authEnabled":1},"expOut":{"requestID":"32","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","circuitQueryHash":"12816522451235043383360844734477263990263633888892986646884788265975859605506","gistRoot":"20586831885098765093977645199183344896684103637972080672236708215043596614295","timestamp":"1642074362","merklized":"1","proofType":"1","isRevocationChecked":"1","challenge":"12345","issuerState":"2943483356559152311923412925436024635269538717812859789851139200242297094","linkID":"21264956840473518295367401759082248638554058714792654964349049745455799782226","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","operatorOutput":"0","nullifier":"21540438192236855564075143333896114176485819065040531615519987653057866936972","authEnabled":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/valid_bjj_user_genesis_v3.json b/testvectorgen/contract_data/testdata/v3/valid_bjj_user_genesis_v3.json new file mode 100644 index 00000000..0c26ab02 --- /dev/null +++ b/testvectorgen/contract_data/testdata/v3/valid_bjj_user_genesis_v3.json @@ -0,0 +1 @@ +{"desc":"BJJ: Issuer first state / user - genesis state","inputs":{"requestID":"32","userGenesisID":"23273167900576580892722615617815475823351560716009055944677723144398443009","profileNonce":"0","claimSubjectProfileNonce":"999","authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimIncMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","challenge":"12345","challengeSignatureR8x":"15829360093371098546177008474519342171461782120259125067189481965541223738777","challengeSignatureR8y":"10840522802382821290541462398953040493080116495308402635486440290351677745960","challengeSignatureS":"1196477404779941775725836688033485533497812196897664950083199167075327114562","userClaimsTreeRoot":"8162166103065016664685834856644195001371303013149727027131225893397958846382","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"8039964009611210398788855768060749920589777058607598891238307089541758339342","gistRoot":"17553467291814895170405188828004896559375980578450652516838963090977259468266","gistMtp":["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","0"],"gistMtpAuxHi":"4077987451868832113968561545636400295368362996583459552225367454505139442921","gistMtpAuxHv":"17589915770180204105901402551557814231062156768237172640949582669912057325314","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","28275098119780158026040482722477442169764247619454891891569161278093595137","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":0,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"5472508197866388381206604816325335748616914118588758490396973216283757878391","issuerClaimSignatureR8y":"487022569097765756306556955967994377058095043087439728980694573045440494288","issuerClaimSignatureS":"406364656466382933476187938784383717878849985640796393410767792675250006948","issuerAuthClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"1","issuerAuthClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"2943483356559152311923412925436024635269538717812859789851139200242297094","proofType":"1","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","authEnabled":1},"expOut":{"requestID":"32","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","circuitQueryHash":"12816522451235043383360844734477263990263633888892986646884788265975859605506","gistRoot":"17553467291814895170405188828004896559375980578450652516838963090977259468266","timestamp":"1642074362","merklized":"1","proofType":"1","isRevocationChecked":"1","challenge":"12345","issuerState":"2943483356559152311923412925436024635269538717812859789851139200242297094","linkID":"21264956840473518295367401759082248638554058714792654964349049745455799782226","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","operatorOutput":"0","nullifier":"21540438192236855564075143333896114176485819065040531615519987653057866936972","authEnabled":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/valid_bjj_user_second_issuer_first_v3.json b/testvectorgen/contract_data/testdata/v3/valid_bjj_user_second_issuer_first_v3.json new file mode 100644 index 00000000..05f08f17 --- /dev/null +++ b/testvectorgen/contract_data/testdata/v3/valid_bjj_user_second_issuer_first_v3.json @@ -0,0 +1 @@ +{"desc":"BJJ: Issuer first state / user second state - valid proof","inputs":{"requestID":"32","userGenesisID":"23273167900576580892722615617815475823351560716009055944677723144398443009","profileNonce":"0","claimSubjectProfileNonce":"999","authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimIncMtp":["5916548408689195262080688487922161094620378143892746801536708302227694602463","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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","challenge":"12345","challengeSignatureR8x":"15829360093371098546177008474519342171461782120259125067189481965541223738777","challengeSignatureR8y":"10840522802382821290541462398953040493080116495308402635486440290351677745960","challengeSignatureS":"1196477404779941775725836688033485533497812196897664950083199167075327114562","userClaimsTreeRoot":"2598859270528411339367298518235341436604032965606770354648007040260316541053","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"14535482911083887650400775180811767777795251060472677534187665389233265353111","gistRoot":"9099102572907537314140397131924122401084737995701214854737608469293791942353","gistMtp":["0","0","0","0","0","6097144699697903255302393350153793559547643885208447897492320561902595462726","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"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","28275098119780158026040482722477442169764247619454891891569161278093595137","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":0,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"5472508197866388381206604816325335748616914118588758490396973216283757878391","issuerClaimSignatureR8y":"487022569097765756306556955967994377058095043087439728980694573045440494288","issuerClaimSignatureS":"406364656466382933476187938784383717878849985640796393410767792675250006948","issuerAuthClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"1","issuerAuthClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"2943483356559152311923412925436024635269538717812859789851139200242297094","proofType":"1","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","authEnabled":1},"expOut":{"requestID":"32","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","circuitQueryHash":"12816522451235043383360844734477263990263633888892986646884788265975859605506","gistRoot":"9099102572907537314140397131924122401084737995701214854737608469293791942353","timestamp":"1642074362","merklized":"1","proofType":"1","isRevocationChecked":"1","challenge":"12345","issuerState":"2943483356559152311923412925436024635269538717812859789851139200242297094","linkID":"21264956840473518295367401759082248638554058714792654964349049745455799782226","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","operatorOutput":"0","nullifier":"21540438192236855564075143333896114176485819065040531615519987653057866936972","authEnabled":"1"}} \ No newline at end of file From 296b20426aad303e143217d801e98f0a776f8d03 Mon Sep 17 00:00:00 2001 From: vbasiuk Date: Tue, 12 Dec 2023 11:21:34 +0200 Subject: [PATCH 05/14] auth disabled test --- .../contract_data/generate_json_test.go | 20 +++++++++++----- ..._to_first_auth_disabled_transition_v3.json | 1 + ...lid_bjj_user_genesis_auth_disabled_v3.json | 1 + testvectorgen/contract_data/v3_test.go | 23 +++++++++++++------ 4 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 testvectorgen/contract_data/testdata/v3/issuer_from_genesis_state_to_first_auth_disabled_transition_v3.json create mode 100644 testvectorgen/contract_data/testdata/v3/valid_bjj_user_genesis_auth_disabled_v3.json diff --git a/testvectorgen/contract_data/generate_json_test.go b/testvectorgen/contract_data/generate_json_test.go index bfe09453..53c2d879 100644 --- a/testvectorgen/contract_data/generate_json_test.go +++ b/testvectorgen/contract_data/generate_json_test.go @@ -235,11 +235,11 @@ type TestDataSigV2 struct { func Test_Generate_Test_Cases(t *testing.T) { - id, issuerFirstState := generateStateTransitionData(t, false, IssuerPK, UserPK, "Issuer from genesis state", "issuer_genesis_state", false) - nextId, userFirstState := generateStateTransitionData(t, false, UserPK, IssuerPK, "User from genesis transition", "user_state_transition", false) + id, issuerFirstState := generateStateTransitionData(t, false, IssuerPK, UserPK, "Issuer from genesis state", "issuer_genesis_state", false, 1) + nextId, userFirstState := generateStateTransitionData(t, false, UserPK, IssuerPK, "User from genesis transition", "user_state_transition", false, 1) - generateStateTransitionData(t, true, IssuerPK, UserPK, "Issuer next transition state", "issuer_next_state_transition", false) - generateStateTransitionData(t, true, UserPK, IssuerPK, "User next transition state", "user_next_state_transition", false) + generateStateTransitionData(t, true, IssuerPK, UserPK, "Issuer next transition state", "issuer_next_state_transition", false, 1) + generateStateTransitionData(t, true, UserPK, IssuerPK, "User next transition state", "user_next_state_transition", false, 1) generateMTPData(t, "MTP: Issuer first state", []*gistData{ {id, issuerFirstState}, @@ -272,11 +272,19 @@ type gistData struct { state *big.Int } -func generateStateTransitionData(t *testing.T, nextState bool, primaryPK, secondaryPK, desc, fileName string, isSubjectIDProfile bool) (*big.Int, *big.Int) { +func generateStateTransitionData(t *testing.T, nextState bool, primaryPK, secondaryPK, desc, fileName string, isSubjectIDProfile bool, authEnabled int) (*big.Int, *big.Int) { var err error primaryEntity := utils.NewIdentity(t, primaryPK) - secondaryEntity := utils.NewIdentity(t, secondaryPK) + + var secondaryEntity *utils.IdentityTest + + if authEnabled == 1 { + secondaryEntity = utils.NewIdentity(t, secondaryPK) + } else { + // generate onchain identity + secondaryEntity = utils.NewEthereumBasedIdentity(t, ethAddress) + } isGenesis := "1" // user diff --git a/testvectorgen/contract_data/testdata/v3/issuer_from_genesis_state_to_first_auth_disabled_transition_v3.json b/testvectorgen/contract_data/testdata/v3/issuer_from_genesis_state_to_first_auth_disabled_transition_v3.json new file mode 100644 index 00000000..226ed4c7 --- /dev/null +++ b/testvectorgen/contract_data/testdata/v3/issuer_from_genesis_state_to_first_auth_disabled_transition_v3.json @@ -0,0 +1 @@ +{"desc":"Issuer from genesis to first state transition auth disabled","inputs":{"authClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"authClaimMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","claimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","isOldStateGenesis":"1","newUserState":"2849223435122160319995683834117043936973956790269185029065075688578869661987","oldUserState":"2943483356559152311923412925436024635269538717812859789851139200242297094","revTreeRoot":"0","rootsTreeRoot":"0","signatureR8x":"10840985367121317453505114787511079759115113480685824776514623091425578836533","signatureR8y":"6764078532564999956152857453836033052841878877532817390400284512073490999004","signatureS":"2618611783882973181590468694831749514310039533059364632457696282630770942958","userID":"22057981499787921734624217749308316644136637822444794206796063681866502657","newAuthClaimMtp":["0","0","20623464549709321670943344492127400563881045962377531782738695004685340859426","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"],"newClaimsTreeRoot":"10117283230230945737287913517688864980798731012859639202846398587175949994464","newRevTreeRoot":"0","newRootsTreeRoot":"0"},"expOut":{"userID":"22057981499787921734624217749308316644136637822444794206796063681866502657","newUserState":"2849223435122160319995683834117043936973956790269185029065075688578869661987","oldUserState":"2943483356559152311923412925436024635269538717812859789851139200242297094","isOldStateGenesis":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/valid_bjj_user_genesis_auth_disabled_v3.json b/testvectorgen/contract_data/testdata/v3/valid_bjj_user_genesis_auth_disabled_v3.json new file mode 100644 index 00000000..ff229220 --- /dev/null +++ b/testvectorgen/contract_data/testdata/v3/valid_bjj_user_genesis_auth_disabled_v3.json @@ -0,0 +1 @@ +{"desc":"BJJ: Issuer first state / user - genesis state - Auth Disabled","inputs":{"requestID":"32","userGenesisID":"23006274145546572515053798212160025855323582904648170675239778444296327681","profileNonce":"0","claimSubjectProfileNonce":"999","authClaim":["0","0","0","0","0","0","0","0"],"authClaimIncMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"0","challenge":"583091486781463398742321306787801699791102451699","challengeSignatureR8x":"0","challengeSignatureR8y":"0","challengeSignatureS":"0","userClaimsTreeRoot":"0","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"5317387130258456662214331362918410991734007599705406860481038345552731150762","gistRoot":"0","gistMtp":["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","0"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","25332005985822486934643366384342584313524543868409105416725059803960840705","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["0","0","20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"10117283230230945737287913517688864980798731012859639202846398587175949994464","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"2849223435122160319995683834117043936973956790269185029065075688578869661987","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"10117283230230945737287913517688864980798731012859639202846398587175949994464","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"2849223435122160319995683834117043936973956790269185029065075688578869661987","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":0,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"9725314054820182574856811109563426514760165252038879818462104420204416609328","issuerClaimSignatureR8y":"393631288379660520473719256622560377195511013022299349456897666482424652359","issuerClaimSignatureS":"1062724383590809628467750714676231693286167812523349158229736854255057448415","issuerAuthClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"1","issuerAuthClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"2943483356559152311923412925436024635269538717812859789851139200242297094","proofType":"1","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","authEnabled":0},"expOut":{"requestID":"32","userID":"23006274145546572515053798212160025855323582904648170675239778444296327681","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"2849223435122160319995683834117043936973956790269185029065075688578869661987","circuitQueryHash":"12816522451235043383360844734477263990263633888892986646884788265975859605506","gistRoot":"0","timestamp":"1642074362","merklized":"1","proofType":"1","isRevocationChecked":"1","challenge":"583091486781463398742321306787801699791102451699","issuerState":"2943483356559152311923412925436024635269538717812859789851139200242297094","linkID":"9069846887849371523003626710972036591531592782403850230651851545348605982450","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","operatorOutput":"0","nullifier":"2391236256579199361493361173175703926943529965960611924494830154382898472529","authEnabled":"0"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/v3_test.go b/testvectorgen/contract_data/v3_test.go index d6ec812f..f50debce 100644 --- a/testvectorgen/contract_data/v3_test.go +++ b/testvectorgen/contract_data/v3_test.go @@ -7,6 +7,7 @@ import ( "strconv" "testing" + "github.com/ethereum/go-ethereum/common" core "github.com/iden3/go-iden3-core/v2" "github.com/iden3/go-iden3-crypto/babyjub" "github.com/iden3/go-iden3-crypto/poseidon" @@ -25,34 +26,37 @@ const ( func Test_Generate_Test_CasesV3(t *testing.T) { // genesis => first => second - issuerId, issuerFirstState := generateStateTransitionData(t, false, IssuerPK, UserPK, "Issuer from genesis to first state transition", "v3/issuer_from_genesis_state_to_first_transition_v3", true) - userId, userFirstState := generateStateTransitionData(t, false, UserPK, IssuerPK, "User from genesis transition", "v3/user_from_genesis_state_to_first_transition_v3", false) + issuerId, issuerFirstState := generateStateTransitionData(t, false, IssuerPK, UserPK, "Issuer from genesis to first state transition", "v3/issuer_from_genesis_state_to_first_transition_v3", true, 1) + userId, userFirstState := generateStateTransitionData(t, false, UserPK, IssuerPK, "User from genesis transition", "v3/user_from_genesis_state_to_first_transition_v3", false, 1) - _, issuerSecondState := generateStateTransitionData(t, true, IssuerPK, UserPK, "Issuer from first to second transition", "v3/issuer_from_first_state_to_second_transition_v3", true) - _, userSecondState := generateStateTransitionData(t, true, UserPK, IssuerPK, "User from first to second transition", "v3/user_from_first_state_to_second_transition_v3", false) + _, issuerSecondState := generateStateTransitionData(t, true, IssuerPK, UserPK, "Issuer from first to second transition", "v3/issuer_from_first_state_to_second_transition_v3", true, 1) + _, userSecondState := generateStateTransitionData(t, true, UserPK, IssuerPK, "User from first to second transition", "v3/user_from_first_state_to_second_transition_v3", false, 1) + + _, issuerAuthDisabledFirstState := generateStateTransitionData(t, false, IssuerPK, UserPK, "Issuer from genesis to first state transition auth disabled", "v3/issuer_from_genesis_state_to_first_auth_disabled_transition_v3", true, 0) generateData(t, "BJJ: Issuer first state / user - genesis state", []*gistData{ {issuerId, issuerFirstState}, }, false, false, false, "v3/valid_bjj_user_genesis_v3", verifiable.BJJSignatureProofType, 1) generateData(t, "BJJ: Issuer first state / user first state - valid proof", []*gistData{ - {issuerId, issuerFirstState}, {userId, userFirstState}, }, true, false, false, "v3/valid_bjj_user_first_v3", verifiable.BJJSignatureProofType, 1) generateData(t, "BJJ: Issuer second state / user first state - valid proof", []*gistData{ - {userId, userFirstState}, {issuerId, issuerSecondState}, }, true, false, true, "v3/valid_bjj_user_first_issuer_second_v3", verifiable.BJJSignatureProofType, 1) generateData(t, "BJJ: Issuer first state / user second state - valid proof", []*gistData{ - {userId, userSecondState}, {issuerId, issuerSecondState}, }, true, true, false, "v3/valid_bjj_user_second_issuer_first_v3", verifiable.BJJSignatureProofType, 1) + generateData(t, "BJJ: Issuer first state / user - genesis state - Auth Disabled", []*gistData{ + {issuerId, issuerAuthDisabledFirstState}, + }, false, false, false, "v3/valid_bjj_user_genesis_auth_disabled_v3", verifiable.BJJSignatureProofType, 0) + //generateMTPData(t, "MTP: User sign with address challenge genesis", []*gistData{ // {id, issuerFirstState}, // {nextId, userFirstState}, @@ -263,6 +267,7 @@ func generateData(t *testing.T, desc string, gistData []*gistData, userFirstStat var gistRoot *merkletree.Hash var gistProof []string var gistNodeAux utils.NodeAuxValue + // user if authEnabled == 1 { challenge = big.NewInt(12345) @@ -275,6 +280,8 @@ func generateData(t *testing.T, desc string, gistData []*gistData, userFirstStat gistProof, gistNodeAux = utils.PrepareProof(gistProofRaw, utils.GistLevels) } else { + addr := common.HexToAddress(ethAddress) + challenge = new(big.Int).SetBytes(merkletree.SwapEndianness(addr.Bytes())) emptyArr := make([]*merkletree.Hash, 0) authMTProof = utils.PrepareSiblingsStr(emptyArr, utils.IdentityTreeLevels) @@ -299,6 +306,8 @@ func generateData(t *testing.T, desc string, gistData []*gistData, userFirstStat Value: merkletree.HashZero.String(), NoAux: "0", } + + user.AuthClaim = &core.Claim{} } t.Log(issuer.State(t).String()) From dc3a1f198d1607480a7ae9eb909e3194e40feb4e Mon Sep 17 00:00:00 2001 From: vbasiuk Date: Tue, 12 Dec 2023 12:07:05 +0200 Subject: [PATCH 06/14] add MTP data tests --- ...valid_mtp_user_first_issuer_second_v3.json | 1 + .../testdata/v3/valid_mtp_user_first_v3.json | 1 + ...lid_mtp_user_genesis_auth_disabled_v3.json | 1 + .../v3/valid_mtp_user_genesis_v3.json | 1 + ...valid_mtp_user_second_issuer_first_v3.json | 1 + testvectorgen/contract_data/v3_test.go | 38 +++++++++++-------- 6 files changed, 27 insertions(+), 16 deletions(-) create mode 100644 testvectorgen/contract_data/testdata/v3/valid_mtp_user_first_issuer_second_v3.json create mode 100644 testvectorgen/contract_data/testdata/v3/valid_mtp_user_first_v3.json create mode 100644 testvectorgen/contract_data/testdata/v3/valid_mtp_user_genesis_auth_disabled_v3.json create mode 100644 testvectorgen/contract_data/testdata/v3/valid_mtp_user_genesis_v3.json create mode 100644 testvectorgen/contract_data/testdata/v3/valid_mtp_user_second_issuer_first_v3.json diff --git a/testvectorgen/contract_data/testdata/v3/valid_mtp_user_first_issuer_second_v3.json b/testvectorgen/contract_data/testdata/v3/valid_mtp_user_first_issuer_second_v3.json new file mode 100644 index 00000000..71b9249c --- /dev/null +++ b/testvectorgen/contract_data/testdata/v3/valid_mtp_user_first_issuer_second_v3.json @@ -0,0 +1 @@ +{"desc":"MTP: Issuer second state / user first state - valid proof","inputs":{"requestID":"32","userGenesisID":"23273167900576580892722615617815475823351560716009055944677723144398443009","profileNonce":"0","claimSubjectProfileNonce":"999","authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimIncMtp":["13207060137112832590622170449916258240813695457675295794859213606138142493259","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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","challenge":"12345","challengeSignatureR8x":"15829360093371098546177008474519342171461782120259125067189481965541223738777","challengeSignatureR8y":"10840522802382821290541462398953040493080116495308402635486440290351677745960","challengeSignatureS":"1196477404779941775725836688033485533497812196897664950083199167075327114562","userClaimsTreeRoot":"11517767461750786409356202654343440087797799854420804212797270561286585478040","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"13421062220305656807332040413142908746386531813676548741852291985659124697073","gistRoot":"3246149973995767198551331195301279032661034567528700100008644394827230835249","gistMtp":["0","0","0","0","0","6097144699697903255302393350153793559547643885208447897492320561902595462726","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"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","28275098119780158026040482722477442169764247619454891891569161278093595137","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"12485282917430521519505497335419247027529713129159393099659489490556962297749","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"16808564267715042565747150526413707826810779846518769996187201048333752158039","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":2,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"0","issuerClaimSignatureR8y":"0","issuerClaimSignatureS":"0","issuerAuthClaim":["0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"0","issuerAuthClaimsTreeRoot":"0","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"0","proofType":"2","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","authEnabled":1},"expOut":{"requestID":"32","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"16808564267715042565747150526413707826810779846518769996187201048333752158039","circuitQueryHash":"16085407811791493874423550911889456452275693306656061172817544983916814452534","gistRoot":"3246149973995767198551331195301279032661034567528700100008644394827230835249","timestamp":"1642074362","merklized":"1","proofType":"2","isRevocationChecked":"1","challenge":"12345","issuerState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","linkID":"21264956840473518295367401759082248638554058714792654964349049745455799782226","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","operatorOutput":"0","nullifier":"21540438192236855564075143333896114176485819065040531615519987653057866936972","authEnabled":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/valid_mtp_user_first_v3.json b/testvectorgen/contract_data/testdata/v3/valid_mtp_user_first_v3.json new file mode 100644 index 00000000..d960a968 --- /dev/null +++ b/testvectorgen/contract_data/testdata/v3/valid_mtp_user_first_v3.json @@ -0,0 +1 @@ +{"desc":"MTP: Issuer first state / user first state - valid proof","inputs":{"requestID":"32","userGenesisID":"23273167900576580892722615617815475823351560716009055944677723144398443009","profileNonce":"0","claimSubjectProfileNonce":"999","authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimIncMtp":["13207060137112832590622170449916258240813695457675295794859213606138142493259","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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","challenge":"12345","challengeSignatureR8x":"15829360093371098546177008474519342171461782120259125067189481965541223738777","challengeSignatureR8y":"10840522802382821290541462398953040493080116495308402635486440290351677745960","challengeSignatureS":"1196477404779941775725836688033485533497812196897664950083199167075327114562","userClaimsTreeRoot":"11517767461750786409356202654343440087797799854420804212797270561286585478040","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"13421062220305656807332040413142908746386531813676548741852291985659124697073","gistRoot":"20586831885098765093977645199183344896684103637972080672236708215043596614295","gistMtp":["0","0","0","0","0","17553467291814895170405188828004896559375980578450652516838963090977259468266","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"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","28275098119780158026040482722477442169764247619454891891569161278093595137","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":2,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"0","issuerClaimSignatureR8y":"0","issuerClaimSignatureS":"0","issuerAuthClaim":["0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"0","issuerAuthClaimsTreeRoot":"0","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"0","proofType":"2","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","authEnabled":1},"expOut":{"requestID":"32","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","circuitQueryHash":"16085407811791493874423550911889456452275693306656061172817544983916814452534","gistRoot":"20586831885098765093977645199183344896684103637972080672236708215043596614295","timestamp":"1642074362","merklized":"1","proofType":"2","isRevocationChecked":"1","challenge":"12345","issuerState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","linkID":"21264956840473518295367401759082248638554058714792654964349049745455799782226","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","operatorOutput":"0","nullifier":"21540438192236855564075143333896114176485819065040531615519987653057866936972","authEnabled":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/valid_mtp_user_genesis_auth_disabled_v3.json b/testvectorgen/contract_data/testdata/v3/valid_mtp_user_genesis_auth_disabled_v3.json new file mode 100644 index 00000000..b57fffd3 --- /dev/null +++ b/testvectorgen/contract_data/testdata/v3/valid_mtp_user_genesis_auth_disabled_v3.json @@ -0,0 +1 @@ +{"desc":"MTP: Issuer first state / user - genesis state - Auth Disabled","inputs":{"requestID":"32","userGenesisID":"23006274145546572515053798212160025855323582904648170675239778444296327681","profileNonce":"0","claimSubjectProfileNonce":"999","authClaim":["0","0","0","0","0","0","0","0"],"authClaimIncMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"0","challenge":"583091486781463398742321306787801699791102451699","challengeSignatureR8x":"0","challengeSignatureR8y":"0","challengeSignatureS":"0","userClaimsTreeRoot":"0","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"5317387130258456662214331362918410991734007599705406860481038345552731150762","gistRoot":"0","gistMtp":["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","0"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","25332005985822486934643366384342584313524543868409105416725059803960840705","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["0","0","20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"10117283230230945737287913517688864980798731012859639202846398587175949994464","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"2849223435122160319995683834117043936973956790269185029065075688578869661987","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"10117283230230945737287913517688864980798731012859639202846398587175949994464","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"2849223435122160319995683834117043936973956790269185029065075688578869661987","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":2,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"0","issuerClaimSignatureR8y":"0","issuerClaimSignatureS":"0","issuerAuthClaim":["0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"0","issuerAuthClaimsTreeRoot":"0","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"0","proofType":"2","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","authEnabled":0},"expOut":{"requestID":"32","userID":"23006274145546572515053798212160025855323582904648170675239778444296327681","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"2849223435122160319995683834117043936973956790269185029065075688578869661987","circuitQueryHash":"16085407811791493874423550911889456452275693306656061172817544983916814452534","gistRoot":"0","timestamp":"1642074362","merklized":"1","proofType":"2","isRevocationChecked":"1","challenge":"583091486781463398742321306787801699791102451699","issuerState":"2849223435122160319995683834117043936973956790269185029065075688578869661987","linkID":"9069846887849371523003626710972036591531592782403850230651851545348605982450","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","operatorOutput":"0","nullifier":"2391236256579199361493361173175703926943529965960611924494830154382898472529","authEnabled":"0"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/valid_mtp_user_genesis_v3.json b/testvectorgen/contract_data/testdata/v3/valid_mtp_user_genesis_v3.json new file mode 100644 index 00000000..5382d354 --- /dev/null +++ b/testvectorgen/contract_data/testdata/v3/valid_mtp_user_genesis_v3.json @@ -0,0 +1 @@ +{"desc":"MTP: Issuer first state / user - genesis state","inputs":{"requestID":"32","userGenesisID":"23273167900576580892722615617815475823351560716009055944677723144398443009","profileNonce":"0","claimSubjectProfileNonce":"999","authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimIncMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","challenge":"12345","challengeSignatureR8x":"15829360093371098546177008474519342171461782120259125067189481965541223738777","challengeSignatureR8y":"10840522802382821290541462398953040493080116495308402635486440290351677745960","challengeSignatureS":"1196477404779941775725836688033485533497812196897664950083199167075327114562","userClaimsTreeRoot":"8162166103065016664685834856644195001371303013149727027131225893397958846382","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"8039964009611210398788855768060749920589777058607598891238307089541758339342","gistRoot":"17553467291814895170405188828004896559375980578450652516838963090977259468266","gistMtp":["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","0"],"gistMtpAuxHi":"4077987451868832113968561545636400295368362996583459552225367454505139442921","gistMtpAuxHv":"17589915770180204105901402551557814231062156768237172640949582669912057325314","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","28275098119780158026040482722477442169764247619454891891569161278093595137","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":2,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"0","issuerClaimSignatureR8y":"0","issuerClaimSignatureS":"0","issuerAuthClaim":["0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"0","issuerAuthClaimsTreeRoot":"0","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"0","proofType":"2","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","authEnabled":1},"expOut":{"requestID":"32","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","circuitQueryHash":"16085407811791493874423550911889456452275693306656061172817544983916814452534","gistRoot":"17553467291814895170405188828004896559375980578450652516838963090977259468266","timestamp":"1642074362","merklized":"1","proofType":"2","isRevocationChecked":"1","challenge":"12345","issuerState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","linkID":"21264956840473518295367401759082248638554058714792654964349049745455799782226","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","operatorOutput":"0","nullifier":"21540438192236855564075143333896114176485819065040531615519987653057866936972","authEnabled":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/valid_mtp_user_second_issuer_first_v3.json b/testvectorgen/contract_data/testdata/v3/valid_mtp_user_second_issuer_first_v3.json new file mode 100644 index 00000000..ca4091e4 --- /dev/null +++ b/testvectorgen/contract_data/testdata/v3/valid_mtp_user_second_issuer_first_v3.json @@ -0,0 +1 @@ +{"desc":"MTP: Issuer first state / user second state - valid proof","inputs":{"requestID":"32","userGenesisID":"23273167900576580892722615617815475823351560716009055944677723144398443009","profileNonce":"0","claimSubjectProfileNonce":"999","authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimIncMtp":["5916548408689195262080688487922161094620378143892746801536708302227694602463","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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","challenge":"12345","challengeSignatureR8x":"15829360093371098546177008474519342171461782120259125067189481965541223738777","challengeSignatureR8y":"10840522802382821290541462398953040493080116495308402635486440290351677745960","challengeSignatureS":"1196477404779941775725836688033485533497812196897664950083199167075327114562","userClaimsTreeRoot":"2598859270528411339367298518235341436604032965606770354648007040260316541053","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"14535482911083887650400775180811767777795251060472677534187665389233265353111","gistRoot":"9099102572907537314140397131924122401084737995701214854737608469293791942353","gistMtp":["0","0","0","0","0","6097144699697903255302393350153793559547643885208447897492320561902595462726","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"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","28275098119780158026040482722477442169764247619454891891569161278093595137","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":2,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"0","issuerClaimSignatureR8y":"0","issuerClaimSignatureS":"0","issuerAuthClaim":["0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"0","issuerAuthClaimsTreeRoot":"0","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"0","proofType":"2","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","authEnabled":1},"expOut":{"requestID":"32","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","circuitQueryHash":"16085407811791493874423550911889456452275693306656061172817544983916814452534","gistRoot":"9099102572907537314140397131924122401084737995701214854737608469293791942353","timestamp":"1642074362","merklized":"1","proofType":"2","isRevocationChecked":"1","challenge":"12345","issuerState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","linkID":"21264956840473518295367401759082248638554058714792654964349049745455799782226","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","operatorOutput":"0","nullifier":"21540438192236855564075143333896114176485819065040531615519987653057866936972","authEnabled":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/v3_test.go b/testvectorgen/contract_data/v3_test.go index f50debce..6d3effcc 100644 --- a/testvectorgen/contract_data/v3_test.go +++ b/testvectorgen/contract_data/v3_test.go @@ -57,23 +57,29 @@ func Test_Generate_Test_CasesV3(t *testing.T) { {issuerId, issuerAuthDisabledFirstState}, }, false, false, false, "v3/valid_bjj_user_genesis_auth_disabled_v3", verifiable.BJJSignatureProofType, 0) - //generateMTPData(t, "MTP: User sign with address challenge genesis", []*gistData{ - // {id, issuerFirstState}, - // {nextId, userFirstState}, - //}, true, "valid_mtp_user_non_genesis_challenge_address", true) - // - //generateSigData(t, "Sig: Issuer first state", []*gistData{ - // {id, issuerFirstState}, - //}, false, "valid_sig_user_genesis", false) - //generateSigData(t, "Sig: User non genesis latest", []*gistData{ - // {id, issuerFirstState}, - // {nextId, userFirstState}, - //}, true, "valid_sig_user_non_genesis", false) - //generateSigData(t, "Sig: User sign with address challenge genesis", []*gistData{ - // {id, issuerFirstState}, - // {nextId, userFirstState}, - //}, true, "valid_sig_user_non_genesis_challenge_address", true) + // MTP Data: + generateData(t, "MTP: Issuer first state / user - genesis state", []*gistData{ + {issuerId, issuerFirstState}, + }, false, false, false, "v3/valid_mtp_user_genesis_v3", verifiable.Iden3SparseMerkleTreeProofType, 1) + + generateData(t, "MTP: Issuer first state / user first state - valid proof", []*gistData{ + {issuerId, issuerFirstState}, + {userId, userFirstState}, + }, true, false, false, "v3/valid_mtp_user_first_v3", verifiable.Iden3SparseMerkleTreeProofType, 1) + generateData(t, "MTP: Issuer second state / user first state - valid proof", []*gistData{ + {userId, userFirstState}, + {issuerId, issuerSecondState}, + }, true, false, true, "v3/valid_mtp_user_first_issuer_second_v3", verifiable.Iden3SparseMerkleTreeProofType, 1) + + generateData(t, "MTP: Issuer first state / user second state - valid proof", []*gistData{ + {userId, userSecondState}, + {issuerId, issuerSecondState}, + }, true, true, false, "v3/valid_mtp_user_second_issuer_first_v3", verifiable.Iden3SparseMerkleTreeProofType, 1) + + generateData(t, "MTP: Issuer first state / user - genesis state - Auth Disabled", []*gistData{ + {issuerId, issuerAuthDisabledFirstState}, + }, false, false, false, "v3/valid_mtp_user_genesis_auth_disabled_v3", verifiable.Iden3SparseMerkleTreeProofType, 0) } func generateData(t *testing.T, desc string, gistData []*gistData, userFirstState bool, userSecondState bool, issuerSecondState bool, fileName string, testProofType verifiable.ProofType, authEnabled int) { From 03c6e1fd5f585e1eb1d533ed7496b8d7d5ff875c Mon Sep 17 00:00:00 2001 From: vbasiuk Date: Tue, 12 Dec 2023 15:16:45 +0200 Subject: [PATCH 07/14] refactor ethBased --- testvectorgen/contract_data/generate_json_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/testvectorgen/contract_data/generate_json_test.go b/testvectorgen/contract_data/generate_json_test.go index 53c2d879..bb5bb8bd 100644 --- a/testvectorgen/contract_data/generate_json_test.go +++ b/testvectorgen/contract_data/generate_json_test.go @@ -235,11 +235,11 @@ type TestDataSigV2 struct { func Test_Generate_Test_Cases(t *testing.T) { - id, issuerFirstState := generateStateTransitionData(t, false, IssuerPK, UserPK, "Issuer from genesis state", "issuer_genesis_state", false, 1) - nextId, userFirstState := generateStateTransitionData(t, false, UserPK, IssuerPK, "User from genesis transition", "user_state_transition", false, 1) + id, issuerFirstState := generateStateTransitionData(t, false, IssuerPK, UserPK, "Issuer from genesis state", "issuer_genesis_state", false, false) + nextId, userFirstState := generateStateTransitionData(t, false, UserPK, IssuerPK, "User from genesis transition", "user_state_transition", false, false) - generateStateTransitionData(t, true, IssuerPK, UserPK, "Issuer next transition state", "issuer_next_state_transition", false, 1) - generateStateTransitionData(t, true, UserPK, IssuerPK, "User next transition state", "user_next_state_transition", false, 1) + generateStateTransitionData(t, true, IssuerPK, UserPK, "Issuer next transition state", "issuer_next_state_transition", false, false) + generateStateTransitionData(t, true, UserPK, IssuerPK, "User next transition state", "user_next_state_transition", false, false) generateMTPData(t, "MTP: Issuer first state", []*gistData{ {id, issuerFirstState}, @@ -272,14 +272,14 @@ type gistData struct { state *big.Int } -func generateStateTransitionData(t *testing.T, nextState bool, primaryPK, secondaryPK, desc, fileName string, isSubjectIDProfile bool, authEnabled int) (*big.Int, *big.Int) { +func generateStateTransitionData(t *testing.T, nextState bool, primaryPK, secondaryPK, desc, fileName string, isSubjectIDProfile bool, isEthBased bool) (*big.Int, *big.Int) { var err error primaryEntity := utils.NewIdentity(t, primaryPK) var secondaryEntity *utils.IdentityTest - if authEnabled == 1 { + if !isEthBased { secondaryEntity = utils.NewIdentity(t, secondaryPK) } else { // generate onchain identity From 19443f402a03c81bd3a53c915d9a78d7f75995af Mon Sep 17 00:00:00 2001 From: vbasiuk Date: Tue, 12 Dec 2023 15:16:52 +0200 Subject: [PATCH 08/14] refactor --- testvectorgen/contract_data/v3_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/testvectorgen/contract_data/v3_test.go b/testvectorgen/contract_data/v3_test.go index 6d3effcc..9bb2a386 100644 --- a/testvectorgen/contract_data/v3_test.go +++ b/testvectorgen/contract_data/v3_test.go @@ -26,13 +26,13 @@ const ( func Test_Generate_Test_CasesV3(t *testing.T) { // genesis => first => second - issuerId, issuerFirstState := generateStateTransitionData(t, false, IssuerPK, UserPK, "Issuer from genesis to first state transition", "v3/issuer_from_genesis_state_to_first_transition_v3", true, 1) - userId, userFirstState := generateStateTransitionData(t, false, UserPK, IssuerPK, "User from genesis transition", "v3/user_from_genesis_state_to_first_transition_v3", false, 1) + issuerId, issuerFirstState := generateStateTransitionData(t, false, IssuerPK, UserPK, "Issuer from genesis to first state transition", "v3/issuer_from_genesis_state_to_first_transition_v3", true, false) + userId, userFirstState := generateStateTransitionData(t, false, UserPK, IssuerPK, "User from genesis transition", "v3/user_from_genesis_state_to_first_transition_v3", false, false) - _, issuerSecondState := generateStateTransitionData(t, true, IssuerPK, UserPK, "Issuer from first to second transition", "v3/issuer_from_first_state_to_second_transition_v3", true, 1) - _, userSecondState := generateStateTransitionData(t, true, UserPK, IssuerPK, "User from first to second transition", "v3/user_from_first_state_to_second_transition_v3", false, 1) + _, issuerSecondState := generateStateTransitionData(t, true, IssuerPK, UserPK, "Issuer from first to second transition", "v3/issuer_from_first_state_to_second_transition_v3", true, false) + _, userSecondState := generateStateTransitionData(t, true, UserPK, IssuerPK, "User from first to second transition", "v3/user_from_first_state_to_second_transition_v3", false, false) - _, issuerAuthDisabledFirstState := generateStateTransitionData(t, false, IssuerPK, UserPK, "Issuer from genesis to first state transition auth disabled", "v3/issuer_from_genesis_state_to_first_auth_disabled_transition_v3", true, 0) + _, issuerAuthDisabledFirstState := generateStateTransitionData(t, false, IssuerPK, UserPK, "Issuer from genesis to first state transition auth disabled", "v3/issuer_from_genesis_state_to_first_auth_disabled_transition_v3", true, true) generateData(t, "BJJ: Issuer first state / user - genesis state", []*gistData{ {issuerId, issuerFirstState}, From 22ac304db229557a7010c282a1b03a082248ffc5 Mon Sep 17 00:00:00 2001 From: vbasiuk Date: Tue, 12 Dec 2023 15:47:08 +0200 Subject: [PATCH 09/14] add issuer genesis state test --- ...alid_bjj_user_first_issuer_genesis_v3.json | 1 + testvectorgen/contract_data/v3_test.go | 30 +++++++++++-------- 2 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_issuer_genesis_v3.json diff --git a/testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_issuer_genesis_v3.json b/testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_issuer_genesis_v3.json new file mode 100644 index 00000000..78b2d655 --- /dev/null +++ b/testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_issuer_genesis_v3.json @@ -0,0 +1 @@ +{"desc":"BJJ: Issuer genesis state / user - first state","inputs":{"requestID":"32","userGenesisID":"23273167900576580892722615617815475823351560716009055944677723144398443009","profileNonce":"0","claimSubjectProfileNonce":"999","authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimIncMtp":["13207060137112832590622170449916258240813695457675295794859213606138142493259","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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","challenge":"12345","challengeSignatureR8x":"15829360093371098546177008474519342171461782120259125067189481965541223738777","challengeSignatureR8y":"10840522802382821290541462398953040493080116495308402635486440290351677745960","challengeSignatureS":"1196477404779941775725836688033485533497812196897664950083199167075327114562","userClaimsTreeRoot":"11517767461750786409356202654343440087797799854420804212797270561286585478040","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"13421062220305656807332040413142908746386531813676548741852291985659124697073","gistRoot":"17324622488979108054416002082921608267177770116274256097215720923692895619238","gistMtp":["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","0"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","28275098119780158026040482722477442169764247619454891891569161278093595137","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["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"],"issuerClaimClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"2943483356559152311923412925436024635269538717812859789851139200242297094","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"2943483356559152311923412925436024635269538717812859789851139200242297094","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":0,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"5472508197866388381206604816325335748616914118588758490396973216283757878391","issuerClaimSignatureR8y":"487022569097765756306556955967994377058095043087439728980694573045440494288","issuerClaimSignatureS":"406364656466382933476187938784383717878849985640796393410767792675250006948","issuerAuthClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"1","issuerAuthClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"2943483356559152311923412925436024635269538717812859789851139200242297094","proofType":"1","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","authEnabled":1},"expOut":{"requestID":"32","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"2943483356559152311923412925436024635269538717812859789851139200242297094","circuitQueryHash":"12816522451235043383360844734477263990263633888892986646884788265975859605506","gistRoot":"17324622488979108054416002082921608267177770116274256097215720923692895619238","timestamp":"1642074362","merklized":"1","proofType":"1","isRevocationChecked":"1","challenge":"12345","issuerState":"2943483356559152311923412925436024635269538717812859789851139200242297094","linkID":"21264956840473518295367401759082248638554058714792654964349049745455799782226","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","operatorOutput":"0","nullifier":"21540438192236855564075143333896114176485819065040531615519987653057866936972","authEnabled":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/v3_test.go b/testvectorgen/contract_data/v3_test.go index 9bb2a386..83acb950 100644 --- a/testvectorgen/contract_data/v3_test.go +++ b/testvectorgen/contract_data/v3_test.go @@ -36,53 +36,57 @@ func Test_Generate_Test_CasesV3(t *testing.T) { generateData(t, "BJJ: Issuer first state / user - genesis state", []*gistData{ {issuerId, issuerFirstState}, - }, false, false, false, "v3/valid_bjj_user_genesis_v3", verifiable.BJJSignatureProofType, 1) + }, false, false, false, false, "v3/valid_bjj_user_genesis_v3", verifiable.BJJSignatureProofType, 1) generateData(t, "BJJ: Issuer first state / user first state - valid proof", []*gistData{ {issuerId, issuerFirstState}, {userId, userFirstState}, - }, true, false, false, "v3/valid_bjj_user_first_v3", verifiable.BJJSignatureProofType, 1) + }, true, false, false, false, "v3/valid_bjj_user_first_v3", verifiable.BJJSignatureProofType, 1) generateData(t, "BJJ: Issuer second state / user first state - valid proof", []*gistData{ {userId, userFirstState}, {issuerId, issuerSecondState}, - }, true, false, true, "v3/valid_bjj_user_first_issuer_second_v3", verifiable.BJJSignatureProofType, 1) + }, true, false, false, true, "v3/valid_bjj_user_first_issuer_second_v3", verifiable.BJJSignatureProofType, 1) generateData(t, "BJJ: Issuer first state / user second state - valid proof", []*gistData{ {userId, userSecondState}, {issuerId, issuerSecondState}, - }, true, true, false, "v3/valid_bjj_user_second_issuer_first_v3", verifiable.BJJSignatureProofType, 1) + }, true, true, false, false, "v3/valid_bjj_user_second_issuer_first_v3", verifiable.BJJSignatureProofType, 1) generateData(t, "BJJ: Issuer first state / user - genesis state - Auth Disabled", []*gistData{ {issuerId, issuerAuthDisabledFirstState}, - }, false, false, false, "v3/valid_bjj_user_genesis_auth_disabled_v3", verifiable.BJJSignatureProofType, 0) + }, false, false, false, false, "v3/valid_bjj_user_genesis_auth_disabled_v3", verifiable.BJJSignatureProofType, 0) // MTP Data: generateData(t, "MTP: Issuer first state / user - genesis state", []*gistData{ {issuerId, issuerFirstState}, - }, false, false, false, "v3/valid_mtp_user_genesis_v3", verifiable.Iden3SparseMerkleTreeProofType, 1) + }, false, false, false, false, "v3/valid_mtp_user_genesis_v3", verifiable.Iden3SparseMerkleTreeProofType, 1) generateData(t, "MTP: Issuer first state / user first state - valid proof", []*gistData{ {issuerId, issuerFirstState}, {userId, userFirstState}, - }, true, false, false, "v3/valid_mtp_user_first_v3", verifiable.Iden3SparseMerkleTreeProofType, 1) + }, true, false, false, false, "v3/valid_mtp_user_first_v3", verifiable.Iden3SparseMerkleTreeProofType, 1) generateData(t, "MTP: Issuer second state / user first state - valid proof", []*gistData{ {userId, userFirstState}, {issuerId, issuerSecondState}, - }, true, false, true, "v3/valid_mtp_user_first_issuer_second_v3", verifiable.Iden3SparseMerkleTreeProofType, 1) + }, true, false, false, true, "v3/valid_mtp_user_first_issuer_second_v3", verifiable.Iden3SparseMerkleTreeProofType, 1) generateData(t, "MTP: Issuer first state / user second state - valid proof", []*gistData{ {userId, userSecondState}, {issuerId, issuerSecondState}, - }, true, true, false, "v3/valid_mtp_user_second_issuer_first_v3", verifiable.Iden3SparseMerkleTreeProofType, 1) + }, true, true, false, false, "v3/valid_mtp_user_second_issuer_first_v3", verifiable.Iden3SparseMerkleTreeProofType, 1) generateData(t, "MTP: Issuer first state / user - genesis state - Auth Disabled", []*gistData{ {issuerId, issuerAuthDisabledFirstState}, - }, false, false, false, "v3/valid_mtp_user_genesis_auth_disabled_v3", verifiable.Iden3SparseMerkleTreeProofType, 0) + }, false, false, false, false, "v3/valid_mtp_user_genesis_auth_disabled_v3", verifiable.Iden3SparseMerkleTreeProofType, 0) + + generateData(t, "BJJ: Issuer genesis state / user - first state", []*gistData{ + {userId, userFirstState}, + }, true, false, true, false, "v3/valid_bjj_user_first_issuer_genesis_v3", verifiable.BJJSignatureProofType, 1) } -func generateData(t *testing.T, desc string, gistData []*gistData, userFirstState bool, userSecondState bool, issuerSecondState bool, fileName string, testProofType verifiable.ProofType, authEnabled int) { +func generateData(t *testing.T, desc string, gistData []*gistData, userFirstState bool, userSecondState bool, issuetGenesisState bool, issuerSecondState bool, fileName string, testProofType verifiable.ProofType, authEnabled int) { var linkNonce = "18" var nullifierSessionID string = "1234569" @@ -197,7 +201,9 @@ func generateData(t *testing.T, desc string, gistData []*gistData, userFirstStat issuerAuthClaimMtp, _ = issuer.ClaimMTP(t, issuer.AuthClaim) - issuer.AddClaim(t, claim) + if !issuetGenesisState { + issuer.AddClaim(t, claim) + } issuerClaimMtp, _ = issuer.ClaimMTP(t, claim) require.NoError(t, err) From ba721d5887011896fbf0860e9d83b762214f2b56 Mon Sep 17 00:00:00 2001 From: vmidyllic <74898029+vmidyllic@users.noreply.github.com> Date: Fri, 15 Dec 2023 12:20:56 +0200 Subject: [PATCH 10/14] fix disable data --- ...m_genesis_state_to_first_auth_disabled_transition_v3.json | 2 +- .../testdata/v3/valid_bjj_user_genesis_auth_disabled_v3.json | 2 +- .../testdata/v3/valid_mtp_user_genesis_auth_disabled_v3.json | 2 +- testvectorgen/contract_data/v3_test.go | 5 +++-- testvectorgen/utils/identity.go | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/testvectorgen/contract_data/testdata/v3/issuer_from_genesis_state_to_first_auth_disabled_transition_v3.json b/testvectorgen/contract_data/testdata/v3/issuer_from_genesis_state_to_first_auth_disabled_transition_v3.json index 226ed4c7..fe776f15 100644 --- a/testvectorgen/contract_data/testdata/v3/issuer_from_genesis_state_to_first_auth_disabled_transition_v3.json +++ b/testvectorgen/contract_data/testdata/v3/issuer_from_genesis_state_to_first_auth_disabled_transition_v3.json @@ -1 +1 @@ -{"desc":"Issuer from genesis to first state transition auth disabled","inputs":{"authClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"authClaimMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","claimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","isOldStateGenesis":"1","newUserState":"2849223435122160319995683834117043936973956790269185029065075688578869661987","oldUserState":"2943483356559152311923412925436024635269538717812859789851139200242297094","revTreeRoot":"0","rootsTreeRoot":"0","signatureR8x":"10840985367121317453505114787511079759115113480685824776514623091425578836533","signatureR8y":"6764078532564999956152857453836033052841878877532817390400284512073490999004","signatureS":"2618611783882973181590468694831749514310039533059364632457696282630770942958","userID":"22057981499787921734624217749308316644136637822444794206796063681866502657","newAuthClaimMtp":["0","0","20623464549709321670943344492127400563881045962377531782738695004685340859426","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"],"newClaimsTreeRoot":"10117283230230945737287913517688864980798731012859639202846398587175949994464","newRevTreeRoot":"0","newRootsTreeRoot":"0"},"expOut":{"userID":"22057981499787921734624217749308316644136637822444794206796063681866502657","newUserState":"2849223435122160319995683834117043936973956790269185029065075688578869661987","oldUserState":"2943483356559152311923412925436024635269538717812859789851139200242297094","isOldStateGenesis":"1"}} \ No newline at end of file +{"desc":"Issuer from genesis to first state transition auth disabled","inputs":{"authClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"authClaimMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","claimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","isOldStateGenesis":"1","newUserState":"16911470968637303012243682196661900599310735102088601053412602445232291023376","oldUserState":"2943483356559152311923412925436024635269538717812859789851139200242297094","revTreeRoot":"0","rootsTreeRoot":"0","signatureR8x":"6055007916370395440241368074378803183735265842397698615876047803550833683683","signatureR8y":"4872208054774906551568681694668750975331936169017534092424897406151874209559","signatureS":"125031726448571319012692019236238277431541320790549797177561293546182573617","userID":"22057981499787921734624217749308316644136637822444794206796063681866502657","newAuthClaimMtp":["13920276944617505795695040137217047491277370733762537940694152855508976797992","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"],"newClaimsTreeRoot":"21086184659407650088304758971704784731045378328290753732498060536509438840420","newRevTreeRoot":"0","newRootsTreeRoot":"0"},"expOut":{"userID":"22057981499787921734624217749308316644136637822444794206796063681866502657","newUserState":"16911470968637303012243682196661900599310735102088601053412602445232291023376","oldUserState":"2943483356559152311923412925436024635269538717812859789851139200242297094","isOldStateGenesis":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/valid_bjj_user_genesis_auth_disabled_v3.json b/testvectorgen/contract_data/testdata/v3/valid_bjj_user_genesis_auth_disabled_v3.json index ff229220..778a4542 100644 --- a/testvectorgen/contract_data/testdata/v3/valid_bjj_user_genesis_auth_disabled_v3.json +++ b/testvectorgen/contract_data/testdata/v3/valid_bjj_user_genesis_auth_disabled_v3.json @@ -1 +1 @@ -{"desc":"BJJ: Issuer first state / user - genesis state - Auth Disabled","inputs":{"requestID":"32","userGenesisID":"23006274145546572515053798212160025855323582904648170675239778444296327681","profileNonce":"0","claimSubjectProfileNonce":"999","authClaim":["0","0","0","0","0","0","0","0"],"authClaimIncMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"0","challenge":"583091486781463398742321306787801699791102451699","challengeSignatureR8x":"0","challengeSignatureR8y":"0","challengeSignatureS":"0","userClaimsTreeRoot":"0","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"5317387130258456662214331362918410991734007599705406860481038345552731150762","gistRoot":"0","gistMtp":["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","0"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","25332005985822486934643366384342584313524543868409105416725059803960840705","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["0","0","20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"10117283230230945737287913517688864980798731012859639202846398587175949994464","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"2849223435122160319995683834117043936973956790269185029065075688578869661987","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"10117283230230945737287913517688864980798731012859639202846398587175949994464","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"2849223435122160319995683834117043936973956790269185029065075688578869661987","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":0,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"9725314054820182574856811109563426514760165252038879818462104420204416609328","issuerClaimSignatureR8y":"393631288379660520473719256622560377195511013022299349456897666482424652359","issuerClaimSignatureS":"1062724383590809628467750714676231693286167812523349158229736854255057448415","issuerAuthClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"1","issuerAuthClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"2943483356559152311923412925436024635269538717812859789851139200242297094","proofType":"1","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","authEnabled":0},"expOut":{"requestID":"32","userID":"23006274145546572515053798212160025855323582904648170675239778444296327681","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"2849223435122160319995683834117043936973956790269185029065075688578869661987","circuitQueryHash":"12816522451235043383360844734477263990263633888892986646884788265975859605506","gistRoot":"0","timestamp":"1642074362","merklized":"1","proofType":"1","isRevocationChecked":"1","challenge":"583091486781463398742321306787801699791102451699","issuerState":"2943483356559152311923412925436024635269538717812859789851139200242297094","linkID":"9069846887849371523003626710972036591531592782403850230651851545348605982450","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","operatorOutput":"0","nullifier":"2391236256579199361493361173175703926943529965960611924494830154382898472529","authEnabled":"0"}} \ No newline at end of file +{"desc":"BJJ: Issuer first state / user - genesis state - Auth Disabled","inputs":{"requestID":"32","userGenesisID":"23013175891893363078841232968022302880776034013620341061794940968520126978","profileNonce":"0","claimSubjectProfileNonce":"0","authClaim":["0","0","0","0","0","0","0","0"],"authClaimIncMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"0","challenge":"583091486781463398742321306787801699791102451699","challengeSignatureR8x":"0","challengeSignatureR8y":"0","challengeSignatureS":"0","userClaimsTreeRoot":"0","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"5317387130258456662214331362918410991734007599705406860481038345552731150762","gistRoot":"0","gistMtp":["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","0"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","23013175891893363078841232968022302880776034013620341061794940968520126978","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"21086184659407650088304758971704784731045378328290753732498060536509438840420","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"16911470968637303012243682196661900599310735102088601053412602445232291023376","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"21086184659407650088304758971704784731045378328290753732498060536509438840420","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"16911470968637303012243682196661900599310735102088601053412602445232291023376","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":0,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"13911499604753673789524925237974757852442326056619123998177153091271750751494","issuerClaimSignatureR8y":"4410585813456846388673758578760540047188245171012977452212359210567823951539","issuerClaimSignatureS":"343558701522070187271580522311771620354018236796846256744643794818586520785","issuerAuthClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"1","issuerAuthClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"2943483356559152311923412925436024635269538717812859789851139200242297094","proofType":"1","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","authEnabled":0},"expOut":{"requestID":"32","userID":"23013175891893363078841232968022302880776034013620341061794940968520126978","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"16911470968637303012243682196661900599310735102088601053412602445232291023376","circuitQueryHash":"12816522451235043383360844734477263990263633888892986646884788265975859605506","gistRoot":"0","timestamp":"1642074362","merklized":"1","proofType":"1","isRevocationChecked":"1","challenge":"583091486781463398742321306787801699791102451699","issuerState":"2943483356559152311923412925436024635269538717812859789851139200242297094","linkID":"19823993270096139446564592922993947503208333537792611306066620392561342309875","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","operatorOutput":"0","nullifier":"0","authEnabled":"0"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/valid_mtp_user_genesis_auth_disabled_v3.json b/testvectorgen/contract_data/testdata/v3/valid_mtp_user_genesis_auth_disabled_v3.json index b57fffd3..2c115ebd 100644 --- a/testvectorgen/contract_data/testdata/v3/valid_mtp_user_genesis_auth_disabled_v3.json +++ b/testvectorgen/contract_data/testdata/v3/valid_mtp_user_genesis_auth_disabled_v3.json @@ -1 +1 @@ -{"desc":"MTP: Issuer first state / user - genesis state - Auth Disabled","inputs":{"requestID":"32","userGenesisID":"23006274145546572515053798212160025855323582904648170675239778444296327681","profileNonce":"0","claimSubjectProfileNonce":"999","authClaim":["0","0","0","0","0","0","0","0"],"authClaimIncMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"0","challenge":"583091486781463398742321306787801699791102451699","challengeSignatureR8x":"0","challengeSignatureR8y":"0","challengeSignatureS":"0","userClaimsTreeRoot":"0","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"5317387130258456662214331362918410991734007599705406860481038345552731150762","gistRoot":"0","gistMtp":["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","0"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","25332005985822486934643366384342584313524543868409105416725059803960840705","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["0","0","20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"10117283230230945737287913517688864980798731012859639202846398587175949994464","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"2849223435122160319995683834117043936973956790269185029065075688578869661987","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"10117283230230945737287913517688864980798731012859639202846398587175949994464","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"2849223435122160319995683834117043936973956790269185029065075688578869661987","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":2,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"0","issuerClaimSignatureR8y":"0","issuerClaimSignatureS":"0","issuerAuthClaim":["0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"0","issuerAuthClaimsTreeRoot":"0","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"0","proofType":"2","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","authEnabled":0},"expOut":{"requestID":"32","userID":"23006274145546572515053798212160025855323582904648170675239778444296327681","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"2849223435122160319995683834117043936973956790269185029065075688578869661987","circuitQueryHash":"16085407811791493874423550911889456452275693306656061172817544983916814452534","gistRoot":"0","timestamp":"1642074362","merklized":"1","proofType":"2","isRevocationChecked":"1","challenge":"583091486781463398742321306787801699791102451699","issuerState":"2849223435122160319995683834117043936973956790269185029065075688578869661987","linkID":"9069846887849371523003626710972036591531592782403850230651851545348605982450","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","operatorOutput":"0","nullifier":"2391236256579199361493361173175703926943529965960611924494830154382898472529","authEnabled":"0"}} \ No newline at end of file +{"desc":"MTP: Issuer first state / user - genesis state - Auth Disabled","inputs":{"requestID":"32","userGenesisID":"23013175891893363078841232968022302880776034013620341061794940968520126978","profileNonce":"0","claimSubjectProfileNonce":"0","authClaim":["0","0","0","0","0","0","0","0"],"authClaimIncMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"0","challenge":"583091486781463398742321306787801699791102451699","challengeSignatureR8x":"0","challengeSignatureR8y":"0","challengeSignatureS":"0","userClaimsTreeRoot":"0","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"5317387130258456662214331362918410991734007599705406860481038345552731150762","gistRoot":"0","gistMtp":["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","0"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","23013175891893363078841232968022302880776034013620341061794940968520126978","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"21086184659407650088304758971704784731045378328290753732498060536509438840420","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"16911470968637303012243682196661900599310735102088601053412602445232291023376","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"21086184659407650088304758971704784731045378328290753732498060536509438840420","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"16911470968637303012243682196661900599310735102088601053412602445232291023376","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":2,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"0","issuerClaimSignatureR8y":"0","issuerClaimSignatureS":"0","issuerAuthClaim":["0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"0","issuerAuthClaimsTreeRoot":"0","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"0","proofType":"2","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","authEnabled":0},"expOut":{"requestID":"32","userID":"23013175891893363078841232968022302880776034013620341061794940968520126978","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"16911470968637303012243682196661900599310735102088601053412602445232291023376","circuitQueryHash":"16085407811791493874423550911889456452275693306656061172817544983916814452534","gistRoot":"0","timestamp":"1642074362","merklized":"1","proofType":"2","isRevocationChecked":"1","challenge":"583091486781463398742321306787801699791102451699","issuerState":"16911470968637303012243682196661900599310735102088601053412602445232291023376","linkID":"19823993270096139446564592922993947503208333537792611306066620392561342309875","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","operatorOutput":"0","nullifier":"0","authEnabled":"0"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/v3_test.go b/testvectorgen/contract_data/v3_test.go index 83acb950..93b47eca 100644 --- a/testvectorgen/contract_data/v3_test.go +++ b/testvectorgen/contract_data/v3_test.go @@ -32,7 +32,7 @@ func Test_Generate_Test_CasesV3(t *testing.T) { _, issuerSecondState := generateStateTransitionData(t, true, IssuerPK, UserPK, "Issuer from first to second transition", "v3/issuer_from_first_state_to_second_transition_v3", true, false) _, userSecondState := generateStateTransitionData(t, true, UserPK, IssuerPK, "User from first to second transition", "v3/user_from_first_state_to_second_transition_v3", false, false) - _, issuerAuthDisabledFirstState := generateStateTransitionData(t, false, IssuerPK, UserPK, "Issuer from genesis to first state transition auth disabled", "v3/issuer_from_genesis_state_to_first_auth_disabled_transition_v3", true, true) + _, issuerAuthDisabledFirstState := generateStateTransitionData(t, false, IssuerPK, UserPK, "Issuer from genesis to first state transition auth disabled", "v3/issuer_from_genesis_state_to_first_auth_disabled_transition_v3", false, true) generateData(t, "BJJ: Issuer first state / user - genesis state", []*gistData{ {issuerId, issuerFirstState}, @@ -107,6 +107,7 @@ func generateData(t *testing.T, desc string, gistData []*gistData, userFirstStat } else { // generate onchain identity user = utils.NewEthereumBasedIdentity(t, ethAddress) + nullifierSessionID = "0" } issuer := utils.NewIdentity(t, IssuerPK) @@ -116,7 +117,7 @@ func generateData(t *testing.T, desc string, gistData []*gistData, userFirstStat subjectID := user.ID var nonceSubject = new(big.Int) - if isSubjectIDProfile { + if isSubjectIDProfile && authEnabled == 1 { nonceSubject = big.NewInt(999) subjectID, err = core.ProfileID(user.ID, nonceSubject) require.NoError(t, err) diff --git a/testvectorgen/utils/identity.go b/testvectorgen/utils/identity.go index fd6ad38f..6bcf079b 100644 --- a/testvectorgen/utils/identity.go +++ b/testvectorgen/utils/identity.go @@ -198,7 +198,7 @@ func NewEthereumBasedIdentity(t testing.TB, ethAddr string) *IdentityTest { t.Fatalf("Error creating genesis state from address: %v", err) } - didType, err := core.BuildDIDType(core.DIDMethodIden3, core.Polygon, core.Mumbai) + didType, err := core.BuildDIDType(core.DIDMethodPolygonID, core.Polygon, core.Mumbai) if err != nil { t.Fatalf("Error creating did type: %v", err) } From 8cf38b444601c38dce5433edb9ba1190c2af5618 Mon Sep 17 00:00:00 2001 From: vmidyllic <74898029+vmidyllic@users.noreply.github.com> Date: Fri, 1 Mar 2024 11:06:15 +0200 Subject: [PATCH 11/14] update --- package.json | 2 +- .../credentialAtomicQueryV3OnChain.test.ts | 56 ++++---- ...m_first_state_to_second_transition_v3.json | 1 - ..._to_first_auth_disabled_transition_v3.json | 1 - ..._genesis_state_to_first_transition_v3.json | 1 - ...m_first_state_to_second_transition_v3.json | 1 - ..._genesis_state_to_first_transition_v3.json | 1 - ...alid_bjj_user_first_issuer_genesis_v3.json | 1 - ...valid_bjj_user_first_issuer_second_v3.json | 1 - .../testdata/v3/valid_bjj_user_first_v3.json | 1 - ...lid_bjj_user_genesis_auth_disabled_v3.json | 1 - .../v3/valid_bjj_user_genesis_v3.json | 1 - ...valid_bjj_user_second_issuer_first_v3.json | 1 - ...valid_mtp_user_first_issuer_second_v3.json | 1 - .../testdata/v3/valid_mtp_user_first_v3.json | 1 - ...lid_mtp_user_genesis_auth_disabled_v3.json | 1 - .../v3/valid_mtp_user_genesis_v3.json | 1 - ...valid_mtp_user_second_issuer_first_v3.json | 1 - testvectorgen/contract_data/v3_test.go | 128 +++++++++--------- .../v3/testdata/mtp/onchainIdentity.json | 2 +- .../v3/testdata/sig/onchainIdentity.json | 2 +- .../credentials/onchain/v3/v3_test.go | 9 +- update-contract-data-v3.js | 12 +- 23 files changed, 105 insertions(+), 122 deletions(-) delete mode 100644 testvectorgen/contract_data/testdata/v3/issuer_from_first_state_to_second_transition_v3.json delete mode 100644 testvectorgen/contract_data/testdata/v3/issuer_from_genesis_state_to_first_auth_disabled_transition_v3.json delete mode 100644 testvectorgen/contract_data/testdata/v3/issuer_from_genesis_state_to_first_transition_v3.json delete mode 100644 testvectorgen/contract_data/testdata/v3/user_from_first_state_to_second_transition_v3.json delete mode 100644 testvectorgen/contract_data/testdata/v3/user_from_genesis_state_to_first_transition_v3.json delete mode 100644 testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_issuer_genesis_v3.json delete mode 100644 testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_issuer_second_v3.json delete mode 100644 testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_v3.json delete mode 100644 testvectorgen/contract_data/testdata/v3/valid_bjj_user_genesis_auth_disabled_v3.json delete mode 100644 testvectorgen/contract_data/testdata/v3/valid_bjj_user_genesis_v3.json delete mode 100644 testvectorgen/contract_data/testdata/v3/valid_bjj_user_second_issuer_first_v3.json delete mode 100644 testvectorgen/contract_data/testdata/v3/valid_mtp_user_first_issuer_second_v3.json delete mode 100644 testvectorgen/contract_data/testdata/v3/valid_mtp_user_first_v3.json delete mode 100644 testvectorgen/contract_data/testdata/v3/valid_mtp_user_genesis_auth_disabled_v3.json delete mode 100644 testvectorgen/contract_data/testdata/v3/valid_mtp_user_genesis_v3.json delete mode 100644 testvectorgen/contract_data/testdata/v3/valid_mtp_user_second_issuer_first_v3.json diff --git a/package.json b/package.json index 6ec55302..92a152a1 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "clean": "rm -fR dist", "build": "npm run clean && ./node_modules/.bin/tsc --strictNullChecks", - "test": "./node_modules/.bin/mocha --timeout 5000 -p -r ts-node/register 'test/**/*.test.ts'" + "test": "./node_modules/.bin/mocha --timeout 5000 -r ts-node/register 'test/**/*.test.ts'" }, "license": "GPL-3.0", "dependencies": { diff --git a/test/onchain/credentialAtomicQueryV3OnChain.test.ts b/test/onchain/credentialAtomicQueryV3OnChain.test.ts index dc9d40a0..30a1e87d 100644 --- a/test/onchain/credentialAtomicQueryV3OnChain.test.ts +++ b/test/onchain/credentialAtomicQueryV3OnChain.test.ts @@ -4,7 +4,7 @@ import {describe} from "mocha"; const path = require("path"); const wasmTester = require("circom_tester").wasm; -describe("Test credentialAtomicQueryV3OnChain.circom", function () { +describe.only("Test credentialAtomicQueryV3OnChain.circom", function () { this.timeout(600000); @@ -30,37 +30,35 @@ describe("Test credentialAtomicQueryV3OnChain.circom", function () { const tests = [ // sig - require(`${sigBasePath}/claimIssuedOnProfileID.json`), - require(`${sigBasePath}/claimIssuedOnProfileID2.json`), - require(`${sigBasePath}/claimIssuedOnUserID.json`), - require(`${sigBasePath}/profileID_subject_userid.json`), - require(`${sigBasePath}/claimNonMerklized.json`), - require(`${sigBasePath}/claimWithLinkNonce.json`), - require(`${sigBasePath}/between_operator.json`), - require(`${sigBasePath}/less_than_eq_operator.json`), - require(`${sigBasePath}/selective_disclosure.json`), - require(`${sigBasePath}/nullify.json`), - require(`${sigBasePath}/revoked_claim_without_revocation_check.json`), - require(`${sigBasePath}/jsonld_non_inclusion.json`), - require(`${sigBasePath}/auth_check_disabled.json`), - require(`${sigBasePath}/noop_operator.json`), + // require(`${sigBasePath}/claimIssuedOnProfileID.json`), + // require(`${sigBasePath}/claimIssuedOnProfileID2.json`), + // require(`${sigBasePath}/claimIssuedOnUserID.json`), + // require(`${sigBasePath}/profileID_subject_userid.json`), + // require(`${sigBasePath}/claimNonMerklized.json`), + // require(`${sigBasePath}/claimWithLinkNonce.json`), + // require(`${sigBasePath}/between_operator.json`), + // require(`${sigBasePath}/less_than_eq_operator.json`), + // require(`${sigBasePath}/selective_disclosure.json`), + // require(`${sigBasePath}/nullify.json`), + // require(`${sigBasePath}/revoked_claim_without_revocation_check.json`), + // require(`${sigBasePath}/jsonld_non_inclusion.json`), + // require(`${sigBasePath}/noop_operator.json`), require(`${sigBasePath}/onchainIdentity.json`), // mtp - require(`${mtpBasePath}/claimIssuedOnProfileID.json`), - require(`${mtpBasePath}/claimIssuedOnProfileID2.json`), - require(`${mtpBasePath}/claimIssuedOnUserID.json`), - require(`${mtpBasePath}/profileID_subject_userid.json`), - require(`${mtpBasePath}/claimNonMerklized.json`), - require(`${mtpBasePath}/claimWithLinkNonce.json`), - require(`${mtpBasePath}/between_operator.json`), - require(`${mtpBasePath}/less_than_eq_operator.json`), - require(`${mtpBasePath}/selective_disclosure.json`), - require(`${mtpBasePath}/nullify.json`), - require(`${mtpBasePath}/revoked_claim_without_revocation_check.json`), - require(`${mtpBasePath}/auth_check_disabled.json`), - require(`${mtpBasePath}/noop_operator.json`), - require(`${mtpBasePath}/onchainIdentity.json`), + // require(`${mtpBasePath}/claimIssuedOnProfileID.json`), + // require(`${mtpBasePath}/claimIssuedOnProfileID2.json`), + // require(`${mtpBasePath}/claimIssuedOnUserID.json`), + // require(`${mtpBasePath}/profileID_subject_userid.json`), + // require(`${mtpBasePath}/claimNonMerklized.json`), + // require(`${mtpBasePath}/claimWithLinkNonce.json`), + // require(`${mtpBasePath}/between_operator.json`), + // require(`${mtpBasePath}/less_than_eq_operator.json`), + // require(`${mtpBasePath}/selective_disclosure.json`), + // require(`${mtpBasePath}/nullify.json`), + // require(`${mtpBasePath}/revoked_claim_without_revocation_check.json`), + // require(`${mtpBasePath}/noop_operator.json`), + // require(`${mtpBasePath}/onchainIdentity.json`), ]; tests.forEach(({ desc, inputs, expOut }) => { diff --git a/testvectorgen/contract_data/testdata/v3/issuer_from_first_state_to_second_transition_v3.json b/testvectorgen/contract_data/testdata/v3/issuer_from_first_state_to_second_transition_v3.json deleted file mode 100644 index 94277687..00000000 --- a/testvectorgen/contract_data/testdata/v3/issuer_from_first_state_to_second_transition_v3.json +++ /dev/null @@ -1 +0,0 @@ -{"desc":"Issuer from first to second transition","inputs":{"authClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"authClaimMtp":["19312094904764700753580612047626022747021351711405324310595042214387140174291","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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","claimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","isOldStateGenesis":"0","newUserState":"16808564267715042565747150526413707826810779846518769996187201048333752158039","oldUserState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","revTreeRoot":"0","rootsTreeRoot":"0","signatureR8x":"4451980901190234783172959675720220799783150745288796139848355680802504233563","signatureR8y":"10290932997226499735765510823191924674555389218679230413227916096690464459049","signatureS":"1163959203067016102828885602064348515581217594742167104031647043621998266749","userID":"22057981499787921734624217749308316644136637822444794206796063681866502657","newAuthClaimMtp":["19312094904764700753580612047626022747021351711405324310595042214387140174291","0","1026244475062489506222121556222727427439303688002450713661892202849270557156","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"],"newClaimsTreeRoot":"12485282917430521519505497335419247027529713129159393099659489490556962297749","newRevTreeRoot":"0","newRootsTreeRoot":"0"},"expOut":{"userID":"22057981499787921734624217749308316644136637822444794206796063681866502657","newUserState":"16808564267715042565747150526413707826810779846518769996187201048333752158039","oldUserState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","isOldStateGenesis":"0"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/issuer_from_genesis_state_to_first_auth_disabled_transition_v3.json b/testvectorgen/contract_data/testdata/v3/issuer_from_genesis_state_to_first_auth_disabled_transition_v3.json deleted file mode 100644 index fe776f15..00000000 --- a/testvectorgen/contract_data/testdata/v3/issuer_from_genesis_state_to_first_auth_disabled_transition_v3.json +++ /dev/null @@ -1 +0,0 @@ -{"desc":"Issuer from genesis to first state transition auth disabled","inputs":{"authClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"authClaimMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","claimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","isOldStateGenesis":"1","newUserState":"16911470968637303012243682196661900599310735102088601053412602445232291023376","oldUserState":"2943483356559152311923412925436024635269538717812859789851139200242297094","revTreeRoot":"0","rootsTreeRoot":"0","signatureR8x":"6055007916370395440241368074378803183735265842397698615876047803550833683683","signatureR8y":"4872208054774906551568681694668750975331936169017534092424897406151874209559","signatureS":"125031726448571319012692019236238277431541320790549797177561293546182573617","userID":"22057981499787921734624217749308316644136637822444794206796063681866502657","newAuthClaimMtp":["13920276944617505795695040137217047491277370733762537940694152855508976797992","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"],"newClaimsTreeRoot":"21086184659407650088304758971704784731045378328290753732498060536509438840420","newRevTreeRoot":"0","newRootsTreeRoot":"0"},"expOut":{"userID":"22057981499787921734624217749308316644136637822444794206796063681866502657","newUserState":"16911470968637303012243682196661900599310735102088601053412602445232291023376","oldUserState":"2943483356559152311923412925436024635269538717812859789851139200242297094","isOldStateGenesis":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/issuer_from_genesis_state_to_first_transition_v3.json b/testvectorgen/contract_data/testdata/v3/issuer_from_genesis_state_to_first_transition_v3.json deleted file mode 100644 index 36192a58..00000000 --- a/testvectorgen/contract_data/testdata/v3/issuer_from_genesis_state_to_first_transition_v3.json +++ /dev/null @@ -1 +0,0 @@ -{"desc":"Issuer from genesis to first state transition","inputs":{"authClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"authClaimMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","claimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","isOldStateGenesis":"1","newUserState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","oldUserState":"2943483356559152311923412925436024635269538717812859789851139200242297094","revTreeRoot":"0","rootsTreeRoot":"0","signatureR8x":"2085592444220100326031338035383829664902376711585650942234781493730544258667","signatureR8y":"14433656182623287405033639342255910220233755175759851077473054657433804146039","signatureS":"2016166231820509407081569470848556903128858457395765589051625149205478199879","userID":"22057981499787921734624217749308316644136637822444794206796063681866502657","newAuthClaimMtp":["19312094904764700753580612047626022747021351711405324310595042214387140174291","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"],"newClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","newRevTreeRoot":"0","newRootsTreeRoot":"0"},"expOut":{"userID":"22057981499787921734624217749308316644136637822444794206796063681866502657","newUserState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","oldUserState":"2943483356559152311923412925436024635269538717812859789851139200242297094","isOldStateGenesis":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/user_from_first_state_to_second_transition_v3.json b/testvectorgen/contract_data/testdata/v3/user_from_first_state_to_second_transition_v3.json deleted file mode 100644 index 7a3bdcfe..00000000 --- a/testvectorgen/contract_data/testdata/v3/user_from_first_state_to_second_transition_v3.json +++ /dev/null @@ -1 +0,0 @@ -{"desc":"User from first to second transition","inputs":{"authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimMtp":["13207060137112832590622170449916258240813695457675295794859213606138142493259","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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","claimsTreeRoot":"11517767461750786409356202654343440087797799854420804212797270561286585478040","isOldStateGenesis":"0","newUserState":"14535482911083887650400775180811767777795251060472677534187665389233265353111","oldUserState":"13421062220305656807332040413142908746386531813676548741852291985659124697073","revTreeRoot":"0","rootsTreeRoot":"0","signatureR8x":"21425994227874849639621713954801342411347583342842970532936629246020892133979","signatureR8y":"15086628426692843647015969499067295691377525479353419204848333228839773797664","signatureS":"1087623318161920118901441488147535273639798840670857417654471854266718085600","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","newAuthClaimMtp":["5916548408689195262080688487922161094620378143892746801536708302227694602463","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"],"newClaimsTreeRoot":"2598859270528411339367298518235341436604032965606770354648007040260316541053","newRevTreeRoot":"0","newRootsTreeRoot":"0"},"expOut":{"userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","newUserState":"14535482911083887650400775180811767777795251060472677534187665389233265353111","oldUserState":"13421062220305656807332040413142908746386531813676548741852291985659124697073","isOldStateGenesis":"0"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/user_from_genesis_state_to_first_transition_v3.json b/testvectorgen/contract_data/testdata/v3/user_from_genesis_state_to_first_transition_v3.json deleted file mode 100644 index 36c57b7f..00000000 --- a/testvectorgen/contract_data/testdata/v3/user_from_genesis_state_to_first_transition_v3.json +++ /dev/null @@ -1 +0,0 @@ -{"desc":"User from genesis transition","inputs":{"authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","claimsTreeRoot":"8162166103065016664685834856644195001371303013149727027131225893397958846382","isOldStateGenesis":"1","newUserState":"13421062220305656807332040413142908746386531813676548741852291985659124697073","oldUserState":"8039964009611210398788855768060749920589777058607598891238307089541758339342","revTreeRoot":"0","rootsTreeRoot":"0","signatureR8x":"449961878051830467803752640078635067041152234952600107462840793233843410165","signatureR8y":"7845209675226400751229009492576094478976760100350782830991248199240406213644","signatureS":"2039418463851899709325993105750594622966343716085071139691800933351597638583","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","newAuthClaimMtp":["13207060137112832590622170449916258240813695457675295794859213606138142493259","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"],"newClaimsTreeRoot":"11517767461750786409356202654343440087797799854420804212797270561286585478040","newRevTreeRoot":"0","newRootsTreeRoot":"0"},"expOut":{"userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","newUserState":"13421062220305656807332040413142908746386531813676548741852291985659124697073","oldUserState":"8039964009611210398788855768060749920589777058607598891238307089541758339342","isOldStateGenesis":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_issuer_genesis_v3.json b/testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_issuer_genesis_v3.json deleted file mode 100644 index 78b2d655..00000000 --- a/testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_issuer_genesis_v3.json +++ /dev/null @@ -1 +0,0 @@ -{"desc":"BJJ: Issuer genesis state / user - first state","inputs":{"requestID":"32","userGenesisID":"23273167900576580892722615617815475823351560716009055944677723144398443009","profileNonce":"0","claimSubjectProfileNonce":"999","authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimIncMtp":["13207060137112832590622170449916258240813695457675295794859213606138142493259","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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","challenge":"12345","challengeSignatureR8x":"15829360093371098546177008474519342171461782120259125067189481965541223738777","challengeSignatureR8y":"10840522802382821290541462398953040493080116495308402635486440290351677745960","challengeSignatureS":"1196477404779941775725836688033485533497812196897664950083199167075327114562","userClaimsTreeRoot":"11517767461750786409356202654343440087797799854420804212797270561286585478040","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"13421062220305656807332040413142908746386531813676548741852291985659124697073","gistRoot":"17324622488979108054416002082921608267177770116274256097215720923692895619238","gistMtp":["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","0"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","28275098119780158026040482722477442169764247619454891891569161278093595137","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["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"],"issuerClaimClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"2943483356559152311923412925436024635269538717812859789851139200242297094","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"2943483356559152311923412925436024635269538717812859789851139200242297094","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":0,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"5472508197866388381206604816325335748616914118588758490396973216283757878391","issuerClaimSignatureR8y":"487022569097765756306556955967994377058095043087439728980694573045440494288","issuerClaimSignatureS":"406364656466382933476187938784383717878849985640796393410767792675250006948","issuerAuthClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"1","issuerAuthClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"2943483356559152311923412925436024635269538717812859789851139200242297094","proofType":"1","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","authEnabled":1},"expOut":{"requestID":"32","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"2943483356559152311923412925436024635269538717812859789851139200242297094","circuitQueryHash":"12816522451235043383360844734477263990263633888892986646884788265975859605506","gistRoot":"17324622488979108054416002082921608267177770116274256097215720923692895619238","timestamp":"1642074362","merklized":"1","proofType":"1","isRevocationChecked":"1","challenge":"12345","issuerState":"2943483356559152311923412925436024635269538717812859789851139200242297094","linkID":"21264956840473518295367401759082248638554058714792654964349049745455799782226","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","operatorOutput":"0","nullifier":"21540438192236855564075143333896114176485819065040531615519987653057866936972","authEnabled":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_issuer_second_v3.json b/testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_issuer_second_v3.json deleted file mode 100644 index 9a367201..00000000 --- a/testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_issuer_second_v3.json +++ /dev/null @@ -1 +0,0 @@ -{"desc":"BJJ: Issuer second state / user first state - valid proof","inputs":{"requestID":"32","userGenesisID":"23273167900576580892722615617815475823351560716009055944677723144398443009","profileNonce":"0","claimSubjectProfileNonce":"999","authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimIncMtp":["13207060137112832590622170449916258240813695457675295794859213606138142493259","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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","challenge":"12345","challengeSignatureR8x":"15829360093371098546177008474519342171461782120259125067189481965541223738777","challengeSignatureR8y":"10840522802382821290541462398953040493080116495308402635486440290351677745960","challengeSignatureS":"1196477404779941775725836688033485533497812196897664950083199167075327114562","userClaimsTreeRoot":"11517767461750786409356202654343440087797799854420804212797270561286585478040","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"13421062220305656807332040413142908746386531813676548741852291985659124697073","gistRoot":"3246149973995767198551331195301279032661034567528700100008644394827230835249","gistMtp":["0","0","0","0","0","6097144699697903255302393350153793559547643885208447897492320561902595462726","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"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","28275098119780158026040482722477442169764247619454891891569161278093595137","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"12485282917430521519505497335419247027529713129159393099659489490556962297749","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"16808564267715042565747150526413707826810779846518769996187201048333752158039","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":0,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"5472508197866388381206604816325335748616914118588758490396973216283757878391","issuerClaimSignatureR8y":"487022569097765756306556955967994377058095043087439728980694573045440494288","issuerClaimSignatureS":"406364656466382933476187938784383717878849985640796393410767792675250006948","issuerAuthClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"1","issuerAuthClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"2943483356559152311923412925436024635269538717812859789851139200242297094","proofType":"1","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","authEnabled":1},"expOut":{"requestID":"32","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"16808564267715042565747150526413707826810779846518769996187201048333752158039","circuitQueryHash":"12816522451235043383360844734477263990263633888892986646884788265975859605506","gistRoot":"3246149973995767198551331195301279032661034567528700100008644394827230835249","timestamp":"1642074362","merklized":"1","proofType":"1","isRevocationChecked":"1","challenge":"12345","issuerState":"2943483356559152311923412925436024635269538717812859789851139200242297094","linkID":"21264956840473518295367401759082248638554058714792654964349049745455799782226","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","operatorOutput":"0","nullifier":"21540438192236855564075143333896114176485819065040531615519987653057866936972","authEnabled":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_v3.json b/testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_v3.json deleted file mode 100644 index 0f6a41bb..00000000 --- a/testvectorgen/contract_data/testdata/v3/valid_bjj_user_first_v3.json +++ /dev/null @@ -1 +0,0 @@ -{"desc":"BJJ: Issuer first state / user first state - valid proof","inputs":{"requestID":"32","userGenesisID":"23273167900576580892722615617815475823351560716009055944677723144398443009","profileNonce":"0","claimSubjectProfileNonce":"999","authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimIncMtp":["13207060137112832590622170449916258240813695457675295794859213606138142493259","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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","challenge":"12345","challengeSignatureR8x":"15829360093371098546177008474519342171461782120259125067189481965541223738777","challengeSignatureR8y":"10840522802382821290541462398953040493080116495308402635486440290351677745960","challengeSignatureS":"1196477404779941775725836688033485533497812196897664950083199167075327114562","userClaimsTreeRoot":"11517767461750786409356202654343440087797799854420804212797270561286585478040","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"13421062220305656807332040413142908746386531813676548741852291985659124697073","gistRoot":"20586831885098765093977645199183344896684103637972080672236708215043596614295","gistMtp":["0","0","0","0","0","17553467291814895170405188828004896559375980578450652516838963090977259468266","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"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","28275098119780158026040482722477442169764247619454891891569161278093595137","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":0,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"5472508197866388381206604816325335748616914118588758490396973216283757878391","issuerClaimSignatureR8y":"487022569097765756306556955967994377058095043087439728980694573045440494288","issuerClaimSignatureS":"406364656466382933476187938784383717878849985640796393410767792675250006948","issuerAuthClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"1","issuerAuthClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"2943483356559152311923412925436024635269538717812859789851139200242297094","proofType":"1","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","authEnabled":1},"expOut":{"requestID":"32","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","circuitQueryHash":"12816522451235043383360844734477263990263633888892986646884788265975859605506","gistRoot":"20586831885098765093977645199183344896684103637972080672236708215043596614295","timestamp":"1642074362","merklized":"1","proofType":"1","isRevocationChecked":"1","challenge":"12345","issuerState":"2943483356559152311923412925436024635269538717812859789851139200242297094","linkID":"21264956840473518295367401759082248638554058714792654964349049745455799782226","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","operatorOutput":"0","nullifier":"21540438192236855564075143333896114176485819065040531615519987653057866936972","authEnabled":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/valid_bjj_user_genesis_auth_disabled_v3.json b/testvectorgen/contract_data/testdata/v3/valid_bjj_user_genesis_auth_disabled_v3.json deleted file mode 100644 index 778a4542..00000000 --- a/testvectorgen/contract_data/testdata/v3/valid_bjj_user_genesis_auth_disabled_v3.json +++ /dev/null @@ -1 +0,0 @@ -{"desc":"BJJ: Issuer first state / user - genesis state - Auth Disabled","inputs":{"requestID":"32","userGenesisID":"23013175891893363078841232968022302880776034013620341061794940968520126978","profileNonce":"0","claimSubjectProfileNonce":"0","authClaim":["0","0","0","0","0","0","0","0"],"authClaimIncMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"0","challenge":"583091486781463398742321306787801699791102451699","challengeSignatureR8x":"0","challengeSignatureR8y":"0","challengeSignatureS":"0","userClaimsTreeRoot":"0","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"5317387130258456662214331362918410991734007599705406860481038345552731150762","gistRoot":"0","gistMtp":["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","0"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","23013175891893363078841232968022302880776034013620341061794940968520126978","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"21086184659407650088304758971704784731045378328290753732498060536509438840420","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"16911470968637303012243682196661900599310735102088601053412602445232291023376","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"21086184659407650088304758971704784731045378328290753732498060536509438840420","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"16911470968637303012243682196661900599310735102088601053412602445232291023376","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":0,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"13911499604753673789524925237974757852442326056619123998177153091271750751494","issuerClaimSignatureR8y":"4410585813456846388673758578760540047188245171012977452212359210567823951539","issuerClaimSignatureS":"343558701522070187271580522311771620354018236796846256744643794818586520785","issuerAuthClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"1","issuerAuthClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"2943483356559152311923412925436024635269538717812859789851139200242297094","proofType":"1","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","authEnabled":0},"expOut":{"requestID":"32","userID":"23013175891893363078841232968022302880776034013620341061794940968520126978","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"16911470968637303012243682196661900599310735102088601053412602445232291023376","circuitQueryHash":"12816522451235043383360844734477263990263633888892986646884788265975859605506","gistRoot":"0","timestamp":"1642074362","merklized":"1","proofType":"1","isRevocationChecked":"1","challenge":"583091486781463398742321306787801699791102451699","issuerState":"2943483356559152311923412925436024635269538717812859789851139200242297094","linkID":"19823993270096139446564592922993947503208333537792611306066620392561342309875","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","operatorOutput":"0","nullifier":"0","authEnabled":"0"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/valid_bjj_user_genesis_v3.json b/testvectorgen/contract_data/testdata/v3/valid_bjj_user_genesis_v3.json deleted file mode 100644 index 0c26ab02..00000000 --- a/testvectorgen/contract_data/testdata/v3/valid_bjj_user_genesis_v3.json +++ /dev/null @@ -1 +0,0 @@ -{"desc":"BJJ: Issuer first state / user - genesis state","inputs":{"requestID":"32","userGenesisID":"23273167900576580892722615617815475823351560716009055944677723144398443009","profileNonce":"0","claimSubjectProfileNonce":"999","authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimIncMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","challenge":"12345","challengeSignatureR8x":"15829360093371098546177008474519342171461782120259125067189481965541223738777","challengeSignatureR8y":"10840522802382821290541462398953040493080116495308402635486440290351677745960","challengeSignatureS":"1196477404779941775725836688033485533497812196897664950083199167075327114562","userClaimsTreeRoot":"8162166103065016664685834856644195001371303013149727027131225893397958846382","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"8039964009611210398788855768060749920589777058607598891238307089541758339342","gistRoot":"17553467291814895170405188828004896559375980578450652516838963090977259468266","gistMtp":["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","0"],"gistMtpAuxHi":"4077987451868832113968561545636400295368362996583459552225367454505139442921","gistMtpAuxHv":"17589915770180204105901402551557814231062156768237172640949582669912057325314","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","28275098119780158026040482722477442169764247619454891891569161278093595137","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":0,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"5472508197866388381206604816325335748616914118588758490396973216283757878391","issuerClaimSignatureR8y":"487022569097765756306556955967994377058095043087439728980694573045440494288","issuerClaimSignatureS":"406364656466382933476187938784383717878849985640796393410767792675250006948","issuerAuthClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"1","issuerAuthClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"2943483356559152311923412925436024635269538717812859789851139200242297094","proofType":"1","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","authEnabled":1},"expOut":{"requestID":"32","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","circuitQueryHash":"12816522451235043383360844734477263990263633888892986646884788265975859605506","gistRoot":"17553467291814895170405188828004896559375980578450652516838963090977259468266","timestamp":"1642074362","merklized":"1","proofType":"1","isRevocationChecked":"1","challenge":"12345","issuerState":"2943483356559152311923412925436024635269538717812859789851139200242297094","linkID":"21264956840473518295367401759082248638554058714792654964349049745455799782226","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","operatorOutput":"0","nullifier":"21540438192236855564075143333896114176485819065040531615519987653057866936972","authEnabled":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/valid_bjj_user_second_issuer_first_v3.json b/testvectorgen/contract_data/testdata/v3/valid_bjj_user_second_issuer_first_v3.json deleted file mode 100644 index 05f08f17..00000000 --- a/testvectorgen/contract_data/testdata/v3/valid_bjj_user_second_issuer_first_v3.json +++ /dev/null @@ -1 +0,0 @@ -{"desc":"BJJ: Issuer first state / user second state - valid proof","inputs":{"requestID":"32","userGenesisID":"23273167900576580892722615617815475823351560716009055944677723144398443009","profileNonce":"0","claimSubjectProfileNonce":"999","authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimIncMtp":["5916548408689195262080688487922161094620378143892746801536708302227694602463","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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","challenge":"12345","challengeSignatureR8x":"15829360093371098546177008474519342171461782120259125067189481965541223738777","challengeSignatureR8y":"10840522802382821290541462398953040493080116495308402635486440290351677745960","challengeSignatureS":"1196477404779941775725836688033485533497812196897664950083199167075327114562","userClaimsTreeRoot":"2598859270528411339367298518235341436604032965606770354648007040260316541053","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"14535482911083887650400775180811767777795251060472677534187665389233265353111","gistRoot":"9099102572907537314140397131924122401084737995701214854737608469293791942353","gistMtp":["0","0","0","0","0","6097144699697903255302393350153793559547643885208447897492320561902595462726","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"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","28275098119780158026040482722477442169764247619454891891569161278093595137","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":0,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"5472508197866388381206604816325335748616914118588758490396973216283757878391","issuerClaimSignatureR8y":"487022569097765756306556955967994377058095043087439728980694573045440494288","issuerClaimSignatureS":"406364656466382933476187938784383717878849985640796393410767792675250006948","issuerAuthClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"1","issuerAuthClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"2943483356559152311923412925436024635269538717812859789851139200242297094","proofType":"1","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","authEnabled":1},"expOut":{"requestID":"32","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","circuitQueryHash":"12816522451235043383360844734477263990263633888892986646884788265975859605506","gistRoot":"9099102572907537314140397131924122401084737995701214854737608469293791942353","timestamp":"1642074362","merklized":"1","proofType":"1","isRevocationChecked":"1","challenge":"12345","issuerState":"2943483356559152311923412925436024635269538717812859789851139200242297094","linkID":"21264956840473518295367401759082248638554058714792654964349049745455799782226","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","operatorOutput":"0","nullifier":"21540438192236855564075143333896114176485819065040531615519987653057866936972","authEnabled":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/valid_mtp_user_first_issuer_second_v3.json b/testvectorgen/contract_data/testdata/v3/valid_mtp_user_first_issuer_second_v3.json deleted file mode 100644 index 71b9249c..00000000 --- a/testvectorgen/contract_data/testdata/v3/valid_mtp_user_first_issuer_second_v3.json +++ /dev/null @@ -1 +0,0 @@ -{"desc":"MTP: Issuer second state / user first state - valid proof","inputs":{"requestID":"32","userGenesisID":"23273167900576580892722615617815475823351560716009055944677723144398443009","profileNonce":"0","claimSubjectProfileNonce":"999","authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimIncMtp":["13207060137112832590622170449916258240813695457675295794859213606138142493259","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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","challenge":"12345","challengeSignatureR8x":"15829360093371098546177008474519342171461782120259125067189481965541223738777","challengeSignatureR8y":"10840522802382821290541462398953040493080116495308402635486440290351677745960","challengeSignatureS":"1196477404779941775725836688033485533497812196897664950083199167075327114562","userClaimsTreeRoot":"11517767461750786409356202654343440087797799854420804212797270561286585478040","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"13421062220305656807332040413142908746386531813676548741852291985659124697073","gistRoot":"3246149973995767198551331195301279032661034567528700100008644394827230835249","gistMtp":["0","0","0","0","0","6097144699697903255302393350153793559547643885208447897492320561902595462726","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"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","28275098119780158026040482722477442169764247619454891891569161278093595137","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"12485282917430521519505497335419247027529713129159393099659489490556962297749","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"16808564267715042565747150526413707826810779846518769996187201048333752158039","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":2,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"0","issuerClaimSignatureR8y":"0","issuerClaimSignatureS":"0","issuerAuthClaim":["0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"0","issuerAuthClaimsTreeRoot":"0","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"0","proofType":"2","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","authEnabled":1},"expOut":{"requestID":"32","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"16808564267715042565747150526413707826810779846518769996187201048333752158039","circuitQueryHash":"16085407811791493874423550911889456452275693306656061172817544983916814452534","gistRoot":"3246149973995767198551331195301279032661034567528700100008644394827230835249","timestamp":"1642074362","merklized":"1","proofType":"2","isRevocationChecked":"1","challenge":"12345","issuerState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","linkID":"21264956840473518295367401759082248638554058714792654964349049745455799782226","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","operatorOutput":"0","nullifier":"21540438192236855564075143333896114176485819065040531615519987653057866936972","authEnabled":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/valid_mtp_user_first_v3.json b/testvectorgen/contract_data/testdata/v3/valid_mtp_user_first_v3.json deleted file mode 100644 index d960a968..00000000 --- a/testvectorgen/contract_data/testdata/v3/valid_mtp_user_first_v3.json +++ /dev/null @@ -1 +0,0 @@ -{"desc":"MTP: Issuer first state / user first state - valid proof","inputs":{"requestID":"32","userGenesisID":"23273167900576580892722615617815475823351560716009055944677723144398443009","profileNonce":"0","claimSubjectProfileNonce":"999","authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimIncMtp":["13207060137112832590622170449916258240813695457675295794859213606138142493259","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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","challenge":"12345","challengeSignatureR8x":"15829360093371098546177008474519342171461782120259125067189481965541223738777","challengeSignatureR8y":"10840522802382821290541462398953040493080116495308402635486440290351677745960","challengeSignatureS":"1196477404779941775725836688033485533497812196897664950083199167075327114562","userClaimsTreeRoot":"11517767461750786409356202654343440087797799854420804212797270561286585478040","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"13421062220305656807332040413142908746386531813676548741852291985659124697073","gistRoot":"20586831885098765093977645199183344896684103637972080672236708215043596614295","gistMtp":["0","0","0","0","0","17553467291814895170405188828004896559375980578450652516838963090977259468266","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"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","28275098119780158026040482722477442169764247619454891891569161278093595137","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":2,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"0","issuerClaimSignatureR8y":"0","issuerClaimSignatureS":"0","issuerAuthClaim":["0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"0","issuerAuthClaimsTreeRoot":"0","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"0","proofType":"2","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","authEnabled":1},"expOut":{"requestID":"32","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","circuitQueryHash":"16085407811791493874423550911889456452275693306656061172817544983916814452534","gistRoot":"20586831885098765093977645199183344896684103637972080672236708215043596614295","timestamp":"1642074362","merklized":"1","proofType":"2","isRevocationChecked":"1","challenge":"12345","issuerState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","linkID":"21264956840473518295367401759082248638554058714792654964349049745455799782226","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","operatorOutput":"0","nullifier":"21540438192236855564075143333896114176485819065040531615519987653057866936972","authEnabled":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/valid_mtp_user_genesis_auth_disabled_v3.json b/testvectorgen/contract_data/testdata/v3/valid_mtp_user_genesis_auth_disabled_v3.json deleted file mode 100644 index 2c115ebd..00000000 --- a/testvectorgen/contract_data/testdata/v3/valid_mtp_user_genesis_auth_disabled_v3.json +++ /dev/null @@ -1 +0,0 @@ -{"desc":"MTP: Issuer first state / user - genesis state - Auth Disabled","inputs":{"requestID":"32","userGenesisID":"23013175891893363078841232968022302880776034013620341061794940968520126978","profileNonce":"0","claimSubjectProfileNonce":"0","authClaim":["0","0","0","0","0","0","0","0"],"authClaimIncMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"0","challenge":"583091486781463398742321306787801699791102451699","challengeSignatureR8x":"0","challengeSignatureR8y":"0","challengeSignatureS":"0","userClaimsTreeRoot":"0","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"5317387130258456662214331362918410991734007599705406860481038345552731150762","gistRoot":"0","gistMtp":["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","0"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","23013175891893363078841232968022302880776034013620341061794940968520126978","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"21086184659407650088304758971704784731045378328290753732498060536509438840420","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"16911470968637303012243682196661900599310735102088601053412602445232291023376","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"21086184659407650088304758971704784731045378328290753732498060536509438840420","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"16911470968637303012243682196661900599310735102088601053412602445232291023376","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":2,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"0","issuerClaimSignatureR8y":"0","issuerClaimSignatureS":"0","issuerAuthClaim":["0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"0","issuerAuthClaimsTreeRoot":"0","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"0","proofType":"2","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","authEnabled":0},"expOut":{"requestID":"32","userID":"23013175891893363078841232968022302880776034013620341061794940968520126978","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"16911470968637303012243682196661900599310735102088601053412602445232291023376","circuitQueryHash":"16085407811791493874423550911889456452275693306656061172817544983916814452534","gistRoot":"0","timestamp":"1642074362","merklized":"1","proofType":"2","isRevocationChecked":"1","challenge":"583091486781463398742321306787801699791102451699","issuerState":"16911470968637303012243682196661900599310735102088601053412602445232291023376","linkID":"19823993270096139446564592922993947503208333537792611306066620392561342309875","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","operatorOutput":"0","nullifier":"0","authEnabled":"0"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/valid_mtp_user_genesis_v3.json b/testvectorgen/contract_data/testdata/v3/valid_mtp_user_genesis_v3.json deleted file mode 100644 index 5382d354..00000000 --- a/testvectorgen/contract_data/testdata/v3/valid_mtp_user_genesis_v3.json +++ /dev/null @@ -1 +0,0 @@ -{"desc":"MTP: Issuer first state / user - genesis state","inputs":{"requestID":"32","userGenesisID":"23273167900576580892722615617815475823351560716009055944677723144398443009","profileNonce":"0","claimSubjectProfileNonce":"999","authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimIncMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","challenge":"12345","challengeSignatureR8x":"15829360093371098546177008474519342171461782120259125067189481965541223738777","challengeSignatureR8y":"10840522802382821290541462398953040493080116495308402635486440290351677745960","challengeSignatureS":"1196477404779941775725836688033485533497812196897664950083199167075327114562","userClaimsTreeRoot":"8162166103065016664685834856644195001371303013149727027131225893397958846382","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"8039964009611210398788855768060749920589777058607598891238307089541758339342","gistRoot":"17553467291814895170405188828004896559375980578450652516838963090977259468266","gistMtp":["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","0"],"gistMtpAuxHi":"4077987451868832113968561545636400295368362996583459552225367454505139442921","gistMtpAuxHv":"17589915770180204105901402551557814231062156768237172640949582669912057325314","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","28275098119780158026040482722477442169764247619454891891569161278093595137","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":2,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"0","issuerClaimSignatureR8y":"0","issuerClaimSignatureS":"0","issuerAuthClaim":["0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"0","issuerAuthClaimsTreeRoot":"0","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"0","proofType":"2","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","authEnabled":1},"expOut":{"requestID":"32","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","circuitQueryHash":"16085407811791493874423550911889456452275693306656061172817544983916814452534","gistRoot":"17553467291814895170405188828004896559375980578450652516838963090977259468266","timestamp":"1642074362","merklized":"1","proofType":"2","isRevocationChecked":"1","challenge":"12345","issuerState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","linkID":"21264956840473518295367401759082248638554058714792654964349049745455799782226","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","operatorOutput":"0","nullifier":"21540438192236855564075143333896114176485819065040531615519987653057866936972","authEnabled":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/testdata/v3/valid_mtp_user_second_issuer_first_v3.json b/testvectorgen/contract_data/testdata/v3/valid_mtp_user_second_issuer_first_v3.json deleted file mode 100644 index ca4091e4..00000000 --- a/testvectorgen/contract_data/testdata/v3/valid_mtp_user_second_issuer_first_v3.json +++ /dev/null @@ -1 +0,0 @@ -{"desc":"MTP: Issuer first state / user second state - valid proof","inputs":{"requestID":"32","userGenesisID":"23273167900576580892722615617815475823351560716009055944677723144398443009","profileNonce":"0","claimSubjectProfileNonce":"999","authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimIncMtp":["5916548408689195262080688487922161094620378143892746801536708302227694602463","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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","challenge":"12345","challengeSignatureR8x":"15829360093371098546177008474519342171461782120259125067189481965541223738777","challengeSignatureR8y":"10840522802382821290541462398953040493080116495308402635486440290351677745960","challengeSignatureS":"1196477404779941775725836688033485533497812196897664950083199167075327114562","userClaimsTreeRoot":"2598859270528411339367298518235341436604032965606770354648007040260316541053","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"14535482911083887650400775180811767777795251060472677534187665389233265353111","gistRoot":"9099102572907537314140397131924122401084737995701214854737608469293791942353","gistMtp":["0","0","0","0","0","6097144699697903255302393350153793559547643885208447897492320561902595462726","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"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["14559690932601973492667815902177586678096","28275098119780158026040482722477442169764247619454891891569161278093595137","9213927290011334896127777675328088174434217313068333652739128278390111642646","0","30803922965249841627828060170","0","0","0"],"issuerClaimMtp":["20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"5837210867248591360642260120895392480347098350847169512510209002593511422820","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"267831521922558027206082390043321796944","claimPathNotExists":"0","claimPathMtp":["10589573826925462603050948846890883345903166374734689729289271532483057858782","4903363613407701830583497195848005212702896800468691857488755628900455996678","7545982957481491739149003206078420878340430249907160971377831259006673422787","0","7234734700882409562051669071537722159277854149198231521046768401160975042526","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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"20376033832371109177683048456014525905119173674985843915445634726167450989630","claimPathValue":"19960424","operator":2,"slotIndex":2,"timestamp":"1642074362","value":["20010101","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"],"issuerClaimSignatureR8x":"0","issuerClaimSignatureR8y":"0","issuerClaimSignatureS":"0","issuerAuthClaim":["0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"0","issuerAuthClaimsTreeRoot":"0","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"0","proofType":"2","linkNonce":"18","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","authEnabled":1},"expOut":{"requestID":"32","userID":"23273167900576580892722615617815475823351560716009055944677723144398443009","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","circuitQueryHash":"16085407811791493874423550911889456452275693306656061172817544983916814452534","gistRoot":"9099102572907537314140397131924122401084737995701214854737608469293791942353","timestamp":"1642074362","merklized":"1","proofType":"2","isRevocationChecked":"1","challenge":"12345","issuerState":"17589915770180204105901402551557814231062156768237172640949582669912057325314","linkID":"21264956840473518295367401759082248638554058714792654964349049745455799782226","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"1234569","operatorOutput":"0","nullifier":"21540438192236855564075143333896114176485819065040531615519987653057866936972","authEnabled":"1"}} \ No newline at end of file diff --git a/testvectorgen/contract_data/v3_test.go b/testvectorgen/contract_data/v3_test.go index 93b47eca..15b7289e 100644 --- a/testvectorgen/contract_data/v3_test.go +++ b/testvectorgen/contract_data/v3_test.go @@ -86,7 +86,7 @@ func Test_Generate_Test_CasesV3(t *testing.T) { }, true, false, true, false, "v3/valid_bjj_user_first_issuer_genesis_v3", verifiable.BJJSignatureProofType, 1) } -func generateData(t *testing.T, desc string, gistData []*gistData, userFirstState bool, userSecondState bool, issuetGenesisState bool, issuerSecondState bool, fileName string, testProofType verifiable.ProofType, authEnabled int) { +func generateData(t *testing.T, desc string, gistData []*gistData, userFirstState bool, userSecondState bool, issuetGenesisState bool, issuerSecondState bool, fileName string, testProofType verifiable.ProofType, isBJJAuthEnabled int) { var linkNonce = "18" var nullifierSessionID string = "1234569" @@ -102,7 +102,7 @@ func generateData(t *testing.T, desc string, gistData []*gistData, userFirstStat var user *utils.IdentityTest - if authEnabled == 1 { + if isBJJAuthEnabled == 1 { user = utils.NewIdentity(t, UserPK) } else { // generate onchain identity @@ -117,7 +117,7 @@ func generateData(t *testing.T, desc string, gistData []*gistData, userFirstStat subjectID := user.ID var nonceSubject = new(big.Int) - if isSubjectIDProfile && authEnabled == 1 { + if isSubjectIDProfile && isBJJAuthEnabled == 1 { nonceSubject = big.NewInt(999) subjectID, err = core.ProfileID(user.ID, nonceSubject) require.NoError(t, err) @@ -156,7 +156,7 @@ func generateData(t *testing.T, desc string, gistData []*gistData, userFirstStat merklized = "1" } else { - claim = utils.DefaultUserClaim(t, subjectID) + claim = utils.DefaultUserClaim(t, subjectID, nil) claimPathMtp = utils.PrepareStrArray([]string{}, 32) claimPathMtpNoAux = "0" claimPathMtpAuxHi = "0" @@ -173,7 +173,7 @@ func generateData(t *testing.T, desc string, gistData []*gistData, userFirstStat user.AddClaim(t, claim1) if userSecondState { - claim2 := utils.DefaultUserClaim(t, user.ID) + claim2 := utils.DefaultUserClaim(t, user.ID, nil) user.AddClaim(t, claim2) } } @@ -216,7 +216,7 @@ func generateData(t *testing.T, desc string, gistData []*gistData, userFirstStat // add another claim to issuer if it is a second state if issuerSecondState { - primaryEntityClaim := utils.DefaultUserClaim(t, issuer.ID) + primaryEntityClaim := utils.DefaultUserClaim(t, issuer.ID, nil) issuer.AddClaim(t, primaryEntityClaim) } @@ -281,9 +281,11 @@ func generateData(t *testing.T, desc string, gistData []*gistData, userFirstStat var gistProof []string var gistNodeAux utils.NodeAuxValue + addr := common.HexToAddress(ethAddress) + challenge = new(big.Int).SetBytes(merkletree.SwapEndianness(addr.Bytes())) + // user - if authEnabled == 1 { - challenge = big.NewInt(12345) + if isBJJAuthEnabled == 1 { authMTProof = user.AuthMTPStrign(t) userAuthNonRevMTProof, userNodeAuxNonRev = user.ClaimRevMTP(t, user.AuthClaim) sig = user.Sign(challenge) @@ -293,8 +295,6 @@ func generateData(t *testing.T, desc string, gistData []*gistData, userFirstStat gistProof, gistNodeAux = utils.PrepareProof(gistProofRaw, utils.GistLevels) } else { - addr := common.HexToAddress(ethAddress) - challenge = new(big.Int).SetBytes(merkletree.SwapEndianness(addr.Bytes())) emptyArr := make([]*merkletree.Hash, 0) authMTProof = utils.PrepareSiblingsStr(emptyArr, utils.IdentityTreeLevels) @@ -323,6 +323,7 @@ func generateData(t *testing.T, desc string, gistData []*gistData, userFirstStat user.AuthClaim = &core.Claim{} } t.Log(issuer.State(t).String()) + valueArraySize := utils.GetValueArraySizeForOperator(operator) inputs := Inputs{ RequestID: requestID, @@ -364,7 +365,6 @@ func generateData(t *testing.T, desc string, gistData []*gistData, userFirstStat IssuerClaimNonRevMtpAuxHv: issuerClaimNonRevAux.Value, IssuerClaimNonRevMtpNoAux: issuerClaimNonRevAux.NoAux, ClaimSchema: "267831521922558027206082390043321796944", - ClaimPathNotExists: "0", // 0 for inclusion, 1 for non-inclusion ClaimPathMtp: claimPathMtp, ClaimPathMtpNoAux: claimPathMtpNoAux, ClaimPathMtpAuxHi: claimPathMtpAuxHi, @@ -376,20 +376,20 @@ func generateData(t *testing.T, desc string, gistData []*gistData, userFirstStat SlotIndex: slotIndex, Timestamp: timestamp, Value: valueInput, - - IssuerClaimSignatureR8X: issuerClaimSignatureR8X, - IssuerClaimSignatureR8Y: issuerClaimSignatureR8Y, - IssuerClaimSignatureS: issuerClaimSignatureS, - IssuerAuthClaim: issuerAuthClaim, - IssuerAuthClaimMtp: issuerAuthClaimMtp, - IssuerAuthClaimNonRevMtp: issuerAuthClaimNonRevMtp, - IssuerAuthClaimNonRevMtpAuxHi: issuerAuthClaimNonRevMtpAuxHi, - IssuerAuthClaimNonRevMtpAuxHv: issuerAuthClaimNonRevMtpAuxHv, - IssuerAuthClaimNonRevMtpNoAux: issuerAuthClaimNonRevMtpNoAux, - IssuerAuthClaimsTreeRoot: issuerAuthClaimsTreeRoot, - IssuerAuthRevTreeRoot: issuerAuthRevTreeRoot, - IssuerAuthRootsTreeRoot: issuerAuthRootsTreeRoot, - IssuerAuthState: issuerAuthState, + ValueArraySize: valueArraySize, + IssuerClaimSignatureR8X: issuerClaimSignatureR8X, + IssuerClaimSignatureR8Y: issuerClaimSignatureR8Y, + IssuerClaimSignatureS: issuerClaimSignatureS, + IssuerAuthClaim: issuerAuthClaim, + IssuerAuthClaimMtp: issuerAuthClaimMtp, + IssuerAuthClaimNonRevMtp: issuerAuthClaimNonRevMtp, + IssuerAuthClaimNonRevMtpAuxHi: issuerAuthClaimNonRevMtpAuxHi, + IssuerAuthClaimNonRevMtpAuxHv: issuerAuthClaimNonRevMtpAuxHv, + IssuerAuthClaimNonRevMtpNoAux: issuerAuthClaimNonRevMtpNoAux, + IssuerAuthClaimsTreeRoot: issuerAuthClaimsTreeRoot, + IssuerAuthRevTreeRoot: issuerAuthRevTreeRoot, + IssuerAuthRootsTreeRoot: issuerAuthRootsTreeRoot, + IssuerAuthState: issuerAuthState, LinkNonce: linkNonce, @@ -397,38 +397,27 @@ func generateData(t *testing.T, desc string, gistData []*gistData, userFirstStat VerifierID: "21929109382993718606847853573861987353620810345503358891473103689157378049", NullifierSessionID: nullifierSessionID, - AuthEnabled: authEnabled, + IsBJJAuthEnabled: isBJJAuthEnabled, } valuesHash, err := utils.PoseidonHashValue(utils.FromStringArrayToBigIntArray(inputs.Value)) require.NoError(t, err) claimSchemaInt, ok := big.NewInt(0).SetString(inputs.ClaimSchema, 10) require.True(t, ok) - circuitQueryHash, err := poseidon.Hash([]*big.Int{ - claimSchemaInt, - big.NewInt(int64(inputs.SlotIndex)), - big.NewInt(int64(inputs.Operator)), - pathKey, - big.NewInt(0), - valuesHash, - }) - require.NoError(t, err) linkID, err := utils.CalculateLinkID(linkNonce, claim) require.NoError(t, err) operatorOutput := "0" nullifier := "0" + verifierID, ok := big.NewInt(0).SetString(inputs.VerifierID, 10) + require.True(t, ok) + nullifierSessionID_, ok := big.NewInt(0).SetString(inputs.NullifierSessionID, 10) + require.True(t, ok) if inputs.NullifierSessionID != "0" { claimSchema, ok := big.NewInt(0).SetString(inputs.ClaimSchema, 10) require.True(t, ok) - verifierID, ok := big.NewInt(0).SetString(inputs.VerifierID, 10) - require.True(t, ok) - - nullifierSessionID_, ok := big.NewInt(0).SetString(inputs.NullifierSessionID, 10) - require.True(t, ok) - nullifier, err = utils.CalculateNullify( user.ID.BigInt(), nonceSubject, @@ -438,6 +427,27 @@ func generateData(t *testing.T, desc string, gistData []*gistData, userFirstStat ) require.NoError(t, err) } + merklizedBigInt, ok := big.NewInt(0).SetString(merklized, 10) + + firstPartQueryHash, err := poseidon.Hash([]*big.Int{ + claimSchemaInt, + big.NewInt(int64(inputs.SlotIndex)), + big.NewInt(int64(inputs.Operator)), + pathKey, + merklizedBigInt, + valuesHash, + }) + require.NoError(t, err) + require.True(t, ok) + circuitQueryHash, err := poseidon.Hash([]*big.Int{ + firstPartQueryHash, + big.NewInt(int64(valueArraySize)), + big.NewInt(int64(isRevocationChecked)), + verifierID, + nullifierSessionID_, + new(big.Int), + }) + require.NoError(t, err) if operator == utils.SD { operatorOutput = big.NewInt(10).String() @@ -462,15 +472,12 @@ func generateData(t *testing.T, desc string, gistData []*gistData, userFirstStat Merklized: merklized, Challenge: challenge.String(), GistRoot: gistRoot.BigInt().String(), - IsRevocationChecked: strconv.Itoa(isRevocationChecked), ProofType: proofType, IssuerState: issuerState, LinkID: linkID, OperatorOutput: operatorOutput, - VerifierID: inputs.VerifierID, - NullifierSessionID: inputs.NullifierSessionID, Nullifier: nullifier, - AuthEnabled: strconv.Itoa(authEnabled), + IsBJJAuthEnabled: strconv.Itoa(isBJJAuthEnabled), } jsonData, err := json.Marshal(TestData{ @@ -535,18 +542,18 @@ type Inputs struct { // Query // JSON path - ClaimPathNotExists string `json:"claimPathNotExists"` // 0 for inclusion, 1 for non-inclusion - ClaimPathMtp []string `json:"claimPathMtp"` - ClaimPathMtpNoAux string `json:"claimPathMtpNoAux"` // 1 if aux node is empty, 0 if non-empty or for inclusion proofs - ClaimPathMtpAuxHi string `json:"claimPathMtpAuxHi"` // 0 for inclusion proof - ClaimPathMtpAuxHv string `json:"claimPathMtpAuxHv"` // 0 for inclusion proof - ClaimPathKey string `json:"claimPathKey"` // hash of path in merklized json-ld document - ClaimPathValue string `json:"claimPathValue"` // value in this path in merklized json-ld document - - Operator int `json:"operator"` - SlotIndex int `json:"slotIndex"` - Timestamp string `json:"timestamp"` - Value []string `json:"value"` + ClaimPathMtp []string `json:"claimPathMtp"` + ClaimPathMtpNoAux string `json:"claimPathMtpNoAux"` // 1 if aux node is empty, 0 if non-empty or for inclusion proofs + ClaimPathMtpAuxHi string `json:"claimPathMtpAuxHi"` // 0 for inclusion proof + ClaimPathMtpAuxHv string `json:"claimPathMtpAuxHv"` // 0 for inclusion proof + ClaimPathValue string `json:"claimPathValue"` // value in this path in merklized json-ld document + ClaimPathKey string `json:"claimPathKey"` // hash of path in merklized json-ld document + + Operator int `json:"operator"` + SlotIndex int `json:"slotIndex"` + Timestamp string `json:"timestamp"` + Value []string `json:"value"` + ValueArraySize int `json:"valueArraySize"` // additional sig inputs IssuerClaimSignatureR8X string `json:"issuerClaimSignatureR8x"` @@ -571,7 +578,7 @@ type Inputs struct { VerifierID string `json:"verifierID"` NullifierSessionID string `json:"nullifierSessionID"` - AuthEnabled int `json:"authEnabled"` + IsBJJAuthEnabled int `json:"isBJJAuthEnabled"` } type Outputs struct { @@ -584,15 +591,12 @@ type Outputs struct { Timestamp string `json:"timestamp"` Merklized string `json:"merklized"` ProofType string `json:"proofType"` // 1 for sig, 2 for mtp - IsRevocationChecked string `json:"isRevocationChecked"` Challenge string `json:"challenge"` IssuerState string `json:"issuerState"` LinkID string `json:"linkID"` - VerifierID string `json:"verifierID"` - NullifierSessionID string `json:"nullifierSessionID"` OperatorOutput string `json:"operatorOutput"` Nullifier string `json:"nullifier"` - AuthEnabled string `json:"authEnabled"` + IsBJJAuthEnabled string `json:"isBJJAuthEnabled"` } type TestData struct { diff --git a/testvectorgen/credentials/onchain/v3/testdata/mtp/onchainIdentity.json b/testvectorgen/credentials/onchain/v3/testdata/mtp/onchainIdentity.json index 1b00b839..415a542a 100644 --- a/testvectorgen/credentials/onchain/v3/testdata/mtp/onchainIdentity.json +++ b/testvectorgen/credentials/onchain/v3/testdata/mtp/onchainIdentity.json @@ -1 +1 @@ -{"desc":"Skip Auth V2 check. Onchain identity (based on ethereum address)","inputs":{"requestID":"41","userGenesisID":"131133180589020711961260361383263483596571070471237344548087960252191233","profileNonce":"0","claimSubjectProfileNonce":"0","authClaim":null,"authClaimIncMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"0","challenge":"\u003cnil\u003e","challengeSignatureR8x":"0","challengeSignatureR8y":"0","challengeSignatureS":"0","userClaimsTreeRoot":"0","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"5317387130258456662214331362918410991734007599705406860481038345552731150762","gistRoot":"0","gistMtp":["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","0"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["3583233690122716044519380227940806650830","131133180589020711961260361383263483596571070471237344548087960252191233","10","0","30803922965249841627828060161","0","0","0"],"issuerClaimMtp":["0","20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"19254747036210529128865168332662848827124379407444944453553402819234148971289","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"3790535331679047042267219825047704753928308239645137564498543078716403663426","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"19254747036210529128865168332662848827124379407444944453553402819234148971289","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"3790535331679047042267219825047704753928308239645137564498543078716403663426","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"180410020913331409885634153623124536270","claimPathNotExists":"0","claimPathMtp":["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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"0","claimPathValue":"0","operator":2,"slotIndex":2,"timestamp":"1642074362","value":["11","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"],"issuerClaimSignatureR8x":"0","issuerClaimSignatureR8y":"0","issuerClaimSignatureS":"0","issuerAuthClaim":["0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"0","issuerAuthClaimsTreeRoot":"0","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"0","proofType":"2","linkNonce":"0","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","authEnabled":0},"expOut":{"requestID":"41","userID":"131133180589020711961260361383263483596571070471237344548087960252191233","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"3790535331679047042267219825047704753928308239645137564498543078716403663426","circuitQueryHash":"18553675390142770485013045767457680022963441687516601992912695379143100497483","gistRoot":"0","timestamp":"1642074362","merklized":"0","proofType":"2","isRevocationChecked":"1","challenge":"\u003cnil\u003e","issuerState":"3790535331679047042267219825047704753928308239645137564498543078716403663426","linkID":"0","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","operatorOutput":"0","nullifier":"0","authEnabled":"0"}} \ No newline at end of file +{"desc":"Skip Auth V2 check. Onchain identity (based on ethereum address)","inputs":{"requestID":"41","userGenesisID":"23013175891893363078841232968022302880776034013620341061794940968520126978","profileNonce":"0","claimSubjectProfileNonce":"0","authClaim":["80551937543569765027552589160822318028","0","0","0","0","0","0","0"],"authClaimIncMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"0","challenge":"583091486781463398742321306787801699791102451699","challengeSignatureR8x":"0","challengeSignatureR8y":"0","challengeSignatureS":"0","userClaimsTreeRoot":"0","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"5317387130258456662214331362918410991734007599705406860481038345552731150762","gistRoot":"0","gistMtp":["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","0"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["3583233690122716044519380227940806650830","23013175891893363078841232968022302880776034013620341061794940968520126978","10","0","30803922965249841627828060161","0","0","0"],"issuerClaimMtp":["0","20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"5900097978117959629345309634255340621836639080907047795968443101805294496810","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"2254426496539590177763798092567819174144925846572543968889300208373841967809","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"5900097978117959629345309634255340621836639080907047795968443101805294496810","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"2254426496539590177763798092567819174144925846572543968889300208373841967809","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"180410020913331409885634153623124536270","claimPathMtp":["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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"0","claimPathValue":"0","operator":2,"slotIndex":2,"timestamp":"1642074362","value":["11","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"],"valueArraySize":1,"issuerClaimSignatureR8x":"0","issuerClaimSignatureR8y":"0","issuerClaimSignatureS":"0","issuerAuthClaim":["0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"0","issuerAuthClaimsTreeRoot":"0","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"0","proofType":"2","linkNonce":"0","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","isBJJAuthEnabled":0},"expOut":{"requestID":"41","userID":"23013175891893363078841232968022302880776034013620341061794940968520126978","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"2254426496539590177763798092567819174144925846572543968889300208373841967809","circuitQueryHash":"12497776133125249452085953139352361956304029990242717119527740207142357852209","gistRoot":"0","timestamp":"1642074362","proofType":"2","challenge":"583091486781463398742321306787801699791102451699","issuerState":"2254426496539590177763798092567819174144925846572543968889300208373841967809","linkID":"0","operatorOutput":"0","nullifier":"0","isBJJAuthEnabled":"0"}} \ No newline at end of file diff --git a/testvectorgen/credentials/onchain/v3/testdata/sig/onchainIdentity.json b/testvectorgen/credentials/onchain/v3/testdata/sig/onchainIdentity.json index 44ebdfeb..e85060bd 100644 --- a/testvectorgen/credentials/onchain/v3/testdata/sig/onchainIdentity.json +++ b/testvectorgen/credentials/onchain/v3/testdata/sig/onchainIdentity.json @@ -1 +1 @@ -{"desc":"Skip Auth V2 check. Onchain identity (based on ethereum address)","inputs":{"requestID":"41","userGenesisID":"131133180589020711961260361383263483596571070471237344548087960252191233","profileNonce":"0","claimSubjectProfileNonce":"0","authClaim":null,"authClaimIncMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"0","challenge":"\u003cnil\u003e","challengeSignatureR8x":"0","challengeSignatureR8y":"0","challengeSignatureS":"0","userClaimsTreeRoot":"0","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"5317387130258456662214331362918410991734007599705406860481038345552731150762","gistRoot":"0","gistMtp":["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","0"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["3583233690122716044519380227940806650830","131133180589020711961260361383263483596571070471237344548087960252191233","10","0","30803922965249841627828060161","0","0","0"],"issuerClaimMtp":["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"],"issuerClaimClaimsTreeRoot":"0","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"0","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"2943483356559152311923412925436024635269538717812859789851139200242297094","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"180410020913331409885634153623124536270","claimPathNotExists":"0","claimPathMtp":["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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"0","claimPathValue":"0","operator":2,"slotIndex":2,"timestamp":"1642074362","value":["11","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"],"issuerClaimSignatureR8x":"17120289433100148896070355789101578872617075744128485094918820340403187607368","issuerClaimSignatureR8y":"21049119501588062036761975456791446169482633603928367513417711978587825202691","issuerClaimSignatureS":"135004040175400248934376052669593172812688250227741585910258454432486139497","issuerAuthClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"1","issuerAuthClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"2943483356559152311923412925436024635269538717812859789851139200242297094","proofType":"1","linkNonce":"0","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","authEnabled":0},"expOut":{"requestID":"41","userID":"131133180589020711961260361383263483596571070471237344548087960252191233","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"2943483356559152311923412925436024635269538717812859789851139200242297094","circuitQueryHash":"18553675390142770485013045767457680022963441687516601992912695379143100497483","gistRoot":"0","timestamp":"1642074362","merklized":"0","proofType":"1","isRevocationChecked":"1","challenge":"\u003cnil\u003e","issuerState":"2943483356559152311923412925436024635269538717812859789851139200242297094","linkID":"0","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","operatorOutput":"0","nullifier":"0","authEnabled":"0"}} \ No newline at end of file +{"desc":"Skip Auth V2 check. Onchain identity (based on ethereum address)","inputs":{"requestID":"41","userGenesisID":"23013175891893363078841232968022302880776034013620341061794940968520126978","profileNonce":"0","claimSubjectProfileNonce":"0","authClaim":["80551937543569765027552589160822318028","0","0","0","0","0","0","0"],"authClaimIncMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"0","challenge":"583091486781463398742321306787801699791102451699","challengeSignatureR8x":"0","challengeSignatureR8y":"0","challengeSignatureS":"0","userClaimsTreeRoot":"0","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"5317387130258456662214331362918410991734007599705406860481038345552731150762","gistRoot":"0","gistMtp":["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","0"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["3583233690122716044519380227940806650830","23013175891893363078841232968022302880776034013620341061794940968520126978","10","0","30803922965249841627828060161","0","0","0"],"issuerClaimMtp":["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"],"issuerClaimClaimsTreeRoot":"0","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"0","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"2943483356559152311923412925436024635269538717812859789851139200242297094","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"180410020913331409885634153623124536270","claimPathMtp":["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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"0","claimPathValue":"0","operator":2,"slotIndex":2,"timestamp":"1642074362","value":["11","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"],"valueArraySize":1,"issuerClaimSignatureR8x":"31157662504561820854772309481007828070585087664133363089794037749307575225","issuerClaimSignatureR8y":"5803322766005884982944103423126505063600964663269516634055232638376630306912","issuerClaimSignatureS":"1050583645731113990130138030352286140101629567126110895514485608106113295293","issuerAuthClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"1","issuerAuthClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"2943483356559152311923412925436024635269538717812859789851139200242297094","proofType":"1","linkNonce":"0","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","isBJJAuthEnabled":0},"expOut":{"requestID":"41","userID":"23013175891893363078841232968022302880776034013620341061794940968520126978","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"2943483356559152311923412925436024635269538717812859789851139200242297094","circuitQueryHash":"12497776133125249452085953139352361956304029990242717119527740207142357852209","gistRoot":"0","timestamp":"1642074362","proofType":"1","challenge":"583091486781463398742321306787801699791102451699","issuerState":"2943483356559152311923412925436024635269538717812859789851139200242297094","linkID":"0","operatorOutput":"0","nullifier":"0","isBJJAuthEnabled":"0"}} \ No newline at end of file diff --git a/testvectorgen/credentials/onchain/v3/v3_test.go b/testvectorgen/credentials/onchain/v3/v3_test.go index 0e75e683..61e68243 100644 --- a/testvectorgen/credentials/onchain/v3/v3_test.go +++ b/testvectorgen/credentials/onchain/v3/v3_test.go @@ -7,6 +7,7 @@ import ( "strconv" "testing" + "github.com/ethereum/go-ethereum/common" "github.com/iden3/go-iden3-crypto/babyjub" "test/utils" @@ -264,7 +265,7 @@ func Test_OnchainIdentity(t *testing.T) { desc := "Skip Auth V2 check. Onchain identity (based on ethereum address)" isUserIDProfile := false isSubjectIDProfile := false - value := utils.PrepareStrArray([]string{"11"}, 64) + value := []string{"11"} generateTestDataWithOperator(t, desc, isUserIDProfile, isSubjectIDProfile, "0", "mtp/onchainIdentity", utils.LT, &value, Mtp, 0) generateTestDataWithOperator(t, desc, isUserIDProfile, isSubjectIDProfile, "0", "sig/onchainIdentity", utils.LT, &value, Sig, 0) } @@ -481,7 +482,7 @@ func generateTestDataWithOperatorAndRevCheck(t *testing.T, desc string, isUserID var gistProof []string var gistNodeAux utils.NodeAuxValue // user - if authEnabled == 1 { + if isBJJAuthEnabled == 1 { challenge = big.NewInt(12345) authMTProof = user.AuthMTPStrign(t) authNonRevMTProof, nodeAuxNonRev = user.ClaimRevMTP(t, user.AuthClaim) @@ -494,8 +495,12 @@ func generateTestDataWithOperatorAndRevCheck(t *testing.T, desc string, isUserID } else { emptyArr := make([]*merkletree.Hash, 0) + addr := common.HexToAddress(ethAddress) + challenge = new(big.Int).SetBytes(merkletree.SwapEndianness(addr.Bytes())) authMTProof = utils.PrepareSiblingsStr(emptyArr, utils.IdentityTreeLevels) authNonRevMTProof = utils.PrepareSiblingsStr(emptyArr, utils.IdentityTreeLevels) + user.AuthClaim, err = core.NewClaim(core.AuthSchemaHash) + require.NoError(t, err) nodeAuxNonRev = utils.NodeAuxValue{ Key: merkletree.HashZero.String(), Value: merkletree.HashZero.String(), diff --git a/update-contract-data-v3.js b/update-contract-data-v3.js index b785359d..ad8dc95b 100644 --- a/update-contract-data-v3.js +++ b/update-contract-data-v3.js @@ -16,7 +16,7 @@ for (const file of files) { circuitName = 'stateTransition' destinationFolder = 'common-data' } else { - circuitName = 'credentialAtomicQueryV3OnChain' + circuitName = 'credentialAtomicQueryV3OnChain-beta.1' destinationFolder = 'v3/data' } const buildPath = `./build/${circuitName}/${circuitName}_js/`; @@ -43,13 +43,5 @@ for (const file of files) { }), 'utf-8'); } -// -// console.log('UPDATE verifiers'); -// for (const part of ['MTP', 'Sig']) { -// const circuitName = `credentialAtomicQuery${part}V2OnChain`; -// const contractName = `${buildFolder}${circuitName}/verifier.sol`; -// const contractContent = fs.readFileSync(contractName).toString(); -// const newContractContent = contractContent.replace('pragma solidity ^0.6.11;', 'pragma solidity ^0.8.0;').replace('contract Verifier', 'contract Verifier' + part); -// fs.writeFileSync(`../contracts/contracts/lib/verifier${part}.sol`, newContractContent, 'utf-8'); -// } + console.log('Done'); From cfefce3b72f3138cac5c524306d3f9fddae2ebe7 Mon Sep 17 00:00:00 2001 From: vmidyllic <74898029+vmidyllic@users.noreply.github.com> Date: Fri, 1 Mar 2024 11:21:52 +0200 Subject: [PATCH 12/14] uncomment tests --- .../credentialAtomicQueryV3OnChain.test.ts | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/test/onchain/credentialAtomicQueryV3OnChain.test.ts b/test/onchain/credentialAtomicQueryV3OnChain.test.ts index 30a1e87d..07cfc7c4 100644 --- a/test/onchain/credentialAtomicQueryV3OnChain.test.ts +++ b/test/onchain/credentialAtomicQueryV3OnChain.test.ts @@ -4,7 +4,7 @@ import {describe} from "mocha"; const path = require("path"); const wasmTester = require("circom_tester").wasm; -describe.only("Test credentialAtomicQueryV3OnChain.circom", function () { +describe("Test credentialAtomicQueryV3OnChain.circom", function () { this.timeout(600000); @@ -30,35 +30,35 @@ describe.only("Test credentialAtomicQueryV3OnChain.circom", function () { const tests = [ // sig - // require(`${sigBasePath}/claimIssuedOnProfileID.json`), - // require(`${sigBasePath}/claimIssuedOnProfileID2.json`), - // require(`${sigBasePath}/claimIssuedOnUserID.json`), - // require(`${sigBasePath}/profileID_subject_userid.json`), - // require(`${sigBasePath}/claimNonMerklized.json`), - // require(`${sigBasePath}/claimWithLinkNonce.json`), - // require(`${sigBasePath}/between_operator.json`), - // require(`${sigBasePath}/less_than_eq_operator.json`), - // require(`${sigBasePath}/selective_disclosure.json`), - // require(`${sigBasePath}/nullify.json`), - // require(`${sigBasePath}/revoked_claim_without_revocation_check.json`), - // require(`${sigBasePath}/jsonld_non_inclusion.json`), - // require(`${sigBasePath}/noop_operator.json`), + require(`${sigBasePath}/claimIssuedOnProfileID.json`), + require(`${sigBasePath}/claimIssuedOnProfileID2.json`), + require(`${sigBasePath}/claimIssuedOnUserID.json`), + require(`${sigBasePath}/profileID_subject_userid.json`), + require(`${sigBasePath}/claimNonMerklized.json`), + require(`${sigBasePath}/claimWithLinkNonce.json`), + require(`${sigBasePath}/between_operator.json`), + require(`${sigBasePath}/less_than_eq_operator.json`), + require(`${sigBasePath}/selective_disclosure.json`), + require(`${sigBasePath}/nullify.json`), + require(`${sigBasePath}/revoked_claim_without_revocation_check.json`), + require(`${sigBasePath}/jsonld_non_inclusion.json`), + require(`${sigBasePath}/noop_operator.json`), require(`${sigBasePath}/onchainIdentity.json`), // mtp - // require(`${mtpBasePath}/claimIssuedOnProfileID.json`), - // require(`${mtpBasePath}/claimIssuedOnProfileID2.json`), - // require(`${mtpBasePath}/claimIssuedOnUserID.json`), - // require(`${mtpBasePath}/profileID_subject_userid.json`), - // require(`${mtpBasePath}/claimNonMerklized.json`), - // require(`${mtpBasePath}/claimWithLinkNonce.json`), - // require(`${mtpBasePath}/between_operator.json`), - // require(`${mtpBasePath}/less_than_eq_operator.json`), - // require(`${mtpBasePath}/selective_disclosure.json`), - // require(`${mtpBasePath}/nullify.json`), - // require(`${mtpBasePath}/revoked_claim_without_revocation_check.json`), - // require(`${mtpBasePath}/noop_operator.json`), - // require(`${mtpBasePath}/onchainIdentity.json`), + require(`${mtpBasePath}/claimIssuedOnProfileID.json`), + require(`${mtpBasePath}/claimIssuedOnProfileID2.json`), + require(`${mtpBasePath}/claimIssuedOnUserID.json`), + require(`${mtpBasePath}/profileID_subject_userid.json`), + require(`${mtpBasePath}/claimNonMerklized.json`), + require(`${mtpBasePath}/claimWithLinkNonce.json`), + require(`${mtpBasePath}/between_operator.json`), + require(`${mtpBasePath}/less_than_eq_operator.json`), + require(`${mtpBasePath}/selective_disclosure.json`), + require(`${mtpBasePath}/nullify.json`), + require(`${mtpBasePath}/revoked_claim_without_revocation_check.json`), + require(`${mtpBasePath}/noop_operator.json`), + require(`${mtpBasePath}/onchainIdentity.json`), ]; tests.forEach(({ desc, inputs, expOut }) => { From bc24a554b23a16947cefb79fdfdba996b94c7e1d Mon Sep 17 00:00:00 2001 From: vmidyllic <74898029+vmidyllic@users.noreply.github.com> Date: Fri, 1 Mar 2024 11:22:21 +0200 Subject: [PATCH 13/14] return p --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 92a152a1..6ec55302 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "clean": "rm -fR dist", "build": "npm run clean && ./node_modules/.bin/tsc --strictNullChecks", - "test": "./node_modules/.bin/mocha --timeout 5000 -r ts-node/register 'test/**/*.test.ts'" + "test": "./node_modules/.bin/mocha --timeout 5000 -p -r ts-node/register 'test/**/*.test.ts'" }, "license": "GPL-3.0", "dependencies": { From f3b07be72db9b6d63cbd25b243bfff061f6f65e3 Mon Sep 17 00:00:00 2001 From: vmidyllic <74898029+vmidyllic@users.noreply.github.com> Date: Fri, 1 Mar 2024 11:24:35 +0200 Subject: [PATCH 14/14] remove files --- .../credentials/onchain/v3/testdata/mtp/onchainIdentity.json | 1 - .../credentials/onchain/v3/testdata/sig/onchainIdentity.json | 1 - 2 files changed, 2 deletions(-) delete mode 100644 testvectorgen/credentials/onchain/v3/testdata/mtp/onchainIdentity.json delete mode 100644 testvectorgen/credentials/onchain/v3/testdata/sig/onchainIdentity.json diff --git a/testvectorgen/credentials/onchain/v3/testdata/mtp/onchainIdentity.json b/testvectorgen/credentials/onchain/v3/testdata/mtp/onchainIdentity.json deleted file mode 100644 index 415a542a..00000000 --- a/testvectorgen/credentials/onchain/v3/testdata/mtp/onchainIdentity.json +++ /dev/null @@ -1 +0,0 @@ -{"desc":"Skip Auth V2 check. Onchain identity (based on ethereum address)","inputs":{"requestID":"41","userGenesisID":"23013175891893363078841232968022302880776034013620341061794940968520126978","profileNonce":"0","claimSubjectProfileNonce":"0","authClaim":["80551937543569765027552589160822318028","0","0","0","0","0","0","0"],"authClaimIncMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"0","challenge":"583091486781463398742321306787801699791102451699","challengeSignatureR8x":"0","challengeSignatureR8y":"0","challengeSignatureS":"0","userClaimsTreeRoot":"0","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"5317387130258456662214331362918410991734007599705406860481038345552731150762","gistRoot":"0","gistMtp":["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","0"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["3583233690122716044519380227940806650830","23013175891893363078841232968022302880776034013620341061794940968520126978","10","0","30803922965249841627828060161","0","0","0"],"issuerClaimMtp":["0","20643387758736831799596675626240785455902781070167728593409367019626753600795","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"],"issuerClaimClaimsTreeRoot":"5900097978117959629345309634255340621836639080907047795968443101805294496810","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"2254426496539590177763798092567819174144925846572543968889300208373841967809","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"5900097978117959629345309634255340621836639080907047795968443101805294496810","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"2254426496539590177763798092567819174144925846572543968889300208373841967809","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"180410020913331409885634153623124536270","claimPathMtp":["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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"0","claimPathValue":"0","operator":2,"slotIndex":2,"timestamp":"1642074362","value":["11","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"],"valueArraySize":1,"issuerClaimSignatureR8x":"0","issuerClaimSignatureR8y":"0","issuerClaimSignatureS":"0","issuerAuthClaim":["0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"0","issuerAuthClaimsTreeRoot":"0","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"0","proofType":"2","linkNonce":"0","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","isBJJAuthEnabled":0},"expOut":{"requestID":"41","userID":"23013175891893363078841232968022302880776034013620341061794940968520126978","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"2254426496539590177763798092567819174144925846572543968889300208373841967809","circuitQueryHash":"12497776133125249452085953139352361956304029990242717119527740207142357852209","gistRoot":"0","timestamp":"1642074362","proofType":"2","challenge":"583091486781463398742321306787801699791102451699","issuerState":"2254426496539590177763798092567819174144925846572543968889300208373841967809","linkID":"0","operatorOutput":"0","nullifier":"0","isBJJAuthEnabled":"0"}} \ No newline at end of file diff --git a/testvectorgen/credentials/onchain/v3/testdata/sig/onchainIdentity.json b/testvectorgen/credentials/onchain/v3/testdata/sig/onchainIdentity.json deleted file mode 100644 index e85060bd..00000000 --- a/testvectorgen/credentials/onchain/v3/testdata/sig/onchainIdentity.json +++ /dev/null @@ -1 +0,0 @@ -{"desc":"Skip Auth V2 check. Onchain identity (based on ethereum address)","inputs":{"requestID":"41","userGenesisID":"23013175891893363078841232968022302880776034013620341061794940968520126978","profileNonce":"0","claimSubjectProfileNonce":"0","authClaim":["80551937543569765027552589160822318028","0","0","0","0","0","0","0"],"authClaimIncMtp":["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"],"authClaimNonRevMtp":["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"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"0","challenge":"583091486781463398742321306787801699791102451699","challengeSignatureR8x":"0","challengeSignatureR8y":"0","challengeSignatureS":"0","userClaimsTreeRoot":"0","userRevTreeRoot":"0","userRootsTreeRoot":"0","userState":"5317387130258456662214331362918410991734007599705406860481038345552731150762","gistRoot":"0","gistMtp":["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","0"],"gistMtpAuxHi":"0","gistMtpAuxHv":"0","gistMtpNoAux":"0","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaim":["3583233690122716044519380227940806650830","23013175891893363078841232968022302880776034013620341061794940968520126978","10","0","30803922965249841627828060161","0","0","0"],"issuerClaimMtp":["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"],"issuerClaimClaimsTreeRoot":"0","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"0","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"2943483356559152311923412925436024635269538717812859789851139200242297094","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","0","0","0","0","0","0","0","0"],"issuerClaimNonRevMtpAuxHi":"0","issuerClaimNonRevMtpAuxHv":"0","issuerClaimNonRevMtpNoAux":"1","claimSchema":"180410020913331409885634153623124536270","claimPathMtp":["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"],"claimPathMtpNoAux":"0","claimPathMtpAuxHi":"0","claimPathMtpAuxHv":"0","claimPathKey":"0","claimPathValue":"0","operator":2,"slotIndex":2,"timestamp":"1642074362","value":["11","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"],"valueArraySize":1,"issuerClaimSignatureR8x":"31157662504561820854772309481007828070585087664133363089794037749307575225","issuerClaimSignatureR8y":"5803322766005884982944103423126505063600964663269516634055232638376630306912","issuerClaimSignatureS":"1050583645731113990130138030352286140101629567126110895514485608106113295293","issuerAuthClaim":["80551937543569765027552589160822318028","0","18843627616807347027405965102907494712213509184168391784663804560181782095821","21769574296201138406688395494914474950554632404504713590270198507141791084591","17476719578317212277","0","0","0"],"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","0","0","0","0","0","0","0","0"],"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","0","0","0","0","0","0","0","0"],"issuerAuthClaimNonRevMtpAuxHi":"0","issuerAuthClaimNonRevMtpAuxHv":"0","issuerAuthClaimNonRevMtpNoAux":"1","issuerAuthClaimsTreeRoot":"20643387758736831799596675626240785455902781070167728593409367019626753600795","issuerAuthRevTreeRoot":"0","issuerAuthRootsTreeRoot":"0","issuerAuthState":"2943483356559152311923412925436024635269538717812859789851139200242297094","proofType":"1","linkNonce":"0","verifierID":"21929109382993718606847853573861987353620810345503358891473103689157378049","nullifierSessionID":"0","isBJJAuthEnabled":0},"expOut":{"requestID":"41","userID":"23013175891893363078841232968022302880776034013620341061794940968520126978","issuerID":"22057981499787921734624217749308316644136637822444794206796063681866502657","issuerClaimNonRevState":"2943483356559152311923412925436024635269538717812859789851139200242297094","circuitQueryHash":"12497776133125249452085953139352361956304029990242717119527740207142357852209","gistRoot":"0","timestamp":"1642074362","proofType":"1","challenge":"583091486781463398742321306787801699791102451699","issuerState":"2943483356559152311923412925436024635269538717812859789851139200242297094","linkID":"0","operatorOutput":"0","nullifier":"0","isBJJAuthEnabled":"0"}} \ No newline at end of file