Skip to content

Commit

Permalink
Circom 2.2.0 (#53)
Browse files Browse the repository at this point in the history
* updated latest supported Circom version to 2.2.0

* fixed unsupported versions test

* fixed platform-specific test

* restricted bus usage

* fixed error message
  • Loading branch information
mllwchrry authored Nov 12, 2024
1 parent 60e3fb4 commit 8c49f92
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ export const COMPILER_AMD_REPOSITORY_URL = "https://github.com/iden3/circom/rele
export const COMPILER_ARM_REPOSITORY_URL = "https://github.com/distributed-lab/circom/releases/download";
export const COMPILER_WASM_REPOSITORY_URL = "https://github.com/distributed-lab/circom-wasm/releases/download";

export const LATEST_SUPPORTED_CIRCOM_VERSION = "2.1.9";
export const LATEST_SUPPORTED_CIRCOM_VERSION = "2.2.0";
export const OLDEST_SUPPORTED_CIRCOM_VERSION = "2.0.5";

export const WASM_COMPILER_VERSIONING: { [key: string]: string } = {
"2.1.8": "0.2.18-rc.3",
"2.1.9": "0.2.19-rc.0",
"2.2.0": "0.2.20-rc.0",
};
5 changes: 5 additions & 0 deletions src/core/dependencies/parser/CircomTemplateInputsVisitor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
BusDeclarationContext,
CircomValueType,
CircomVisitor,
ExpressionContext,
Expand Down Expand Up @@ -143,6 +144,10 @@ export class CircomTemplateInputsVisitor extends CircomVisitor<void> {
throw new Error("INTERNAL ERROR: SignalIdentifier should have a SignalDeclarationContext as a parent of parent");
}

if (ctx.parentCtx!.parentCtx instanceof BusDeclarationContext) {
throw new Error("Buses are not supported");
}

const signalDeclarationContext = ctx.parentCtx!.parentCtx as SignalDeclarationContext;

let signalType = "intermediate";
Expand Down
8 changes: 4 additions & 4 deletions test/unit/core/compile/circom-compiler-factory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe("CircomCompilerFactory", () => {
});

async function checkPlatformSpecificCompiler(osType: NodeJS.Platform) {
const compilerDir = path.join(os.homedir(), ".zkit", "compilers", LATEST_SUPPORTED_CIRCOM_VERSION);
const compilerDir = path.join(os.homedir(), ".zkit", "compilers");
fsExtra.rmSync(compilerDir, { recursive: true, force: true });

const platformStub = stub(os, "platform").callsFake(() => {
Expand All @@ -55,7 +55,7 @@ describe("CircomCompilerFactory", () => {
expect(compiler).to.be.instanceof(BinaryCircomCompiler);
}

expect(fsExtra.readdirSync(compilerDir)).to.be.deep.equal([platform]);
expect(fsExtra.readdirSync(path.join(compilerDir, LATEST_SUPPORTED_CIRCOM_VERSION))).to.be.deep.equal([platform]);

fsExtra.rmSync(compilerDir, { recursive: true, force: true });
platformStub.restore();
Expand Down Expand Up @@ -97,12 +97,12 @@ describe("CircomCompilerFactory", () => {

it("should correctly throw error if pass invalid version", async function () {
let invalidVersion = "2.1.10";
let reason = `Unsupported Circom compiler version - ${invalidVersion}. Please provide another version.`;
let reason = `Unsupported WASM version - ${invalidVersion}`;

createCircomCompilerFactory();
await expect(CircomCompilerFactory!.createCircomCompiler(invalidVersion, true)).to.be.rejectedWith(reason);

invalidVersion = "2.2.0";
invalidVersion = "2.2.1";
reason = `Unsupported Circom compiler version - ${invalidVersion}. Please provide another version.`;

await expect(CircomCompilerFactory!.createCircomCompiler(invalidVersion, false)).to.be.rejectedWith(reason);
Expand Down

0 comments on commit 8c49f92

Please sign in to comment.