Skip to content

Commit

Permalink
Rename bodyhash to body_hash
Browse files Browse the repository at this point in the history
  • Loading branch information
SoraSuegami committed Oct 4, 2023
1 parent 2ca55e3 commit 2de76a4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pragma circom 2.1.5;

include "zk-regex-circom/circuits/regex_helpers.circom";

template BodyhashRegex(msg_bytes) {
template BodyHashRegex(msg_bytes) {
signal input msg[msg_bytes];
signal output out;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jest.setTimeout(120000);
describe("Bodyhash Regex", () => {
let circuit;
beforeAll(async () => {
compiler.genFromDecomposed(path.join(__dirname, "../circuits/common/bodyhash.json"), {
circomFilePath: path.join(__dirname, "../circuits/common/bodyhash_regex.circom"),
templateName: "BodyhashRegex",
compiler.genFromDecomposed(path.join(__dirname, "../circuits/common/body_hash.json"), {
circomFilePath: path.join(__dirname, "../circuits/common/body_hash_regex.circom"),
templateName: "BodyHashRegex",
genSubstrs: true
});
circuit = await wasm_tester(path.join(__dirname, "./circuits/test_bodyhash_regex.circom"), option);
circuit = await wasm_tester(path.join(__dirname, "./circuits/test_body_hash_regex.circom"), option);
});

it("bodyhash in the header", async () => {
Expand All @@ -36,7 +36,7 @@ describe("Bodyhash Regex", () => {
const witness = await circuit.calculateWitness(circuitInputs);
await circuit.checkConstraints(witness);
expect(1n).toEqual(witness[1]);
const prefixIdxes = apis.extractSubstrIdxes(signatureField, readFileSync(path.join(__dirname, "../circuits/common/bodyhash.json"), "utf8"))[0];
const prefixIdxes = apis.extractSubstrIdxes(signatureField, readFileSync(path.join(__dirname, "../circuits/common/body_hash.json"), "utf8"))[0];
for (let idx = 0; idx < 1024; ++idx) {
if (idx >= prefixIdxes[0] && idx < prefixIdxes[1]) {
expect(BigInt(paddedStr[idx])).toEqual(witness[2 + idx]);
Expand All @@ -53,11 +53,11 @@ describe("Bodyhash Regex", () => {
const circuitInputs = {
msg: paddedStr,
};
const circuit = await wasm_tester(path.join(__dirname, "./circuits/test_bodyhash_regex.circom"), option);
// const circuit = await wasm_tester(path.join(__dirname, "./circuits/test_bodyhash_regex.circom"), option);
const witness = await circuit.calculateWitness(circuitInputs);
await circuit.checkConstraints(witness);
expect(1n).toEqual(witness[1]);
const prefixIdxes = apis.extractSubstrIdxes(signatureField, readFileSync(path.join(__dirname, "../circuits/common/bodyhash.json"), "utf8"))[0];
const prefixIdxes = apis.extractSubstrIdxes(signatureField, readFileSync(path.join(__dirname, "../circuits/common/body_hash.json"), "utf8"))[0];
for (let idx = 0; idx < 1024; ++idx) {
if (idx >= prefixIdxes[0] && idx < prefixIdxes[1]) {
expect(BigInt(paddedStr[idx])).toEqual(witness[2 + idx]);
Expand Down
3 changes: 3 additions & 0 deletions packages/circom/tests/circuits/test_body_hash_regex.circom
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include "../../circuits/common/body_hash_regex.circom";

component main = BodyHashRegex(1024);
3 changes: 0 additions & 3 deletions packages/circom/tests/circuits/test_bodyhash_regex.circom

This file was deleted.

0 comments on commit 2de76a4

Please sign in to comment.