getzefi / circomjs Goto Github PK
View Code? Open in Web Editor NEWCircomJS is a javascript framework that allows you to automate your Circom workflow in pure javascript.
Home Page: https://zefi.gitbook.io/circomjs/
CircomJS is a javascript framework that allows you to automate your Circom workflow in pure javascript.
Home Page: https://zefi.gitbook.io/circomjs/
@bajpai244 Can you see this as well?
✔ ~/Documents/devel/zefi/circomjs [feat/publish-to-npm L|✚ 2…35]
15:04 $ npm test
> [email protected] test /Users/deepakaggarwal/Documents/devel/zefi/circomjs
> jest
PASS tests/configParser.test.ts
PASS tests/circomJS.test.ts
(node:3873) Warning: Closing file descriptor 175 on garbage collection
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3873) [DEP0137] DeprecationWarning: Closing a FileHandle object on garbage collection is deprecated. Please close FileHandle objects explicitly using FileHandle.prototype.close(). In the future, an error will be thrown if a file descriptor is closed during garbage collection.
(node:3873) Warning: Closing file descriptor 23 on garbage collection
(node:3873) Warning: Closing file descriptor 23 on garbage collection
(node:3873) Warning: Closing file descriptor 23 on garbage collection
(node:3873) Warning: Closing file descriptor 23 on garbage collection
FAIL tests/circuit.test.ts (34.729 s)
● Console
console.log
JsonRpcProvider failed to startup; retry in 1s
at node_modules/ethers/src.ts/providers/provider-jsonrpc.ts:599:29
● Circuit test › should calculate witness
assert.strictEqual(received, expected)
Expected value to strictly be equal to:
undefined
Received:
null
Message:
circom compiler error
Error: Command failed: circom --wasm --sym --r1cs --output tests/data/out/circuit2 --O0 tests/data/circuits/testtemp/circuit2.circom
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', circom/src/compilation_user.rs:105:49
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Difference:
Comparing two different types of values. Expected undefined but received null.
89 | }
90 | } catch (e) {
> 91 | assert(false,
| ^
92 | "circom compiler error \n" + e);
93 | }
94 | }
at assert (src/vendors/circom_tester/wasm/tester.js:91:2)
at wasm_tester (src/vendors/circom_tester/wasm/tester.js:47:2)
at Circuit.compile (src/circuit.ts:33:28)
at Object.<anonymous> (tests/circuit.test.ts:77:5)
● Circuit test › should generate proof
tests/data/out/circuit2/circuit_0000.zkey: Missing section 10
21 |
22 | await zKey.newZKey(r1cs, powerofTauPath, zKeyPath_0000)
> 23 | await zKey.contribute(zKeyPath_0000, zKeyPath_0001, "1st Contributor Name", "askljdaklsdjkls")
| ^
24 | await zKey.contribute(zKeyPath_0001, zKeyPath_0002, "2nd Contributor Name", "askljdaklsdjkls")
25 |
26 | await zKey.exportBellman(zKeyPath_0002, challenge_phase2_0003)
at Object.startReadUniqueSection (node_modules/@iden3/binfileutils/build/main.cjs:96:38)
at readMPCParams (node_modules/snarkjs/build/main.cjs:638:35)
at Object.phase2contribute [as contribute] (node_modules/snarkjs/build/main.cjs:5510:29)
at genGrothZKey (src/utils/zKey.ts:23:5)
at tests/circuit.test.ts:63:7
● Circuit test › should deploy smart contract verifier
TypeError: invalid BytesLike value (argument="value", value="undefined", code=INVALID_ARGUMENT, version=6.0.3)
68 |
69 | const provider = new JsonRpcProvider(rpcURL)
> 70 | const signer = new Wallet(privKey, provider)
| ^
71 | const cFactory = new ContractFactory(abi, bytecode, signer)
72 |
73 | return cFactory
at makeError (node_modules/ethers/src.ts/utils/errors.ts:656:21)
at assert (node_modules/ethers/src.ts/utils/errors.ts:680:25)
at assertArgument (node_modules/ethers/src.ts/utils/errors.ts:692:5)
at _getBytes (node_modules/ethers/src.ts/utils/data.ts:44:19)
at getBytes (node_modules/ethers/src.ts/utils/data.ts:55:12)
at dataLength (node_modules/ethers/src.ts/utils/data.ts:125:12)
at new SigningKey (node_modules/ethers/src.ts/crypto/signing-key.ts:40:34)
at new Wallet (node_modules/ethers/src.ts/wallet/wallet.ts:42:55)
at getVerifierContractFactory (src/utils/verifier.ts:70:21)
at getVerifierContractFactory (src/utils/verifier.ts:57:22)
at runMicrotasks (<anonymous>)
at Circuit.deploySmartContractVerifier (src/circuit.ts:117:33)
at Object.<anonymous> (tests/circuit.test.ts:150:30)
● Circuit test › should check verification on chain
unsupported protocol undefined (info={ "protocol": "undefined" }, operation="request", code=UNSUPPORTED_OPERATION, version=6.0.3)
at makeError (node_modules/ethers/src.ts/utils/errors.ts:663:21)
at assert (node_modules/ethers/src.ts/utils/errors.ts:680:25)
at getUrl (node_modules/ethers/src.ts/utils/geturl.ts:17:11)
at FetchRequest.#send (node_modules/ethers/src.ts/utils/fetch.ts:492:28)
at FetchRequest.send (node_modules/ethers/src.ts/utils/fetch.ts:547:26)
at JsonRpcProvider._send (node_modules/ethers/src.ts/providers/provider-jsonrpc.ts:1016:40)
at node_modules/ethers/src.ts/providers/provider-jsonrpc.ts:406:51
at Timeout._onTimeout (node_modules/ethers/src.ts/providers/provider-jsonrpc.ts:438:19)
A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --detectOpenHandles to find leaks. Active timers can also cause this, ensure that .unref() was called on them.
Test Suites: 1 failed, 2 passed, 3 total
Tests: 4 failed, 19 passed, 23 total
Snapshots: 0 total
Time: 35.785 s
Ran all test suites.
npm ERR! Test failed. See above for more details.
✘-1 ~/Documents/devel/zefi/circomjs [feat/publish-to-npm L|✚ 9…35]
15:04 $
{
"cID": "mul",
"fileName": "testtemp/circuit2.circom",
"proofType": "groth16",
"compilationMode": "wasm",
"powerOfTauFp": "./tests/data/out/powersOfTau28_hez_final_14.ptau"
},
should have out/mul instead of out/circuit2
template SomeRandomTemplate(x){}
component main = SomeRandomTemplate(2)
Is there a way to pass the template variable x when using circuit.compile()?
Hi, do you have a specific formatter & linter that you use? It would be a bit better to use one so that the code looks the same for everyone.
I can suggest Google TypeScript Style guide, which is installed simply via npx gts init
. You can override some settings there too.
This issue is a review of this codebase and should be resolved inside a separate PR.
Hi, I am compiling my circom using the circomjs
. The compiling of the circom file works fine when I use zkREPL, or using circomjs
in the Groth16 proof type. But with PLONK proof type, there is the error of the following:
❯ node main.js
Error compiling the circuit: out/running/circuit_final.zkey: Missing section 1
Detailed stack trace: Error: out/running/circuit_final.zkey: Missing section 1
at Object.startReadUniqueSection (/Users/jidali/projects/push/server/node_modules/@iden3/binfileutils/build/main.cjs:96:38)
at readHeader$1 (/Users/jidali/projects/push/server/node_modules/snarkjs/build/main.cjs:392:35)
at Object.zkeyExportVerificationKey [as exportVerificationKey] (/Users/jidali/projects/push/server/node_modules/snarkjs/build/main.cjs:6094:24)
I wonder how I can solve this issue. Thanks!
Currently, the default configFilePath
is assumed to be ./circuit.config.json
, hence we have the assumption that the file that consumes this library is at the root of the project { since we want default config path to be at project root.}
The correct way to resolve this should be by looking into path.resolve(process.cwd(),"./circuit.config.json")
, this way it will look for the config at the project root rather than relative to the path of file consuming the library.
@bajpai244 we right now get the following warning when we run tests.
Can you see to it and fix it?
(node:3873) Warning: Closing file descriptor 23 on garbage collection
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.