-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Filtering logic for unsupported: ovm crashes hardhat plugin with No input sources specified #674
Copy link
Copy link
Closed
Labels
C-bugCategory: bugsCategory: bugs
Description
Describe the bug
Hardhat sometimes automatically partitions the compilation job set into several sections.
If you are:
- only whitelisting a subset of contracts for ovm
- a compilation job hardhat composed contains no whitelisted contracts
...HH will throw a No input sources... error
Compiling 148 files with 0.6.12
OVM Compiler Error (insert "// @unsupported: ovm" if you don't want this file to be compiled for the OVM):
No input sources specified.
Error HH600: Compilation failed
The problem is here, where filtering can result in an empty input passed to TASK_COMPILE_SOLIDITY_RUN_SOLCJS.
optimism/packages/hardhat-ovm/src/index.ts
Lines 153 to 168 in 4c2fbde
| // Separate the EVM and OVM inputs. | |
| for (const file of Object.keys(args.input.sources)) { | |
| // Ignore any contract that has this tag or in ignore list | |
| if ( | |
| !args.input.sources[file].content.includes('// @unsupported: ovm') && | |
| !ignore(file) | |
| ) { | |
| ovmInput.sources[file] = args.input.sources[file] | |
| } | |
| } | |
| // Build both inputs separately. | |
| const ovmOutput = await hre.run(TASK_COMPILE_SOLIDITY_RUN_SOLCJS, { | |
| input: ovmInput, | |
| solcJsPath: ovmSolcPath, | |
| }) |
Was able to patch this locally by returning an empty object if there are no sources.
- // Build both inputs separately.
+ if (Object.keys(ovmInput.sources).length === 0) return {};
+ // Build both inputs separately.To Reproduce
Apologies, I don't have simple reproduction steps. This affects larger projects which hardhat subdivides compilation into several jobs for.
Expected behavior
Compilation succeeds.
System Specs:
- OS: osx
- Package Version (or commit hash):
eth-optimism/hardhat-ovm 0.0.3
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCategory: bugsCategory: bugs