Skip to content

Commit

Permalink
fix compare arr
Browse files Browse the repository at this point in the history
  • Loading branch information
volodymyr-basiuk committed Feb 1, 2024
1 parent 449672a commit 9747564
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/circuits/linkedMultiQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class LinkedMultiQueryVerifier implements PubSignalsVerifier {
ldOpts
);

const queryHashes = queriesMetadata.map((queryMeta) => {
let queryHashes = queriesMetadata.map((queryMeta) => {
const valueHash = poseidon.spongeHashX(queryMeta.values, 6);
return poseidon.hash([
schemaHash.bigInt(),
Expand All @@ -68,8 +68,8 @@ export class LinkedMultiQueryVerifier implements PubSignalsVerifier {
const zeros: Array<bigint> = Array.from({
length: this.pubSignals.circuitQueryHash.length - queryHashes.length
}).fill(BigInt(0)) as Array<bigint>;
const fullQueryHashes: Array<bigint> = queryHashes.concat(zeros);
fullQueryHashes.sort(this.bigIntCompare);
queryHashes = queryHashes.concat(zeros);
queryHashes.sort(this.bigIntCompare);

if (!queryHashes.every((queryHash, i) => queryHash === this.pubSignals.circuitQueryHash[i])) {
throw new Error('query hashes do not match');
Expand All @@ -82,7 +82,7 @@ export class LinkedMultiQueryVerifier implements PubSignalsVerifier {
return Promise.resolve();
}

bigIntCompare = (a: bigint, b: bigint): number => {
private bigIntCompare = (a: bigint, b: bigint): number => {
if (a < b) return -1;
if (a > b) return 1;
return 0;
Expand Down

0 comments on commit 9747564

Please sign in to comment.