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

[builder-etherscan]: compiled contracts included in verification #804

Closed
abcoathup opened this issue Sep 23, 2020 · 18 comments · Fixed by #1033
Closed

[builder-etherscan]: compiled contracts included in verification #804

abcoathup opened this issue Sep 23, 2020 · 18 comments · Fixed by #1033

Comments

@abcoathup
Copy link

When verifying with buidler-etherscan plugin, other compiled (unrelated) contracts are also included in the verification.

The following simple example is a project with two contracts, where A is deployed to a public testnet and then verified.

$ npx buidler verify --network kovan 0xBc2bfE23f7Cd054283A51Fe64f5b3D69d2CBeCa9
Compiling...
Successfully submitted source code for contract
contracts/A.sol:A at 0xBc2bfE23f7Cd054283A51Fe64f5b3D69d2CBeCa9
for verification on etherscan. Waiting for verification result...
Successfully verified contract on etherscan

The verified contract on Etherscan shows both A and B files.

https://kovan.etherscan.io/address/0xBc2bfE23f7Cd054283A51Fe64f5b3D69d2CBeCa9#code

A.sol

// contracts/A.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

contract A {
    uint256 private _value;

    function doStuff(uint256 value) public {
        _value = value;
    }
}

B.sol

// contracts/B.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

contract B {
    bool private _value;

    function doStuff(bool value) public {
        _value = value;
    }
}
@alcuadrado
Copy link
Member

Thanks for reporting this, @abcoathup!

Unfortunately, we have to upload all of the contracts atm, as there's a bug in solc that can prevent the contracts from verifying otherwise.

The good news is that we are about to ship a new compilation pipeline, that is aware of this bug, and will let us prune the unrelated contracts when we are sure that it won't cause any problems.

@mudgen
Copy link

mudgen commented Oct 19, 2020

I have the same problem. @alcuadrado Any news about this?

@mudgen
Copy link

mudgen commented Oct 19, 2020

@alcuadrado According to the solc issue about this, this problem exists for solc before 0.7.0. I am using solc 0.7.3 so I shouldn't have this problem.

So can builder-etherscan be updated to allow my 0.7.3 contracts to be verified without including disrelated contracts?

@dexcell
Copy link

dexcell commented Oct 20, 2020

@alcuadrado
Any update on this? Hope this will be fixed soon. since mock doesn't need to be uploaded and verified.

@mudgen
i tried it with 0.7.3 solc, not working, still all contracts uploaded and verified.

@alcuadrado
Copy link
Member

We are about to publish the biggest release of Buidler so far. We'll get back to this once that's done.

@mudgen
Copy link

mudgen commented Oct 20, 2020

@alcuadrado That seems exciting. I look forward to reading and using the big release coming out soon. Is it getting published this week?

@alcuadrado
Copy link
Member

Yep. This week 🚀

@dexcell
Copy link

dexcell commented Oct 21, 2020

Wow thank you

@PaulRBerg
Copy link
Contributor

Hey @alcuadrado, it looks like the repo has just been renamed to hardhat. First off, congrats! This seems to be a big milestone.

Has this bug been addresses in the latest version? Or is it still pending?

@fvictorio
Copy link
Member

Not yet! But with the changes in this release, tackling this issue should be possible 😄

@dexcell
Copy link

dexcell commented Oct 23, 2020

Thank God it was renamed to hardhat, would be more easier to type on command line and more easier google search for issues.

@mudgen
Copy link

mudgen commented Nov 10, 2020

Not yet! But with the changes in this release, tackling this issue should be possible 😄

Great. Is it going to be tackled soon?

@PaulRBerg
Copy link
Contributor

As an interim solution, it looks like we could use solt. It's compatible with any development framework and it's using the same trick as hardhat-etherscan, that is, Solidity's standard json format.

@alcuadrado
Copy link
Member

FYI: We are already working on this, and a fix should be available in a couple of days.

@alcuadrado
Copy link
Member

We just released a new version of the plugin which improves on this as far as it can be done. Take a look at this comment for more info: #670 (comment)

@Skyge
Copy link

Skyge commented Dec 4, 2020

@abcoathup Hi, have you tried to verify again with the new release, I meet another problem and now can not verify contract, error message:

TypeError: Cannot read property 'contracts' of undefined
    at SimpleTaskDefinition.verify (/Users/ERC20-Token/node_modules/@nomiclabs/hardhat-etherscan/src/index.ts:281:25)

My package version is "@nomiclabs/hardhat-etherscan": "^2.1.0",

@alcuadrado
Copy link
Member

Try upgrading hardhat.

@Skyge
Copy link

Skyge commented Dec 5, 2020

Yeah, you are right, all is fine now, thanks a lot!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
7 participants