Skip to content

Commit

Permalink
Fix compile cache schema (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hrom131 authored Oct 30, 2024
1 parent 93224ef commit 755e538
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 21 deletions.
11 changes: 9 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solarity/hardhat-zkit",
"version": "0.4.10",
"version": "0.4.11",
"description": "The ultimate TypeScript environment for Circom development",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
Expand Down
3 changes: 3 additions & 0 deletions src/cache/schemas/compile-schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ export const CompileFlagsSchema = z.object({
sym: z.boolean(),
json: z.boolean(),
c: z.boolean(),
O0: z.boolean(),
O1: z.boolean(),
O2: z.boolean(),
});

export const ResolvedFileDataSchema = z.object({
Expand Down
36 changes: 18 additions & 18 deletions src/core/dependencies/parser/CircomTemplateInputsVisitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,20 @@ export class CircomTemplateInputsVisitor extends CircomVisitor<void> {
}
};

visitSignalDeclaration = (ctx: SignalDeclarationContext) => {
const signalDefinition = ctx.signalDefinition();

let signalType = "intermediate";

if (signalDefinition.SIGNAL_TYPE()) {
signalType = signalDefinition.SIGNAL_TYPE().getText();
}

[signalDefinition.identifier(), ...ctx.identifier_list()].forEach((identifier) =>
this._saveInputData(identifier, signalType),
);
};

visitVarDeclaration = (ctx: VarDeclarationContext) => {
const vars = this._parseVarDefinition(ctx.varDefinition());

Expand All @@ -129,11 +143,11 @@ export class CircomTemplateInputsVisitor extends CircomVisitor<void> {
});
};

_parseVarDefinition = (ctx: VarDefinitionContext): string[] => {
private _parseVarDefinition(ctx: VarDefinitionContext): string[] {
return ctx.identifier_list().map((identifier) => identifier.ID(0).getText());
};
}

_parseRHSValue = (ctx: RhsValueContext): bigint[] => {
private _parseRHSValue(ctx: RhsValueContext): bigint[] {
const expressionVisitor = new CircomExpressionVisitor(true, this.vars);

/**
Expand Down Expand Up @@ -183,21 +197,7 @@ export class CircomTemplateInputsVisitor extends CircomVisitor<void> {
}

throw new HardhatZKitError(`RHS value as function call is not supported - ${ctx.getText()}`);
};

visitSignalDeclaration = (ctx: SignalDeclarationContext) => {
const signalDefinition = ctx.signalDefinition();

let signalType = "intermediate";

if (signalDefinition.SIGNAL_TYPE()) {
signalType = signalDefinition.SIGNAL_TYPE().getText();
}

[signalDefinition.identifier(), ...ctx.identifier_list()].forEach((identifier) =>
this._saveInputData(identifier, signalType),
);
};
}

private _saveInputData(identifier: IdentifierContext, signalType: string) {
const parsedData = this._parseIdentifier(identifier);
Expand Down

0 comments on commit 755e538

Please sign in to comment.