question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Brownie does not generate proper compilation artifacts for interfaces

See original GitHub issue

Hi,

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 for contracts/implementation.sol elements and
  • x:y:1 for interfaces/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 in build/contracts for consistency and in build/interfaces for other usages)
  • Or have an option to force build/interfaces to be generated with the same call to solc that for build/contracts

This issue is similar to https://github.com/eth-brownie/brownie/issues/772.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:5
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
PatrickAlphaCcommented, Sep 16, 2021

@iamdefinitelyahuman can we put out a gitcoin grant perhaps?

1reaction
iamdefinitelyahumancommented, Apr 28, 2021

Sorry just haven’t found the bandwidth to address yet 😬

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bountysource
Brownie does not generate proper compilation artifacts for interfaces.
Read more >
Brownie Documentation
This page provides a quick overview of how to use Brownie. It relies mostly on examples and assumes a level of fa-.
Read more >
eth-brownie/community - Gitter
If this issue persists, generate a Github API token and store it as the environment ... I know I have to specify API,...
Read more >
smart-contracts-for-testing - PyPI
The package depends only on web3.py and not others, like Brownie. It grabs popular ABI files with their bytecode and compilation artifacts ......
Read more >
Brownie - Moonbeam Docs
Your Brownie project should contain the following empty directories: build - for project data such as contract artifacts from compilation; contracts - to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found