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

Unable publish source code with solidity version >= 0.8.0 #1114

Closed
maxsiz opened this issue Jun 16, 2021 · 10 comments
Closed

Unable publish source code with solidity version >= 0.8.0 #1114

maxsiz opened this issue Jun 16, 2021 · 10 comments

Comments

@maxsiz
Copy link

maxsiz commented Jun 16, 2021

Environment information

  • brownie Version: 1.14.6
  • ganache-cli Version: 0.8.4
  • solc Version: 0.8.4
  • Python Version: 3.6.9
  • OS: linux

What was wrong?

Every time when I try publish multifile source on Etherscan with sol version more then 0.8.0 error is occur.

Verification complete. Result: Fail - Unable to verify

But when i just change solidity version in pragma - all is ok.

I have check in console
First.get_verification_info() - So in case sol >= 0.8.0 function return only
first file in sources.

At the same time, the deployment goes well in both cases.

Example sources are below.

pragma solidity ^0.7.4;

File 1 (First.sol)

// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
import "./Second.sol";
contract First is Second {
    function name() public view  returns (address) {
        return address(this);
    } 
    function symbol() public view  returns (string memory) {
        return "SYM";
    }
}

File 2 (Second.sol)

// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
contract Second {
    function totalSupply() external view returns (uint256) {
        return 7777777777;
    }
}

First.get_verification_info() output

>>> First.get_verification_info()
{
    'bytecode_len': 770,
    'compiler_version': "0.7.4+commit.3f05b770",
    'contract_name': "First",
    'flattened_source': "// SPDX-License-Identifier: MIT

pragma solidity 0.7.4;



// Part: Second

contract Second {
    function totalSupply() external view returns (uint256) {
        return 7777777777;
    }
}

// File: First.sol

contract First is Second {

    function name() public view  returns (address) {
        return address(this);
    }
    
    function symbol() public view  returns (string memory) {
        return "SYM";
    }
	
}
",
    'license_identifier': "MIT",
    'optimizer_enabled': True,
    'optimizer_runs': 200
}

pragma solidity ^0.8.4;

File 1 (First.sol)

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "./Second.sol";
contract First is Second {
    function name() public view  returns (address) {
        return address(this);
    } 
    function symbol() public view  returns (string memory) {
        return "SYM";
    }
}

File 2 (Second.sol)

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Second {
    function totalSupply() external view returns (uint256) {
        return 7777777777;
    }
}

First.get_verification_info() output

Brownie environment is ready.
>>> First.get_verification_info()
{
    'bytecode_len': 602,
    'compiler_version': "0.8.4+commit.c7e474f2",
    'contract_name': "First",
    'flattened_source': "// SPDX-License-Identifier: MIT

pragma solidity 0.8.4;



// File: First.sol

contract First is Second {

    function name() public view  returns (address) {
        return address(this);
    }

    function symbol() public view  returns (string memory) {
        return "SYM";
    }
	
}
",
    'license_identifier': "MIT",
    'optimizer_enabled': True,
    'optimizer_runs': 200
}

@iamdefinitelyahuman
Copy link
Member

I think the issue is present from 0.8.4 onward. Not sure what changed in that version, but something happened that broke everything.

@maxsiz
Copy link
Author

maxsiz commented Jun 17, 2021

There are a lot of changes but code compiling is OK. Only source collecting is broken
https://docs.soliditylang.org/en/breaking/080-breaking-changes.html

@iamdefinitelyahuman iamdefinitelyahuman added this to the Brownie 1.15.0 milestone Jun 19, 2021
@TechNickAI
Copy link

I was able to use pragma solidity 0.8.3; and get it to work - so it's something with 0.8.4+

TechNickAI added a commit to heartrithm/heart_token that referenced this issue Jun 23, 2021
@PatrickAlphaC
Copy link
Contributor

It looks like it might have to do with get_verification_info. If I run get_verification_info on any contract with imports from OZ, it bugs out. Seems like it should be pretty straightforward for one of us to fix.

@PatrickAlphaC
Copy link
Contributor

Yeah get_verification_info seems to be ignoring imports

@PatrickAlphaC
Copy link
Contributor

ethereum/solidity#11643

I think this is the problem

@maxsiz
Copy link
Author

maxsiz commented Jul 25, 2021

@iamdefinitelyahuman
I have update brownie up to 1.15.1 but still cant verify code sol version >= 0.8.0. Does work in progress? May be you need some help?

@iamdefinitelyahuman
Copy link
Member

is this fixed in v1.15.2 ?

@maxsiz
Copy link
Author

maxsiz commented Jul 27, 2021

Thank you!
After brownie compile --all seems that output LockerByBlock.get_verification_info() look well. I`ll check soon on etherscan

@PatrickAlphaC
Copy link
Contributor

ethereum/solidity#11643 (comment)

Not sure if this conversation was addressed, haven't had a chance to jump into the brownie code yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants