Skip to content

Commit

Permalink
Adjust circuits
Browse files Browse the repository at this point in the history
  • Loading branch information
Kolezhniuk committed Dec 8, 2023
1 parent 77a98bb commit dd51d4d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
14 changes: 5 additions & 9 deletions src/circuits/atomicV3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class AtomicQueryV3PubSignalsVerifier
};
await checkQueryRequest(query, outs, schemaLoader, verifiablePresentation, opts);

const { proofType, verifierID, verifierSessionID, linkID, nullifier } = this.pubSignals;
const { proofType, verifierID, nullifier, nullifierSessionID } = this.pubSignals;

if (
!(query.proofType === ProofType.BJJSignature && proofType === 1) &&
Expand All @@ -68,22 +68,18 @@ export class AtomicQueryV3PubSignalsVerifier
throw new Error('wrong verifier is used for nullification');
}

if (!query.verifierSessionId) {
if (!query.nullifierSessionId) {
throw new Error('verifierSessionId is required');
}

const vSessionID = BigInt(query.verifierSessionId);
const nSessionId = BigInt(query.nullifierSessionId);

if (verifierSessionID !== vSessionID) {
if (nullifierSessionID !== nSessionId) {
throw new Error(
`wrong verifier session id is used for nullification, expected ${vSessionID}, got ${verifierSessionID}`
`wrong verifier session id is used for nullification, expected ${nSessionId}, got ${nullifierSessionID}`
);
}
}

if (query.linkSessionId && !linkID) {
throw new Error("proof doesn't contain link id, but link session id is provided");
}
}

async verifyStates(resolvers: Resolvers, opts?: VerifyOpts): Promise<void> {
Expand Down
4 changes: 2 additions & 2 deletions src/circuits/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export interface Query {
claimID?: string;
skipClaimRevocationCheck?: boolean;
proofType?: string;
verifierSessionId?: string;
linkSessionId?: string;
nullifierSessionId?: string;
groupId?: number;
}

// ClaimOutputs fields that are used in proof generation
Expand Down

0 comments on commit dd51d4d

Please sign in to comment.