projectsophon / hardhat-circom

Hardhat plugin to integrate Circom and SnarkJS into your build process.
GNU General Public License v3.0
115 stars 18 forks source link

Support multiple output paths #52

Closed dmpierre closed 5 months ago

dmpierre commented 2 years ago

Hey :)

It would be nice to be able to specify in hardhat.config.js multiple output paths. For instance:

        wasm: ["circuit/init.wasm", "ui/resources/init.wasm"],
        zkey: ["circuit/init.zkey", "ui/resources/init.zkey"]

I could have a look into how to do this, what do you think?

phated commented 2 years ago

I don't think this is a necessary feature. You can hook the task itself and copy the file based on the normalized config. One improvement could be to return the written filepaths from the task so the hooked task doesn't need to read the normalized config 🤔

dmpierre commented 2 years ago

I see, such as:

return { type: "mem", name: circuit.name, data: beaconZkeyFastFile.data, wasm: circuit.wasm, zkey: circuit.zkey, r1cs: circuit.r1cs, vkey: circuit.vkey };

both for plonk and groth16. I don't mind taking that up, tell me if this fits and will get this done.

phated commented 2 years ago

I'm not exactly sure which return information is valuable when someone hooks the task and calls await runSuper(). I know that the --circuit flag makes it hard to know which circuits were actually compiled. I'd be fine with just the paths, but maybe all of the fastfile info should be passed if someone want to write it directly. 🤔

dmpierre commented 2 years ago

Alright :) I will take a look at this