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

Doesn't work on Windows, "invalid input file" #78

Open
nth-commit opened this issue Jan 21, 2023 · 12 comments
Open

Doesn't work on Windows, "invalid input file" #78

nth-commit opened this issue Jan 21, 2023 · 12 comments

Comments

@nth-commit
Copy link

I haven't done a deep investigation into why, just reporting first in case anyone has any insights or any other Windows users are out there going insane wondering what they've done wrong.

Reproduction

  1. Clone https://github.com/0xPARC/circom-starter, follow getting started guide
  2. Run yarn circom:dev --show-stack-traces
yarn run v1.22.19
$ hardhat circom --deterministic --debug --verbose --show-stack-traces
  hardhat:core:config Loading Hardhat config from C:\dev\circom-starter\hardhat.config.js +0ms
  hardhat:core:hre Creating HardhatRuntimeEnvironment +0ms
  hardhat:core:hre Running task circom +1ms
  hardhat-circom:info Using cached Powers of Tau file at C:\dev\circom-starter\artifacts\circom\hermezptau.blob.core.windows.net_ptau_powersOfTau28_hez_final_15.ptau +0ms
  hardhat-circom:error invalid input file
  hardhat-circom:error previous errors were found +0ms
Error in plugin hardhat-circom: Unable to compile circuit named: division

HardhatPluginError: Unable to compile circuit named: division
    at SimpleTaskDefinition.circomCompile [as action] (C:\dev\circom-starter\node_modules\hardhat-circom\dist\index.js:478:19)
    at Environment._runTaskDefinition (C:\dev\circom-starter\node_modules\hardhat\src\internal\core\runtime-environment.ts:308:14)
    at Environment.run (C:\dev\circom-starter\node_modules\hardhat\src\internal\core\runtime-environment.ts:156:14)
    at main (C:\dev\circom-starter\node_modules\hardhat\src\internal\cli\cli.ts:272:7)

    Caused by: Error: invalid input file
    previous errors were found
        at Union.writeSync (C:\dev\circom-starter\node_modules\hardhat-circom\dist\index.js:276:31)
        at C:\dev\circom-starter\node_modules\circom2\vendor\wasi.js:561:38
        at Array.forEach (<anonymous>)
        at C:\dev\circom-starter\node_modules\circom2\vendor\wasi.js:558:40
        at C:\dev\circom-starter\node_modules\circom2\vendor\wasi.js:82:20
        at null.<anonymous> (wasm://wasm/01a7a0d2:1:3696999)
        at null.<anonymous> (wasm://wasm/01a7a0d2:1:3678595)
        at null.<anonymous> (wasm://wasm/01a7a0d2:1:3655123)
        at null.<anonymous> (wasm://wasm/01a7a0d2:1:3766550)
        at null.<anonymous> (wasm://wasm/01a7a0d2:1:3652391)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@nth-commit
Copy link
Author

Note: using the exact same setup, I can confirm it works using WSL.

@phated
Copy link
Contributor

phated commented Jan 21, 2023

Does the rust circom work on Windows? I could see them failing on CRLF line endings or something.

@nth-commit
Copy link
Author

nth-commit commented Jan 21, 2023

I can try and look into that.

I can confirm it's not a line endings thing though, as I use LF line endings. And also, I tested using WSL in the same local repo. and WSL uses the exact same filesystem.

Might be a windows path thing? Either in Node or in circom?

@nth-commit
Copy link
Author

I copied the circom args passed through WASI verbatim;

circom C:\\dev\\circom-starter\\circuits\\division.circom --r1cs --wat --wasm --sym -o
 C:\\dev\\circom-starter\\circuits
template instances: 1
non-linear constraints: 1
linear constraints: 0
public inputs: 1
public outputs: 1
private inputs: 3
private outputs: 0
wires: 6
labels: 8
Written successfully: C:\\dev\\circom-starter\\circuits\division.r1cs
Written successfully: C:\\dev\\circom-starter\\circuits\division.sym
Written successfully: C:\\dev\\circom-starter\\circuits\division_js\division.wat
Written successfully: C:\\dev\\circom-starter\\circuits\division_js\division.wasm
Everything went okay, circom safe

@phated
Copy link
Contributor

phated commented Jan 21, 2023

Thanks for testing! The wasm build uses a custom patch that hasn't been thoroughly tested, available at https://github.com/iden3/circom/pull/46/files

I wonder if there's a bug in that.

@nth-commit
Copy link
Author

Just tested - that branch of circom works too.

@phated
Copy link
Contributor

phated commented Jan 24, 2023

Appreciate you checking. I don't have Windows to debug this further. Maybe someone else can dig in 🤔

@nth-commit
Copy link
Author

I would have a go myself but my knowledge of the area is so limited, it would most likely take me a long time.

If you have the appetite for getting this fixed, and can't find anyone else, I'm happy to jump on a screen share and pair for a little bit.

@tmonty12
Copy link

Hey @nth-commit, I ran into the same exact issue. Is there any other solution that you have found than using WSL?

@nth-commit
Copy link
Author

Ah, sorry @tmonty12, I've been meaning to dive in again but haven't had the chance yet. Best of luck!

@benreichman
Copy link

Ran into the same exact issue. Identical setup works perfectly on a mac machine, but get the same "Invalid input file" when running on my windows machine.

@phated
Copy link
Contributor

phated commented Jun 9, 2023

Like I said, I don't have a windows machine. Additionally, people would rather airdrop farm than contribute to my gitcoin, so I have no incentive to work on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants