Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix acvm_js linting and tests #2834

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions .github/workflows/acvm-test-acvm-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,9 @@ jobs:

- name: Set up test environment
uses: ./.github/actions/setup
with:
working-directory: ./acvm-repo/acvm_js

- name: Run node tests
working-directory: ./acvm-repo/acvm_js
run: |
yarn
yarn test
run: yarn workspace @noir-lang/acvm_js test

test-acvm_js-browser:
needs: [build-acvm-js-package]
Expand All @@ -81,17 +76,12 @@ jobs:

- name: Set up test environment
uses: ./.github/actions/setup
with:
working-directory: ./acvm-repo/acvm_js

- name: Install playwright deps
working-directory: ./acvm-repo/acvm_js
run: |
npx playwright install
npx playwright install-deps

- name: Run browser tests
working-directory: ./acvm-repo/acvm_js
run: |
yarn
yarn test:browser
run: yarn workspace @noir-lang/acvm_js test:browser
18 changes: 1 addition & 17 deletions acvm-repo/acvm_js/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "prettier"],
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
rules: {
"comma-spacing": ["error", { before: false, after: true }],
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"warn", // or "error"
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
"prettier/prettier": "error",
},
extends: ["../../.eslintrc.js"],
};
22 changes: 11 additions & 11 deletions acvm-repo/acvm_js/test/browser/execute_circuit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ it("successfully executes circuit and extracts return value", async () => {
initialWitnessMap,
() => {
throw Error("unexpected oracle");
}
},
);

