Skip to content

Commit

Permalink
Don't include is/NotMemberOf at all if not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
robknight committed Oct 1, 2024
1 parent b8017e2 commit 65a2405
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/podspec/src/gpc/proof_request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,12 @@ function makeProofRequest<P extends NamedPODs>(

const entryConfig: GPCProofEntryConfig = {
isRevealed,
isMemberOf: isMemberOf
? `allowlist_${podName}_${entryName}`
: undefined,
isNotMemberOf: isNotMemberOf
? `blocklist_${podName}_${entryName}`
: undefined,
...(isMemberOf
? { isMemberOf: `allowlist_${podName}_${entryName}` }
: {}),
...(isNotMemberOf
? { isNotMemberOf: `blocklist_${podName}_${entryName}` }
: {}),
...(inRange ? { inRange: entrySchema.inRange } : {}),
...(isOwnerID ? { isOwnerID: owner.protocol } : {})
};
Expand Down
20 changes: 20 additions & 0 deletions packages/ticket-spec/test/ticket-utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,25 @@ describe("ticket-utils", () => {
externalNullifier: { type: "string", value: "1" },
watermark: { type: "string", value: "1" }
});

const proofRequest = request.getProofRequest();
expect(proofRequest.externalNullifier).toEqual({
type: "string",
value: "1"
});
expect(proofRequest.watermark).toEqual({
type: "string",
value: "1"
});
expect(Object.keys(proofRequest.membershipLists)).toHaveLength(0);
expect(proofRequest.proofConfig.pods.ticket).toBeDefined();
// The owner entry is present because we specified an external nullifier
expect(
Object.keys(proofRequest.proofConfig.pods.ticket?.entries ?? {})
).toHaveLength(1);
expect(proofRequest.proofConfig.pods.ticket?.entries?.owner).toEqual({
isOwnerID: "SemaphoreV4",
isRevealed: false
});
});
});

0 comments on commit 65a2405

Please sign in to comment.