Skip to content

Commit

Permalink
Fix/claim path not exists (#127)
Browse files Browse the repository at this point in the history
* remove claimPathNotExists from query hash
  • Loading branch information
vmidyllic authored Feb 28, 2024
1 parent 2e8a9f1 commit 1907e18
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
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

0 comments on commit 1907e18

Please sign in to comment.