// Solved witness should be consistent with initial witness
Expand All @@ -50,7 +50,7 @@ it("successfully processes simple brillig foreign call opcodes", async () => {
let observedInputs: string[][] = [];
const foreignCallHandler: ForeignCallHandler = async (
name: string,
inputs: string[][]
inputs: string[][],
) => {
// Throwing inside the oracle callback causes a timeout so we log the observed values
// and defer the check against expected values until after the execution is complete.
Expand All @@ -63,7 +63,7 @@ it("successfully processes simple brillig foreign call opcodes", async () => {
const solved_witness: WitnessMap = await executeCircuit(
bytecode,
initialWitnessMap,
foreignCallHandler
foreignCallHandler,
);

// Check that expected values were passed to oracle callback.
Expand All @@ -89,7 +89,7 @@ it("successfully processes complex brillig foreign call opcodes", async () => {
let observedInputs: string[][] = [];
const foreignCallHandler: ForeignCallHandler = async (
name: string,
inputs: string[][]
inputs: string[][],
) => {
// Throwing inside the oracle callback causes a timeout so we log the observed values
// and defer the check against expected values until after the execution is complete.
Expand All @@ -102,7 +102,7 @@ it("successfully processes complex brillig foreign call opcodes", async () => {
const solved_witness: WitnessMap = await executeCircuit(
bytecode,
initialWitnessMap,
foreignCallHandler
foreignCallHandler,
);

// Check that expected values were passed to oracle callback.
Expand All @@ -124,7 +124,7 @@ it("successfully executes a Pedersen opcode", async function () {
initialWitnessMap,
() => {
throw Error("unexpected oracle");
}
},
);

expect(solvedWitness).to.be.deep.eq(expectedWitnessMap);
Expand All @@ -140,7 +140,7 @@ it("successfully executes a FixedBaseScalarMul opcode", async () => {
initialWitnessMap,
() => {
throw Error("unexpected oracle");
}
},
);

expect(solvedWitness).to.be.deep.eq(expectedWitnessMap);
Expand All @@ -156,7 +156,7 @@ it("successfully executes a SchnorrVerify opcode", async () => {
initialWitnessMap,
() => {
throw Error("unexpected oracle");
}
},
);

expect(solvedWitness).to.be.deep.eq(expectedWitnessMap);
Expand All @@ -172,7 +172,7 @@ it("successfully executes a MemoryOp opcode", async () => {
initialWitnessMap,
() => {
throw Error("unexpected oracle");
}
},
);

expect(solvedWitness).to.be.deep.eq(expectedWitnessMap);
Expand All @@ -194,7 +194,7 @@ it("successfully executes two circuits with same backend", async function () {
initialWitnessMap,
() => {
throw Error("unexpected oracle");
}
},
);

expect(solvedWitness0).to.be.deep.eq(expectedWitnessMap);
Expand All @@ -205,7 +205,7 @@ it("successfully executes two circuits with same backend", async function () {
initialWitnessMap,
() => {
throw Error("unexpected oracle");
}
},
);
expect(solvedWitness1).to.be.deep.eq(expectedWitnessMap);
});
24 changes: 12 additions & 12 deletions acvm-repo/acvm_js/test/node/execute_circuit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ it("successfully executes circuit and extracts return value", async () => {
initialWitnessMap,
() => {
throw Error("unexpected oracle");
}
},
);

// Solved witness should be consistent with initial witness
Expand All @@ -43,7 +43,7 @@ it("successfully processes simple brillig foreign call opcodes", async () => {
let observedInputs: string[][] = [];
const foreignCallHandler: ForeignCallHandler = async (
name: string,
inputs: string[][]
inputs: string[][],
) => {
// Throwing inside the oracle callback causes a timeout so we log the observed values
// and defer the check against expected values until after the execution is complete.
Expand All @@ -56,7 +56,7 @@ it("successfully processes simple brillig foreign call opcodes", async () => {
const solved_witness: WitnessMap = await executeCircuit(
bytecode,
initialWitnessMap,
foreignCallHandler
foreignCallHandler,
);

// Check that expected values were passed to oracle callback.
Expand All @@ -82,7 +82,7 @@ it("successfully processes complex brillig foreign call opcodes", async () => {
let observedInputs: string[][] = [];
const foreignCallHandler: ForeignCallHandler = async (
name: string,
inputs: string[][]
inputs: string[][],
) => {
// Throwing inside the oracle callback causes a timeout so we log the observed values
// and defer the check against expected values until after the execution is complete.
Expand All @@ -95,7 +95,7 @@ it("successfully processes complex brillig foreign call opcodes", async () => {
const solved_witness: WitnessMap = await executeCircuit(
bytecode,
initialWitnessMap,
foreignCallHandler
foreignCallHandler,
);

// Check that expected values were passed to oracle callback.
Expand All @@ -118,7 +118,7 @@ it("successfully executes a Pedersen opcode", async function () {
initialWitnessMap,
() => {
throw Error("unexpected oracle");
}
},
);

expect(solvedWitness).to.be.deep.eq(expectedWitnessMap);
Expand All @@ -134,7 +134,7 @@ it("successfully executes a FixedBaseScalarMul opcode", async () => {
initialWitnessMap,
() => {
throw Error("unexpected oracle");
}
},
);

expect(solvedWitness).to.be.deep.eq(expectedWitnessMap);
Expand All @@ -150,7 +150,7 @@ it("successfully executes a SchnorrVerify opcode", async () => {
initialWitnessMap,
() => {
throw Error("unexpected oracle");
}
},
);

expect(solvedWitness).to.be.deep.eq(expectedWitnessMap);
Expand All @@ -166,7 +166,7 @@ it("successfully executes a MemoryOp opcode", async () => {
initialWitnessMap,
() => {
throw Error("unexpected oracle");
}
},
);

expect(solvedWitness).to.be.deep.eq(expectedWitnessMap);
Expand All @@ -190,7 +190,7 @@ it("successfully executes two circuits with same backend", async function () {
initialWitnessMap,
() => {
throw Error("unexpected oracle");
}
},
);

const solvedWitness1 = await executeCircuitWithBlackBoxSolver(
Expand All @@ -199,7 +199,7 @@ it("successfully executes two circuits with same backend", async function () {
initialWitnessMap,
() => {
throw Error("unexpected oracle");
}
},
);

expect(solvedWitness0).to.be.deep.eq(expectedWitnessMap);
Expand All @@ -225,7 +225,7 @@ it("successfully executes 500 circuits with same backend", async function () {
initialWitnessMap,
() => {
throw Error("unexpected oracle");
}
},
);

expect(solvedWitness).to.be.deep.eq(expectedWitnessMap);
Expand Down
2 changes: 1 addition & 1 deletion acvm-repo/acvm_js/test/shared/schnorr_verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ export const initialWitnessMap = new Map([

export const expectedWitnessMap = new Map(initialWitnessMap).set(
77,
"0x0000000000000000000000000000000000000000000000000000000000000001"
"0x0000000000000000000000000000000000000000000000000000000000000001",
);
44 changes: 0 additions & 44 deletions acvm/acvm_js/Cargo.toml

This file was deleted.