Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lonerapier committed Nov 5, 2024
1 parent 71038f9 commit 3a9ac39
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions circuits/test/full/full.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ let http_response_plaintext = [

describe("NIVC_FULL", async () => {
let aesCircuit: WitnessTester<["key", "iv", "plainText", "aad", "step_in"], ["step_out"]>;
let httpParseAndLockStartLineCircuit: WitnessTester<["step_in", "beginning", "beginning_length", "middle", "middle_length", "final", "final_length"], ["step_out"]>;
let httpParseAndLockStartLineCircuit: WitnessTester<["step_in", "beginning", "beginningLen", "middle", "middleLen", "final", "finalLen"], ["step_out"]>;
let lockHeaderCircuit: WitnessTester<["step_in", "header", "headerNameLength", "value", "headerValueLength"], ["step_out"]>;
let bodyMaskCircuit: WitnessTester<["step_in"], ["step_out"]>;
let parse_circuit: WitnessTester<["step_in"], ["step_out"]>;
Expand Down Expand Up @@ -150,7 +150,7 @@ describe("NIVC_FULL", async () => {
}
let out = aes_gcm.step_out as number[];
let extendedJsonInput = out.slice(0, DATA_BYTES).concat(Array(Math.max(0, TOTAL_BYTES_ACROSS_NIVC - http_response_plaintext.length)).fill(0));
let parseAndLockStartLine = await httpParseAndLockStartLineCircuit.compute({ step_in: extendedJsonInput, beginning: beginningPadded, beginning_length: beginning.length, middle: middlePadded, middle_length: middle.length, final: finalPadded, final_length: final.length }, ["step_out"]);
let parseAndLockStartLine = await httpParseAndLockStartLineCircuit.compute({ step_in: extendedJsonInput, beginning: beginningPadded, beginningLen: beginning.length, middle: middlePadded, middleLen: middle.length, final: finalPadded, finalLen: final.length }, ["step_out"]);

let lockHeader = await lockHeaderCircuit.compute({ step_in: parseAndLockStartLine.step_out, header: headerNamePadded, headerNameLength: headerName.length, value: headerValuePadded, headerValueLength: headerValue.length }, ["step_out"]);

Expand Down
4 changes: 2 additions & 2 deletions circuits/test/http/nivc/body_mask.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ let http_response_plaintext = [
10, 32, 32, 32, 125, 13, 10, 125];

describe("NIVC_HTTP", async () => {
let httpParseAndLockStartLineCircuit: WitnessTester<["step_in", "beginning", "beginning_length", "middle", "middle_length", "final", "final_length"], ["step_out"]>;
let httpParseAndLockStartLineCircuit: WitnessTester<["step_in", "beginning", "beginningLen", "middle", "middleLen", "final", "finalLen"], ["step_out"]>;
let lockHeaderCircuit: WitnessTester<["step_in", "header", "headerNameLength", "value", "headerValueLength"], ["step_out"]>;
let bodyMaskCircuit: WitnessTester<["step_in"], ["step_out"]>;

Expand Down Expand Up @@ -90,7 +90,7 @@ describe("NIVC_HTTP", async () => {
let middlePadded = middle.concat(Array(MAX_MIDDLE_LENGTH - middle.length).fill(0));
let finalPadded = final.concat(Array(MAX_FINAL_LENGTH - final.length).fill(0));
it("HTTPParseAndExtract", async () => {
let parseAndLockStartLine = await httpParseAndLockStartLineCircuit.compute({ step_in: extendedJsonInput, beginning: beginningPadded, beginning_length: beginning.length, middle: middlePadded, middle_length: middle.length, final: finalPadded, final_length: final.length }, ["step_out"]);
let parseAndLockStartLine = await httpParseAndLockStartLineCircuit.compute({ step_in: extendedJsonInput, beginning: beginningPadded, beginningLen: beginning.length, middle: middlePadded, middleLen: middle.length, final: finalPadded, finalLen: final.length }, ["step_out"]);

let lockHeader = await lockHeaderCircuit.compute({ step_in: parseAndLockStartLine.step_out, header: headerNamePadded, headerNameLength: headerName.length, value: headerValuePadded, headerValueLength: headerValue.length }, ["step_out"]);

Expand Down
6 changes: 3 additions & 3 deletions circuits/test/http/nivc/lock_header.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { circomkit, WitnessTester, toByte } from "../../common";
import { readHTTPInputFile } from "../../common/http";

describe("HTTPLockHeader", async () => {
let httpParseAndLockStartLineCircuit: WitnessTester<["step_in", "beginning", "beginning_length", "middle", "middle_length", "final", "final_length"], ["step_out"]>;
let httpParseAndLockStartLineCircuit: WitnessTester<["step_in", "beginning", "beginningLen", "middle", "middleLen", "final", "finalLen"], ["step_out"]>;
let lockHeaderCircuit: WitnessTester<["step_in", "header", "headerNameLength", "value", "headerValueLength"], ["step_out"]>;

const DATA_BYTES = 320;
Expand Down Expand Up @@ -43,7 +43,7 @@ describe("HTTPLockHeader", async () => {
let headerNamePadded = headerName.concat(Array(MAX_HEADER_NAME_LENGTH - headerName.length).fill(0));
let headerValuePadded = headerValue.concat(Array(MAX_HEADER_VALUE_LENGTH - headerValue.length).fill(0));

let parseAndLockStartLine = await httpParseAndLockStartLineCircuit.compute({ step_in: extendedInput, beginning: beginningPadded, beginning_length: beginning.length, middle: middlePadded, middle_length: middle.length, final: finalPadded, final_length: final.length }, ["step_out"]);
let parseAndLockStartLine = await httpParseAndLockStartLineCircuit.compute({ step_in: extendedInput, beginning: beginningPadded, beginningLen: beginning.length, middle: middlePadded, middleLen: middle.length, final: finalPadded, finalLen: final.length }, ["step_out"]);

await lockHeaderCircuit.expectPass({ step_in: parseAndLockStartLine.step_out, header: headerNamePadded, headerNameLength: headerName.length, value: headerValuePadded, headerValueLength: headerValue.length });
});
Expand All @@ -60,7 +60,7 @@ describe("HTTPLockHeader", async () => {
let headerNamePadded = headerName.concat(Array(MAX_HEADER_NAME_LENGTH - headerName.length).fill(0));
let headerValuePadded = headerValue.concat(Array(MAX_HEADER_VALUE_LENGTH - headerValue.length).fill(0));

let parseAndLockStartLine = await httpParseAndLockStartLineCircuit.compute({ step_in: extendedInput, beginning: beginningPadded, beginning_length: beginning.length, middle: middlePadded, middle_length: middle.length, final: finalPadded, final_length: final.length }, ["step_out"]);
let parseAndLockStartLine = await httpParseAndLockStartLineCircuit.compute({ step_in: extendedInput, beginning: beginningPadded, beginningLen: beginning.length, middle: middlePadded, middleLen: middle.length, final: finalPadded, finalLen: final.length }, ["step_out"]);

await lockHeaderCircuit.expectFail({ step_in: parseAndLockStartLine.step_out, header: headerNamePadded, headerNameLength: headerName.length, value: headerValuePadded, headerValueLength: headerValue.length });
});
Expand Down
6 changes: 3 additions & 3 deletions circuits/test/http/nivc/parse_and_lock_start_line.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { circomkit, WitnessTester, toByte } from "../../common";
import { readHTTPInputFile } from "../../common/http";

describe("HTTPParseAndLockStartLine", async () => {
let httpParseAndLockStartLineCircuit: WitnessTester<["step_in", "beginning", "beginning_length", "middle", "middle_length", "final", "final_length"], ["step_out"]>;
let httpParseAndLockStartLineCircuit: WitnessTester<["step_in", "beginning", "beginningLen", "middle", "middleLen", "final", "finalLen"], ["step_out"]>;

const DATA_BYTES = 320;
const MAX_STACK_HEIGHT = 5;
Expand Down Expand Up @@ -30,7 +30,7 @@ describe("HTTPParseAndLockStartLine", async () => {
let middlePadded = middle.concat(Array(MAX_MIDDLE_LENGTH - middle.length).fill(0));
let finalPadded = final.concat(Array(MAX_FINAL_LENGTH - final.length).fill(0));

await httpParseAndLockStartLineCircuit.expectPass({ step_in: extendedInput, beginning: beginningPadded, beginning_length: beginning.length, middle: middlePadded, middle_length: middle.length, final: finalPadded, final_length: final.length });
await httpParseAndLockStartLineCircuit.expectPass({ step_in: extendedInput, beginning: beginningPadded, beginningLen: beginning.length, middle: middlePadded, middleLen: middle.length, final: finalPadded, finalLen: final.length });
});
}

Expand All @@ -42,7 +42,7 @@ describe("HTTPParseAndLockStartLine", async () => {
let middlePadded = middle.concat(Array(MAX_MIDDLE_LENGTH - middle.length).fill(0));
let finalPadded = final.concat(Array(MAX_FINAL_LENGTH - final.length).fill(0));

await httpParseAndLockStartLineCircuit.expectFail({ step_in: extendedInput, beginning: beginningPadded, beginning_length: beginning.length, middle: middlePadded, middle_length: middle.length, final: finalPadded, final_length: final.length });
await httpParseAndLockStartLineCircuit.expectFail({ step_in: extendedInput, beginning: beginningPadded, beginningLen: beginning.length, middle: middlePadded, middleLen: middle.length, final: finalPadded, finalLen: final.length });
});
}

Expand Down

0 comments on commit 3a9ac39

Please sign in to comment.