Skip to content

Commit

Permalink
Fix tests for circuit metadata (#11)
Browse files Browse the repository at this point in the history
* Update dependencies

* Update dependencies

* Update packages

* Fix tests
  • Loading branch information
ytham authored Dec 30, 2023
1 parent 20915e3 commit 12feeaf
Show file tree
Hide file tree
Showing 48 changed files with 164 additions and 162 deletions.
2 changes: 1 addition & 1 deletion circuit/js/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
require('dotenv').config({
path: '.env.local'
path: '.env'
});

module.exports = {
Expand Down
6 changes: 3 additions & 3 deletions circuit/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@axiom-crypto/circuit",
"version": "0.1.5-rc.1",
"version": "0.1.5-rc.2",
"author": "Intrinsic Technologies",
"license": "MIT",
"description": "Client SDK to write custom queries for Axiom, the ZK Coprocessor for Ethereum.",
Expand All @@ -24,10 +24,10 @@
"crypto"
],
"dependencies": {
"@axiom-crypto/core": "2.2.51-rc.1",
"@axiom-crypto/core": "2.2.51-rc.3",
"@axiom-crypto/halo2-lib-js": "0.2.13-alpha.1",
"@axiom-crypto/halo2-wasm": "0.2.10",
"@axiom-crypto/tools": "0.3.35-rc.1",
"@axiom-crypto/tools": "0.3.35-rc.2",
"commander": "^11.1.0",
"ethers": "^6.8.1",
"viem": "^1.19.9"
Expand Down
24 changes: 12 additions & 12 deletions circuit/js/pnpm-lock.yaml

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

13 changes: 12 additions & 1 deletion circuit/js/src/cliHandler/compile.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
import { AxiomBaseCircuit } from "../js";
import { getFunctionFromTs, getProvider, readJsonFromFile, saveJsonToFile } from "./utils";

export const compile = async (path: string, options: { stats: boolean, function: string, output: string, provider?: string, inputs?: string }) => {
export const compile = async (
path: string,
options: {
stats: boolean,
function: string,
output: string,
chainId?: number | string | bigint,
provider?: string,
inputs?: string
}
) => {
const f = await getFunctionFromTs(path, options.function);
const provider = getProvider(options.provider);
const circuit = new AxiomBaseCircuit({
f: f.circuit,
mock: true,
chainId: options.chainId,
provider,
shouldTime: true,
inputSchema: f.inputSchema,
Expand Down
13 changes: 12 additions & 1 deletion circuit/js/src/cliHandler/run.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
import { AxiomBaseCircuit } from "../js";
import { getFunctionFromTs, getProvider, readJsonFromFile, saveJsonToFile } from "./utils";

export const run = async (path: string, options: { stats: boolean, build: string, function: string, output: string, provider?: string, inputs?: string }) => {
export const run = async (
path: string,
options: { stats: boolean,
build: string,
function: string,
output: string,
chainId?: number | string | bigint,
provider?: string,
inputs?: string
}
) => {
const f = await getFunctionFromTs(path, options.function);
const provider = getProvider(options.provider);
const buildJson = readJsonFromFile(options.build);
const circuit = new AxiomBaseCircuit({
f: f.circuit,
mock: true,
chainId: options.chainId,
provider,
shouldTime: true,
inputSchema: buildJson.inputSchema,
Expand Down
2 changes: 1 addition & 1 deletion circuit/js/src/scaffold.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export abstract class AxiomBaseCircuitScaffold<T> extends BaseCircuitScaffold {
mock: inputs.mock,
version: "v2",
});
this.chainId = inputs.chainId?.toString() ?? "5";
this.chainId = inputs.chainId?.toString() ?? "undefined";
this.shouldTime = inputs.shouldTime ?? false;
this.loadedVk = false;
this.f = inputs.f;
Expand Down
3 changes: 1 addition & 2 deletions circuit/js/test/unit/encoder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ describe("Encoder", () => {
maxOutputs: AxiomV2CircuitConstant.UserMaxOutputs,
isAggregation: false,
}
console.log("DEFAULT_METADATA", DEFAULT_METADATA);
const encoded = encodeAxiomV2CircuitMetadata(DEFAULT_METADATA);
const expected = "0x0001000009000100000014030000010080000000000000000000000000000000";
const expected = "0x0001000009000100000004010000010080000000000000000000000000000000";
expect(encoded).toEqual(expected);
});
});
2 changes: 1 addition & 1 deletion circuit/js/test/unit/scaffold.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe("Scaffold", () => {
const _artifact = await testCircuit.compile(defaultInputs);
const computeQuery = await testCircuit.run(defaultInputs);

expect(computeQuery.vkey[0]).toEqual("0x0001000009000100000014030000010080000000000000000000000000000000");
expect(computeQuery.vkey[0]).toEqual("0x0001000009000100000004010000010080000000000000000000000000000000");
expect(computeQuery.computeProof.slice(2).slice(0,128)).toEqual(concat([zeroHash, zeroHash]).slice(2));
}, 30000);
});
9 changes: 3 additions & 6 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@axiom-crypto/client",
"version": "0.1.5-rc.0",
"version": "0.1.5-rc.2",
"author": "Intrinsic Technologies",
"license": "MIT",
"description": "Client SDK to write custom queries for Axiom, the ZK Coprocessor for Ethereum.",
Expand All @@ -23,11 +23,8 @@
"crypto"
],
"dependencies": {
"@axiom-crypto/circuit": "0.1.5-rc.1",
"@axiom-crypto/core": "2.2.51-rc.1",
"@axiom-crypto/halo2-lib-js": "0.2.13-alpha.1",
"@axiom-crypto/halo2-wasm": "0.2.10",
"@axiom-crypto/tools": "0.3.35-rc.1",
"@axiom-crypto/circuit": "0.1.5-rc.2",
"@axiom-crypto/core": "2.2.51-rc.3",
"commander": "^11.1.0",
"ethers": "^6.8.1",
"viem": "^1.19.9"
Expand Down
41 changes: 16 additions & 25 deletions client/pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion client/src/version.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This is an autogenerated file. It should match the version number in package.json.
// Do not modify this file directly.

export const CLIENT_VERSION = "0.1.5-rc.0";
export const CLIENT_VERSION = "0.1.5-rc.2";
8 changes: 2 additions & 6 deletions harness/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@axiom-crypto/harness",
"version": "0.1.7-rc.1",
"version": "0.1.7-rc.2",
"author": "Intrinsic Technologies",
"license": "MIT",
"description": "Circuit harness for axiom-client",
Expand All @@ -23,10 +23,6 @@
"crypto"
],
"dependencies": {
"@axiom-crypto/core": "2.2.51-rc.1",
"@axiom-crypto/halo2-lib-js": "0.2.13-alpha.1",
"@axiom-crypto/halo2-wasm": "0.2.10",
"@axiom-crypto/tools": "0.3.35-rc.1",
"commander": "^11.1.0",
"ethers": "^6.8.1",
"viem": "^1.19.9"
Expand All @@ -43,6 +39,6 @@
"typescript": "^5.3.2"
},
"peerDependencies": {
"@axiom-crypto/client": "0.1.5-rc.0"
"@axiom-crypto/client": "0.1.5-rc.2"
}
}
Loading

0 comments on commit 12feeaf

Please sign in to comment.