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

Verification does not work in case of dependency from 2 same-name files #1676

Open
vsmelov opened this issue Mar 25, 2023 · 1 comment
Open

Comments

@vsmelov
Copy link
Contributor

vsmelov commented Mar 25, 2023

Environment information

  • brownie Version: 1.19.3
  • ganache-cli Version: Ganache CLI v6.12.2 (ganache-core: 2.13.2)
  • solc Version: 0.8.6
  • Python Version: 3.9.7
  • OS: macos m1

How to reproduce

git clone [email protected]:vsmelov/brownie_fail_verification.git
cd brownie_fail_verification
virtualenv venv -p python3.9
. venv/bin/activate
pip install -r requirements.txt
brownie compile
export BRAVE_MAIN_PASS='xxx'
brownie run scripts/deploy_and_verify_ok.py --network polygon-main
brownie run scripts/deploy_and_verify_fail.py --network polygon-main

What was wrong?

Contract verification with dependency on the file that imports the file with the same name does not work.

e.g.

https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.3.3/contracts/interfaces/IERC165.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/introspection/IERC165.sol";
  • what command you ran

brownie run scripts/deploy_and_verify_fail.py --network polygon-main

  • full output of the error you received
brownie run scripts/deploy_and_verify_fail.py --network polygon-main

#Running 'scripts/deploy_and_verify_fail.py::main'...
#Transaction sent: 0xd3cbb5004acd636cb14738034f091afd98d74d1b7e4f2d8ae1e954b3d9a9beb2
#  Gas price: 114.379120423 gwei   Gas limit: 108170   Nonce: 141
#  VerificationFail.constructor confirmed   Block: 40759442   Gas used: 98337 (90.91%)
#  VerificationFail deployed at: 0x1AF0b97581d883B9260182d00f8619e5B3a4f7d4
#
#Verification submitted successfully. Waiting for result...
#Verification complete. Result: Fail - Unable to verify

How can it be fixed?

If you go into function publish_source and check what is inside

    contract_info = self.get_verification_info()

you will see IERC165 from contracts/interfaces/IERC165.sol which refers to itself from "../utils/introspection/IERC165.sol"

First, I'm sure brownie should give a warning in case if file with some filename imports the same filename from inside. I spent 2 days trying to realize what is going on!

I see a way how to fix it:

  • automatically attach uniq prefix to every same-name files like "utils_introspection_IERC165.sol" and "interfaces_IERC165.sol"
@vsmelov
Copy link
Contributor Author

vsmelov commented Mar 25, 2023

Take a look on this verified smart on etherscan - https://etherscan.io/address/0x7358182024c9f1B2e6b0153e60bf6156B7eF4906#code

it has both contracts IERC165.sol
Screenshot 2023-03-26 at 00 39 09

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

1 participant