Skip to content

Commit

Permalink
all tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
jp4g committed Nov 3, 2024
1 parent 50aa5db commit deab141
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 7 deletions.
1 change: 0 additions & 1 deletion js/tests/circuits.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import fs from "fs";
import path from "path";
import { ZKEmailProver } from "../src/prover";
import { generateEmailVerifierInputs } from "../src/index";
import { toProverToml } from "../src/utils";
// import circuit1024 from "../../examples/verify_email_1024_bit_dkim/target/verify_email_1024_bit_dkim.json";
import circuit2048 from "../../examples/verify_email_2048_bit_dkim/target/verify_email_2048_bit_dkim.json";
import circuitPartialHash from "../../examples/partial_hash/target/partial_hash.json";
Expand Down
48 changes: 42 additions & 6 deletions js/tests/proving.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import circuit2048 from "../../examples/verify_email_2048_bit_dkim/target/verify
import circuitPartialHash from "../../examples/partial_hash/target/partial_hash.json";
import circuitEmailMask from "../../examples/email_mask/target/email_mask.json";
import circuitExtractAddresses from "../../examples/extract_addresses/target/extract_addresses.json";
import circuitRemoveSoftLineBreak from "../../examples/remove_soft_line_breaks/target/remove_soft_line_breaks.json";

const emails = {
small: fs.readFileSync(path.join(__dirname, "./test-data/email-good.eml")),
Expand All @@ -22,10 +23,6 @@ const inputParams = {
};

describe("ZKEmail.nr E2E Tests", () => {
// todo: get a github email from a throwaway account to verify
// let prover1024: ZKEmailProver;
const selectorText = "All nodes in the Bitcoin network can consult it";

describe("2048-bit circuit", () => {
let prover: ZKEmailProver;
describe("UltraPlonk", () => {
Expand Down Expand Up @@ -95,7 +92,7 @@ describe("ZKEmail.nr E2E Tests", () => {
});
it("Partial Hash", async () => {
const inputs = await generateEmailVerifierInputs(emails.large, {
shaPrecomputeSelector: selectorText,
shaPrecomputeSelector: "All nodes in the Bitcoin network can consult it",
maxHeadersLength: 512,
maxBodyLength: 192,
});
Expand All @@ -114,7 +111,7 @@ describe("ZKEmail.nr E2E Tests", () => {
});
it("Partial Hash", async () => {
const inputs = await generateEmailVerifierInputs(emails.large, {
shaPrecomputeSelector: selectorText,
shaPrecomputeSelector: "All nodes in the Bitcoin network can consult it",
maxHeadersLength: 512,
maxBodyLength: 192,
});
Expand Down Expand Up @@ -222,4 +219,43 @@ describe("ZKEmail.nr E2E Tests", () => {
});
});
});
describe("Soft Line Break Removal Circuit", () => {
let prover: ZKEmailProver;
describe("UltraPlonk", () => {
beforeAll(async () => {
//@ts-ignore
prover = new ZKEmailProver(circuitRemoveSoftLineBreak, "plonk");
});
afterAll(async () => {
prover.destroy();
});
it("Remmove Soft Line Break", async () => {
const inputs = await generateEmailVerifierInputs(emails.large, {
removeSoftLineBreaks: true,
...inputParams,
});
const proof = await prover.fullProve(inputs);
const result = await prover.verify(proof);
expect(result).toBeTruthy();
});
});
describe("UltraHonk", () => {
beforeAll(async () => {
//@ts-ignore
prover = new ZKEmailProver(circuitRemoveSoftLineBreak, "honk");
});
afterAll(async () => {
prover.destroy();
});
it("Remove Soft Line Break", async () => {
const inputs = await generateEmailVerifierInputs(emails.large, {
removeSoftLineBreaks: true,
...inputParams,
});
const proof = await prover.fullProve(inputs);
const result = await prover.verify(proof);
expect(result).toBeTruthy();
});
});
});
});

0 comments on commit deab141

Please sign in to comment.