Correctly identify which contracts to compile #44
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixed a compilation bug where the compiler was not given all of the smart contracts required for the compilation.
Description
I recently encountered the following error:
Where it looks like the ABI for one of our contracts is not being found by our code.
Looking more into the logs, I saw the following output from the compiler when trying to perform the compilation:
Which is a pretty long log, but the most important piece of this log is the following:
Looking at the specific metadata file that we're trying to test we see the following:
{ "cases": [ { "name": "entry", "inputs": [ { "instance": "Main", "method": "main", "calldata": [] } ], "expected": [ "10" ] } ], "contracts": { "Main": "main.sol:Main" } }Where the
callable.solis indeed not one of the listed contracts. Our code relied on compiling just the contracts listed there and nothing else, which doesn't work in cases like this where the contract includes imports.I believe that the matterlabs tests are created in a way where we should compile all of the contracts for a particular metadata file. Therefore, I changed the code to compile all files in the metadata file directory with the
solextension and not just the ones listed in the metadata file.This has fixed the issue that we've been seeing.