Brownie does not generate proper compilation artifacts for interfaces
See original GitHub issueHi,
It looks like the interfaces compilation artifacts generated in build/interfaces
are not generated with the same compiler call that build/contracts.
So some references ID in the interfaces AST do not match the references from build/contracts.
For example, in the AST generated, the src
field is composed of three elements start:length:fileID
. When solc generates the compilation artifact fileID
will be unique per filename. Because build/interfaces
is not generated at the same time that build/contracts
, the fileID
can collide, breaking integration with third-party tools (such as slither)
For example, if the codebase has two files:
$ cat interfaces/interface.sol
pragma solidity 0.7.2;
interface I{
}
$ cat contracts/implementation.sol
pragma solidity 0.7.2;
import "../../interfaces/interface.sol";
contract Imp is I{
}
Running $ solc contracts/implementation.sol --ast-compact-json --allow-paths .
will lead the src
fields in the AST to be
x:y:0
forcontracts/implementation.sol
elements andx:y:1
forinterfaces/interface.sol
elements.
However, running brownie compile
will lead all the src
to be in the form x:y:0
, making it difficult to distinguish if the source maps contracts/implementation.sol
or interfaces/interface.sol
.
I am not too familiar with how brownie generates build/interfaces
, but would it be possible to either:
- Add the compilation artifacts for the interfaces directly into
build/contracts
(so both inbuild/contracts
for consistency and inbuild/interfaces
for other usages) - Or have an option to force
build/interfaces
to be generated with the same call to solc that forbuild/contracts
This issue is similar to https://github.com/eth-brownie/brownie/issues/772.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:9 (3 by maintainers)
@iamdefinitelyahuman can we put out a gitcoin grant perhaps?
Sorry just haven’t found the bandwidth to address yet 😬