Skip to content

Commit

Permalink
Wrapped circuits to fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
OBrezhniev committed Feb 28, 2024
1 parent 27272d1 commit 2d97e76
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 9 deletions.
10 changes: 5 additions & 5 deletions test/circuits/utils/claimUtils_getClaimMerklizeRoot.circom
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ template wrappedGetClaimMerklizeRoot() {
signal output flag;
signal output out;

component getClaimMerklizeRoot = GetClaimMerklizeRoot();
getClaimMerklizeRoot.claim <== claim;
getClaimMerklizeRoot.claimFlags <== AddBinaryArrayTag()(claimFlags);
flag <== getClaimMerklizeRoot.flag;
out <== getClaimMerklizeRoot.out;
component check = getClaimMerklizeRoot();
check.claim <== claim;
check.claimFlags <== AddBinaryArrayTag(32)(claimFlags);
flag <== check.flag;
out <== check.out;
}

component main = wrappedGetClaimMerklizeRoot();
12 changes: 11 additions & 1 deletion test/circuits/utils/utils_getSubjectLocation.circom
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
pragma circom 2.1.1;

include "../../../circuits/lib/utils/claimUtils.circom";
include "../../../circuits/lib/utils/tags-managing.circom";

component main = getSubjectLocation();
template wrappedGetSubjectLocation() {
signal input claimFlags[32];
signal output out;

component check = getSubjectLocation();
check.claimFlags <== AddBinaryArrayTag(32)(claimFlags);
out <== check.out;
}

component main = wrappedGetSubjectLocation();
12 changes: 11 additions & 1 deletion test/circuits/utils/utils_isExpirable.circom
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
pragma circom 2.1.1;

include "../../../circuits/lib/utils/claimUtils.circom";
include "../../../circuits/lib/utils/tags-managing.circom";

component main = isExpirable();
template wrappedIsExpirable() {
signal input claimFlags[32];
signal output out;

component check = isExpirable();
check.claimFlags <== AddBinaryArrayTag(32)(claimFlags);
out <== check.out;
}

component main = wrappedIsExpirable();
12 changes: 11 additions & 1 deletion test/circuits/utils/utils_isUpdatable.circom
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
pragma circom 2.1.1;

include "../../../circuits/lib/utils/claimUtils.circom";
include "../../../circuits/lib/utils/tags-managing.circom";

component main = isUpdatable();
template wrappedIsUpdatable() {
signal input claimFlags[32];
signal output out;

component check = isUpdatable();
check.claimFlags <== AddBinaryArrayTag(32)(claimFlags);
out <== check.out;
}

component main = wrappedIsUpdatable();
14 changes: 13 additions & 1 deletion test/circuits/utils/utils_verifyExpirationTime.circom
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
pragma circom 2.1.1;

include "../../../circuits/lib/utils/claimUtils.circom";
include "../../../circuits/lib/utils/tags-managing.circom";

component main = verifyExpirationTime();
template wrappedVerifyExpirationTime() {
signal input expirationFlag; // claimFlags[3] (expiration flag) is set
signal input claim[8];
signal input timestamp;

component check = verifyExpirationTime();
check.expirationFlag <== AddBinaryTag()(expirationFlag);
check.claim <== claim;
check.timestamp <== timestamp;
}

component main = wrappedVerifyExpirationTime();

0 comments on commit 2d97e76

Please sign in to comment.