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

Key error when compiling with ABIEncoderV2 on solidity >= 0.7.2 #890

Closed
jeffywu opened this issue Dec 15, 2020 · 1 comment · Fixed by #895
Closed

Key error when compiling with ABIEncoderV2 on solidity >= 0.7.2 #890

jeffywu opened this issue Dec 15, 2020 · 1 comment · Fixed by #895
Labels
bug Something isn't working

Comments

@jeffywu
Copy link
Contributor

jeffywu commented Dec 15, 2020

Environment information

Brownie v1.12.2 - Python development framework for Ethereum
Compiling contracts...
  Solc version: 0.7.2
  Optimizer: Enabled  Runs: 200
  EVM Version: Istanbul
Generating build data...
 - Test
  File "brownie/_cli/__main__.py", line 64, in main
    importlib.import_module(f"brownie._cli.{cmd}").main()
  File "brownie/_cli/compile.py", line 50, in main
    proj = project.load()
  File "brownie/project/main.py", line 725, in load
    return Project(name, project_path)
  File "brownie/project/main.py", line 174, in __init__
    self.load()
  File "brownie/project/main.py", line 227, in load
    self._compile(changed, self._compiler_config, False)
  File "brownie/project/main.py", line 90, in _compile
    build_json = compiler.compile_and_format(
  File "brownie/project/compiler/__init__.py", line 142, in compile_and_format
    build_json.update(generate_build_json(input_json, output_json, compiler_data, silent))
  File "brownie/project/compiler/__init__.py", line 313, in generate_build_json
    build_json[contract_alias] = solidity._get_unique_build_json(
  File "brownie/project/compiler/solidity.py", line 246, in _get_unique_build_json
    pc_map, statement_map, branch_map = _generate_coverage_data(
  File "brownie/project/compiler/solidity.py", line 369, in _generate_coverage_data
    active_source_node = source_nodes[contract_id]
KeyError: '1'
  • brownie Version: 1.12.2
  • solc Version: 0.7.2 to 0.7.5
  • Python Version: 3.8
  • OS: linux

What was wrong?

Compiling this contract results in the error above:

pragma solidity >0.7.0;
pragma experimental ABIEncoderV2;

contract Test {
    function test() external view returns (uint256) {
        return 1;
    }
}

Removing the pragma experimental ABIEncoderV2; succeeds.
Changing the function to internal succeeds.
Changing the solc compiler to 0.7.1 succeeds (issue seems to appear on 0.7.2 and above)

@iamdefinitelyahuman
Copy link
Member

This is likely related to #828 - changes were made to the ABI in v0.7.2 that broke Brownie in a few places.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants