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/claim path not exists #127

Merged
merged 2 commits into from
Feb 28, 2024
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
10 changes: 4 additions & 6 deletions circuits/lib/utils/queryHash.circom
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ template QueryHash(maxValueArraySize) {

signal output out;

signal claimPathNotExists <== AND()(IsZero()(value[0]), IsEqual()([operator, 11]));

/////////////////////////////////////////////////////////////////
// Calculate query hash
/////////////////////////////////////////////////////////////////
Expand All @@ -27,16 +25,16 @@ template QueryHash(maxValueArraySize) {
slotIndex,
operator,
claimPathKey,
claimPathNotExists,
merklized,
valueHash
]);

out <== Poseidon(6)([
firstPartQueryHash,
valueArraySize,
merklized,
isRevocationChecked,
verifierID,
nullifierSessionID
nullifierSessionID,
0
]);
}
}
13 changes: 5 additions & 8 deletions testvectorgen/credentials/onchain/v3/v3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ type Outputs struct {
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
Challenge string `json:"challenge"`
IssuerState string `json:"issuerState"`
Expand Down Expand Up @@ -580,25 +579,25 @@ func generateTestDataWithOperatorAndRevCheck(t *testing.T, desc string, isUserID
)
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,
big.NewInt(0),
merklizedBigInt,
valuesHash,
})
require.NoError(t, err)
merklizedBigInt, ok := big.NewInt(0).SetString(merklized, 10)
require.True(t, ok)
circuitQueryHash, err := poseidon.Hash([]*big.Int{
firstPartQueryHash,
big.NewInt(int64(valueArraySize)),
merklizedBigInt,
big.NewInt(int64(isRevocationChecked)),
verifierID,
nullifierSessionID_,
new(big.Int),
})
require.NoError(t, err)

Expand All @@ -622,7 +621,6 @@ func generateTestDataWithOperatorAndRevCheck(t *testing.T, desc string, isUserID
IssuerClaimNonRevState: issuer.State(t).String(),
CircuitQueryHash: circuitQueryHash.String(),
Timestamp: timestamp,
Merklized: merklized,
Challenge: challenge.String(),
GistRoot: gistRoot.BigInt().String(),
ProofType: proofType,
Expand Down Expand Up @@ -805,7 +803,7 @@ func generateJSONLD_NON_INCLUSION_TestData(t *testing.T, isUserIDProfile, isSubj
big.NewInt(int64(inputs.SlotIndex)),
big.NewInt(int64(inputs.Operator)),
pathKey,
big.NewInt(1),
big.NewInt(1), // merklized
valuesHash,
})
require.NoError(t, err)
Expand All @@ -818,9 +816,9 @@ func generateJSONLD_NON_INCLUSION_TestData(t *testing.T, isUserIDProfile, isSubj
firstPartQueryHash,
big.NewInt(int64(valueArraySize)),
big.NewInt(1),
big.NewInt(1),
verifierID,
nullifierSessionID_,
big.NewInt(0),
})
require.NoError(t, err)

Expand All @@ -830,7 +828,6 @@ func generateJSONLD_NON_INCLUSION_TestData(t *testing.T, isUserIDProfile, isSubj
IssuerID: issuer.ID.BigInt().String(),
IssuerClaimNonRevState: issuerClaimNonRevState.String(),
Timestamp: timestamp,
Merklized: "1",
CircuitQueryHash: circuitQueryHash.String(),
Challenge: challenge.String(),
GistRoot: gistRoot.BigInt().String(),
Expand Down
Loading