diff --git a/src/circuits/linkedMultiQuery.ts b/src/circuits/linkedMultiQuery.ts index f3834b2..bf6d6e1 100644 --- a/src/circuits/linkedMultiQuery.ts +++ b/src/circuits/linkedMultiQuery.ts @@ -63,7 +63,11 @@ export class LinkedMultiQueryVerifier implements PubSignalsVerifier { ]); }); - if (!queryHashes.every((queryHash, i) => queryHash === this.pubSignals.circuitQueryHash[i])) { + const circuitQueryHashes = this.pubSignals.circuitQueryHash + .filter((i) => i !== 0n) + .sort(this.bigIntCompare); + queryHashes.sort(this.bigIntCompare); + if (!queryHashes.every((queryHash, i) => queryHash === circuitQueryHashes[i])) { throw new Error('query hashes do not match'); } @@ -73,4 +77,10 @@ export class LinkedMultiQueryVerifier implements PubSignalsVerifier { async verifyStates(): Promise { return Promise.resolve(); } + + private bigIntCompare = (a: bigint, b: bigint): number => { + if (a < b) return -1; + if (a > b) return 1; + return 0; + }; } diff --git a/src/index.ts b/src/index.ts index 7677d84..f738d8b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ export * as auth from '@lib/auth/auth'; export * as resolver from '@lib/state/resolver'; export * as protocol from '@lib/types-sdk'; -export { core } from '@0xpolygonid/js-sdk'; \ No newline at end of file +export { core } from '@0xpolygonid/js-sdk';