Skip to content

Commit

Permalink
feat: added body masking template
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyas-londhe committed Jul 13, 2024
1 parent ffc2960 commit 3dc1a99
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
30 changes: 30 additions & 0 deletions packages/circuits/tests/body-masker.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { wasm as wasm_tester } from "circom_tester";
import path from "path";

describe("BodyMasker Circuit", () => {
let circuit: any;

beforeAll(async () => {
circuit = await wasm_tester(
path.join(__dirname, "./test-circuits/body-masker-test.circom"),
{
recompile: true,
include: path.join(__dirname, "../../../node_modules"),
output: path.join(__dirname, "./compiled-test-circuits"),
}
);
});

it("should mask the body correctly", async () => {
const input = {
body: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
mask: [1, 0, 1, 0, 1, 0, 1, 0, 1, 0],
};

const witness = await circuit.calculateWitness(input);
await circuit.checkConstraints(witness);
await circuit.assertOut(witness, {
maskedBody: [1, 0, 3, 0, 5, 0, 7, 0, 9, 0],
});
});
});
5 changes: 5 additions & 0 deletions packages/circuits/tests/test-circuits/body-masker-test.circom
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.6;

include "../../helpers/body-masker.circom";

component main = BodyMasker(10);

0 comments on commit 3dc1a99

Please sign in to comment.