Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix generator of test vectors #100

Merged
merged 1 commit into from
Sep 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions testvectorgen/contract_data/generate_json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ type CredentialAtomicMTPOnChainV2Inputs struct {
type CredentialAtomicMTPOnChainV2Outputs struct {
Merklized string `json:"merklized"`
UserID string `json:"userID"`
СircuitQueryHash string `json:"circuitQueryHash"`
CircuitQueryHash string `json:"circuitQueryHash"`
RequestID string `json:"requestID"`
IssuerID string `json:"issuerID"`
IssuerClaimIdenState string `json:"issuerClaimIdenState"`
Expand Down Expand Up @@ -217,7 +217,7 @@ type CredentialAtomicSigOnChainV2Inputs struct {
type CredentialAtomicSigOnChainV2Outputs struct {
Merklized string `json:"merklized"`
UserID string `json:"userID"`
СircuitQueryHash string `json:"circuitQueryHash"`
CircuitQueryHash string `json:"circuitQueryHash"`
IssuerAuthState string `json:"issuerAuthState"`
RequestID string `json:"requestID"`
IssuerID string `json:"issuerID"`
Expand Down Expand Up @@ -483,6 +483,7 @@ func generateMTPData(t *testing.T, desc string, gistData []*gistData, nextState
SlotIndex: 0,
Timestamp: timestamp,
Value: utils.PrepareStrArray([]string{valueKey.String()}, 64),
IsRevocationChecked: 1,
}
valuesHash, err := utils.PoseidonHashValue(utils.FromStringArrayToBigIntArray(inputs.Value))
require.NoError(t, err)
Expand All @@ -504,7 +505,7 @@ func generateMTPData(t *testing.T, desc string, gistData []*gistData, nextState
IssuerID: issuer.ID.BigInt().String(),
IssuerClaimIdenState: issuer.State(t).String(),
IssuerClaimNonRevState: issuer.State(t).String(),
СircuitQueryHash: circuitQueryHash.String(),
CircuitQueryHash: circuitQueryHash.String(),
Timestamp: timestamp,
Merklized: "1",
Challenge: challenge.String(),
Expand Down Expand Up @@ -684,7 +685,7 @@ func generateSigData(t *testing.T, desc string, gistData []*gistData, nextState
IssuerClaimNonRevState: issuerClaimNonRevState.String(),
Timestamp: timestamp,
Merklized: "1",
СircuitQueryHash: circuitQueryHash.String(),
CircuitQueryHash: circuitQueryHash.String(),
Challenge: challenge.String(),
GistRoot: gistRoot.BigInt().String(),
IsRevocationChecked: "1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"desc":"User next transition state","inputs":{"authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimMtp":["0","0","0","0","21205756903155911299867990799154204893460008369926668392180932841700401266404","0","0","0","0","0","0","0","0","0","0","0","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":"17037265493465934746682869748002120766787501276588742860369610466434787550779","isOldStateGenesis":"0","newUserState":"12762287340049584352525153213090774360762035980892092940952129329615052050238","oldUserState":"16943514292072615581951225733277375494772075645432829638168938263745642964909","revTreeRoot":"0","rootsTreeRoot":"0","signatureR8x":"16864812518887942792010071565525907185946245421810636674059264068589071799596","signatureR8y":"19605122908621458115587929878249004144683338926189897941303110764422913648418","signatureS":"1098770063292183967514704567662854070498388776240699511559115283841980288085","userID":"23148936466334350744548790012294489365207440754509988986684797708370051073","newAuthClaimMtp":["21144897396476711644243575284009015724868820567251013274563287581923410286971","0","0","0","21205756903155911299867990799154204893460008369926668392180932841700401266404","0","0","0","0","0","0","0","0","0","0","0","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":"20948820153696573695701996092418155808062743630755896152205516001454929334435","newRevTreeRoot":"0","newRootsTreeRoot":"0"},"expOut":{"userID":"23148936466334350744548790012294489365207440754509988986684797708370051073","newUserState":"12762287340049584352525153213090774360762035980892092940952129329615052050238","oldUserState":"16943514292072615581951225733277375494772075645432829638168938263745642964909","isOldStateGenesis":"0"}}
{"desc":"User next transition state","inputs":{"authClaim":["80551937543569765027552589160822318028","0","4720763745722683616702324599137259461509439547324750011830105416383780791263","4844030361230692908091131578688419341633213823133966379083981236400104720538","16547485850637761685","0","0","0"],"authClaimMtp":["0","0","0","0","21205756903155911299867990799154204893460008369926668392180932841700401266404","0","0","0","0","0","0","0","0","0","0","0","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":"17037265493465934746682869748002120766787501276588742860369610466434787550779","isOldStateGenesis":"0","newUserState":"12762287340049584352525153213090774360762035980892092940952129329615052050238","oldUserState":"16943514292072615581951225733277375494772075645432829638168938263745642964909","revTreeRoot":"0","rootsTreeRoot":"0","signatureR8x":"16864812518887942792010071565525907185946245421810636674059264068589071799596","signatureR8y":"19605122908621458115587929878249004144683338926189897941303110764422913648418","signatureS":"1098770063292183967514704567662854070498388776240699511559115283841980288085","userID":"23148936466334350744548790012294489365207440754509988986684797708370051073","newAuthClaimMtp":["21144897396476711644243575284009015724868820567251013274563287581923410286971","0","0","0","21205756903155911299867990799154204893460008369926668392180932841700401266404","0","0","0","0","0","0","0","0","0","0","0","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":"20948820153696573695701996092418155808062743630755896152205516001454929334435","newRevTreeRoot":"0","newRootsTreeRoot":"0"},"expOut":{"userID":"23148936466334350744548790012294489365207440754509988986684797708370051073","newUserState":"12762287340049584352525153213090774360762035980892092940952129329615052050238","oldUserState":"16943514292072615581951225733277375494772075645432829638168938263745642964909","isOldStateGenesis":"0"}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"desc":"MTP: Issuer first state","inputs":{"requestID":"32","userGenesisID":"23148936466334350744548790012294489365207440754509988986684797708370051073","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":"9261952740082697154168142614372093837079863683752625783051369996839209879956","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":"5068714026114262169251099563098251734732205302049357098840688433759755510297","gistMtpAuxHv":"14350982505419309247370121592555562539756979893755695438303858350858014373778","gistMtpNoAux":"0","issuerID":"21933750065545691586450392143787330185992517860945727248803138245838110721","issuerClaim":["14472269431592746875347367665757389417422","23148936466334350744548790012294489365207440754509988986684797708370051073","17568057213828477233507447080689055308823020388972334380526849356111335110900","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":"15931696748584854818716355440944340820148488238203452818912058603664260541937","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"14350982505419309247370121592555562539756979893755695438303858350858014373778","isRevocationChecked":0,"issuerClaimNonRevClaimsTreeRoot":"15931696748584854818716355440944340820148488238203452818912058603664260541937","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"14350982505419309247370121592555562539756979893755695438303858350858014373778","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":["5559250731000753554753485016695600829384855452867544273344893815961938985436","20222899544143787877985297439625828822272100269106711904511119118819809140477","14730426618666280941604039095550905490156541514901979358549599762282042588641","20497288520738821800886677250569208588689763166335933087499619993954968899866","3295720551404287572425718873751040314503774617833462052445584373469655789999","796356776410152646380783209242693344675665178494017735650545708722024766291","0","0","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":"8566939875427719562376598811066985304309117528846759529734201066483458512800","claimPathValue":"1420070400000000000","operator":1,"slotIndex":0,"timestamp":"1642074362","value":["1420070400000000000","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]},"expOut":{"merklized":"1","userID":"23148936466334350744548790012294489365207440754509988986684797708370051073","circuitQueryHash":"1496222740463292783938163206931059379817846775593932664024082849882751356658","requestID":"32","issuerID":"21933750065545691586450392143787330185992517860945727248803138245838110721","issuerClaimIdenState":"14350982505419309247370121592555562539756979893755695438303858350858014373778","issuerClaimNonRevState":"14350982505419309247370121592555562539756979893755695438303858350858014373778","timestamp":"1642074362","isRevocationChecked":"1","gistRoot":"9261952740082697154168142614372093837079863683752625783051369996839209879956","challenge":"12345"}}
{"desc":"MTP: Issuer first state","inputs":{"requestID":"32","userGenesisID":"23148936466334350744548790012294489365207440754509988986684797708370051073","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":"9261952740082697154168142614372093837079863683752625783051369996839209879956","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":"5068714026114262169251099563098251734732205302049357098840688433759755510297","gistMtpAuxHv":"14350982505419309247370121592555562539756979893755695438303858350858014373778","gistMtpNoAux":"0","issuerID":"21933750065545691586450392143787330185992517860945727248803138245838110721","issuerClaim":["14472269431592746875347367665757389417422","23148936466334350744548790012294489365207440754509988986684797708370051073","17568057213828477233507447080689055308823020388972334380526849356111335110900","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":"15931696748584854818716355440944340820148488238203452818912058603664260541937","issuerClaimRevTreeRoot":"0","issuerClaimRootsTreeRoot":"0","issuerClaimIdenState":"14350982505419309247370121592555562539756979893755695438303858350858014373778","isRevocationChecked":1,"issuerClaimNonRevClaimsTreeRoot":"15931696748584854818716355440944340820148488238203452818912058603664260541937","issuerClaimNonRevRevTreeRoot":"0","issuerClaimNonRevRootsTreeRoot":"0","issuerClaimNonRevState":"14350982505419309247370121592555562539756979893755695438303858350858014373778","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":["5559250731000753554753485016695600829384855452867544273344893815961938985436","20222899544143787877985297439625828822272100269106711904511119118819809140477","14730426618666280941604039095550905490156541514901979358549599762282042588641","20497288520738821800886677250569208588689763166335933087499619993954968899866","3295720551404287572425718873751040314503774617833462052445584373469655789999","796356776410152646380783209242693344675665178494017735650545708722024766291","0","0","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":"8566939875427719562376598811066985304309117528846759529734201066483458512800","claimPathValue":"1420070400000000000","operator":1,"slotIndex":0,"timestamp":"1642074362","value":["1420070400000000000","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]},"expOut":{"merklized":"1","userID":"23148936466334350744548790012294489365207440754509988986684797708370051073","circuitQueryHash":"1496222740463292783938163206931059379817846775593932664024082849882751356658","requestID":"32","issuerID":"21933750065545691586450392143787330185992517860945727248803138245838110721","issuerClaimIdenState":"14350982505419309247370121592555562539756979893755695438303858350858014373778","issuerClaimNonRevState":"14350982505419309247370121592555562539756979893755695438303858350858014373778","timestamp":"1642074362","isRevocationChecked":"1","gistRoot":"9261952740082697154168142614372093837079863683752625783051369996839209879956","challenge":"12345"}}
Loading
Loading