eth-brownie / brownie

A Python-based development and testing framework for smart contracts targeting the Ethereum Virtual Machine.
https://eth-brownie.readthedocs.io
MIT License
2.65k stars 553 forks source link

verfication failed #1076

Open ghost opened 3 years ago

ghost commented 3 years ago

Environment information

What was wrong?

Given a contract

// contracts/hodl.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "OpenZeppelin/openzeppelin-contracts@4.0.0/contracts/utils/Context.sol";
import "OpenZeppelin/openzeppelin-contracts@4.0.0/contracts/token/ERC777/ERC777.sol";

contract TestToken is ERC777 {
    constructor() ERC777("Test Token", "TEST", new address[](0)) {
        _mint(msg.sender, 1e25, "", "");
    }
}

brownie compile runs perfect. But in brownie console, verification always fails using either deploy() or publish_source().

How can it be fixed?

I don't know how to fix this.

evoh-nft commented 3 years ago

I have the same issue. Using solc 0.8.3 instead of 0.8.4 seems to have fixed. Guessing this is related to the issue that makes coverage reports fail on 0.8.4

jeanlucmongrain commented 3 years ago

in my case, it fail because the output of flattened_source is invalid, there is a character removed:

// Part: ReentrancyGuard

ontract ReentrancyGuard {

when I add the c and verify on the web ui it works

aturX commented 3 years ago

I have the same issue. Using solc 0.8.3 instead of 0.8.4 seems to have fixed.

I have the same issue. Using solc 0.8.3 instead of 0.8.4 seems to have fixed.

Me too

CryptoZ258 commented 3 years ago

This issue maybe cause by flatten wrong. I also got the same problem in Solc 0.6.12.

I fix by these steps:

  1. In brownie console, run MyContract.get_verification_info(), then I can get the flattened source code
  2. Paste flattened source code into etherscan, verify by hand
  3. When compile error, it will said which character failed, fix it in source code
  4. Redo verify, then it success.

This method can solve verify error temp, hope new version come up early.

SuperZooper3 commented 2 years ago

Having similar issues in mine, solc 0.8.0

thomasoss commented 2 years ago

Having similar issue (Brownie 1.16.3, solc 0.8.0) My py-solc-ast version: 1.2.9 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from eth-brownie) (1.2.9) Hence the fix described by @skellet0r does not fix the problem with the verification

skellet0r commented 2 years ago

Odd, so you're using flattened source to verify ? Does the standard json input verification fail as well ? Brownie by default uses standard json input on etherscan

rodriguesmvinicius commented 2 years ago

Odd, so you're using flattened source to verify ? Does the standard json input verification fail as well ? Brownie by default uses standard json input on etherscan

how can i choose the method of verification?

I am using ContractContainer.publish_source(ContractContainer[-1]) I have 4 contracts, only one fails verification

Jeevan-J commented 2 years ago

Possible related issue #1604