Skip to content

Commit

Permalink
now that verifications are fast, we don't have to verify semaphore si…
Browse files Browse the repository at this point in the history
…gnatures using the multiprocess service - in fact doing so slows down verification (proofcarryingdata#908)
  • Loading branch information
ichub authored Oct 12, 2023
1 parent 9882497 commit a02d1f7
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions apps/passport-server/src/services/issuanceService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
import {
EdDSATicketPCD,
EdDSATicketPCDPackage,
getEdDSATicketData,
ITicketData,
TicketCategory,
getEdDSATicketData
TicketCategory
} from "@pcd/eddsa-ticket-pcd";
import { EmailPCD, EmailPCDPackage } from "@pcd/email-pcd";
import { getHash } from "@pcd/passport-crypto";
Expand All @@ -31,22 +31,22 @@ import {
ListSingleFeedRequest,
PollFeedRequest,
PollFeedResponseValue,
verifyFeedCredential,
VerifyTicketRequest,
VerifyTicketResult,
zupassDefaultSubscriptions,
ZupassFeedIds,
ZuzaluUserRole,
verifyFeedCredential,
zupassDefaultSubscriptions
ZuzaluUserRole
} from "@pcd/passport-interface";
import {
AppendToFolderAction,
AppendToFolderPermission,
DeleteFolderAction,
joinPath,
PCDAction,
PCDActionType,
PCDPermissionType,
ReplaceInFolderAction,
joinPath
ReplaceInFolderAction
} from "@pcd/pcd-collection";
import { ArgumentTypeName, SerializedPCD } from "@pcd/pcd-types";
import { RSAImagePCDPackage } from "@pcd/rsa-image-pcd";
Expand Down Expand Up @@ -1068,16 +1068,18 @@ export class IssuanceService {
* Returns a promised verification of a PCD, either from the cache or,
* if there is no cache entry, from the multiprocess service.
*/
private cachedVerifySignaturePCD(
private async cachedVerifySignaturePCD(
serializedPCD: SerializedPCD<SemaphoreSignaturePCD>
): Promise<boolean> {
const key = JSON.stringify(serializedPCD);
const cached = this.verificationPromiseCache.get(key);
if (cached) {
return cached;
} else {
const promise =
this.multiprocessService.verifySignaturePCD(serializedPCD);
const deserialized = await SemaphoreSignaturePCDPackage.deserialize(
serializedPCD.pcd
);
const promise = SemaphoreSignaturePCDPackage.verify(deserialized);
this.verificationPromiseCache.set(key, promise);
// If the promise rejects, delete it from the cache
promise.catch(() => this.verificationPromiseCache.delete(key));
Expand Down

0 comments on commit a02d1f7

Please sign in to comment.