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

Circom 2.2.0 #53

Merged
merged 6 commits into from
Nov 12, 2024
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
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
Loading