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

Error verifying contract on arb sepolia #6185

Closed
2 tasks done
0xfourzerofour opened this issue Nov 1, 2023 · 14 comments
Closed
2 tasks done

Error verifying contract on arb sepolia #6185

0xfourzerofour opened this issue Nov 1, 2023 · 14 comments
Labels
T-bug Type: bug

Comments

@0xfourzerofour
Copy link

0xfourzerofour commented Nov 1, 2023

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

0.2.0

What command(s) is the bug in?

forge verify-contract

Operating System

macOS (Apple Silicon)

Describe the bug

I cannot verify contract that has been deployed on arbitrum sepolia. I have tried using the cli arg and the environment variable for the etherscan api key.

I think it may have something to do with foundry not having the chain config for arbitrum sepolia yet which is now on the master branch of ethers-rs after my PR was merged yesterday


forge verify-contract --etherscan-api-key xxx --chain-id 421614 0x8d4CCBaa194ED721AC3e231a1A3863966c2D7921 Simple1271AccountFactory
Start verifying contract `0x8d4CCBaa194ED721AC3e231a1A3863966c2D7921` deployed on 421614
Error:
ETHERSCAN_API_KEY must be set. 

@0xfourzerofour 0xfourzerofour added the T-bug Type: bug label Nov 1, 2023
@gakonst gakonst added this to Foundry Nov 1, 2023
@github-project-automation github-project-automation bot moved this to Todo in Foundry Nov 1, 2023
@0xfourzerofour 0xfourzerofour changed the title Error verifying contract Error verifying contract on arb sepolia Nov 1, 2023
@DaniPopes
Copy link
Member

DaniPopes commented Nov 1, 2023

Ethers updated in #6191
Can you verify this works?

@pi0neerpat
Copy link

pi0neerpat commented Nov 1, 2023

Also cannot verify. We found that passing the --chain-id 421614 is required, but this throws the error ETHERSCAN_API_KEY must be set

Here is showing the error

hunterking@hAL0x2328 od-contracts % forge verify-contract 0xDb21D9e5616AEc3fA365879eCf3A5765C96bb62b ODGovernor  --etherscan-api-key XXX --chain-id 421614 
Start verifying contract `0xdb21d9e5616aec3fa365879ecf3a5765c96bb62b` deployed on 421614
Error: 
ETHERSCAN_API_KEY must be set

And here is an example of the same script without the error when using --chain-id 421613

hunterking@hAL0x2328 od-contracts % forge verify-contract 0xDb21D9e5616AEc3fA365879eCf3A5765C96bb62b ODGovernor  --etherscan-api-key XXX --chain-id 421613
Start verifying contract `0xdb21d9e5616aec3fa365879ecf3a5765c96bb62b` deployed on arbitrum-goerli

Submitting verification for [src/contracts/gov/ODGovernor.sol:ODGovernor] "0xDb21D9e5616AEc3fA365879eCf3A5765C96bb62b".

Submitting verification for [src/contracts/gov/ODGovernor.sol:ODGovernor] "0xDb21D9e5616AEc3fA365879eCf3A5765C96bb62b".

Submitting verification for [src/contracts/gov/ODGovernor.sol:ODGovernor] "0xDb21D9e5616AEc3fA365879eCf3A5765C96bb62b".

Submitting verification for [src/contracts/gov/ODGovernor.sol:ODGovernor] "0xDb21D9e5616AEc3fA365879eCf3A5765C96bb62b".

// ....

@DaniPopes
Copy link
Member

Can you retry after foundryup? The change was just released

@0xfourzerofour
Copy link
Author

still seems to be the same error

@0xfourzerofour
Copy link
Author

actually it just updated but gives a new error saying my api key is incorrect

bmitting verification for [src/simple-account/Simple1271AccountFactory.sol:Simple1271AccountFactory] "0x8d4CCBaa194ED721AC3e231a1A3863966c2D7921".
Encountered an error verifying this contract:
Response: `NOTOK`
Details: `Invalid API Key`

@0xfourzerofour
Copy link
Author

Although I have just generated a new one to double check

@pi0neerpat
Copy link

pi0neerpat commented Nov 1, 2023

Can confirm error persists on latest nightly build

dev:od-contracts$ forge --version                                                     
forge 0.2.0 (60ec002 2023-11-01T23:09:05.667622000Z)
dev:od-contracts$ forge verify-contract 0xDb21D9e5616AEc3fA365879eCf3A5765C96bb62b ODGovernor --chain-id 421614 --verifier etherscan --verifier-url https://api-sepolia.arbiscan.io/api  --etherscan-api-key XXX
Start verifying contract `0xDb21D9e5616AEc3fA365879eCf3A5765C96bb62b` deployed on 421614
Error: 
ETHERSCAN_API_KEY must be set

@pi0neerpat
Copy link

pi0neerpat commented Nov 1, 2023

Actually I installed the wrong one. The error is gone now in nightly-34f684ddfacc5b2ed371353ba6f730c485616ffe (1 hour ago)
https://github.com/foundry-rs/foundry/releases/tag/nightly-34f684ddfacc5b2ed371353ba6f730c485616ffe

Still some more testing to do but this is good progress. Thanks!

@github-project-automation github-project-automation bot moved this from Todo to Done in Foundry Nov 2, 2023
@NanoDev1999
Copy link

I'm having this same issue, but I believe I am on the most up to date Foundry version. When doing Foundry Up my output is

foundryup: installed - forge 0.2.0 (529559c 2023-11-13T00:26:09.475684800Z)
foundryup: installed - cast 0.2.0 (529559c 2023-11-13T00:26:09.459627100Z)
foundryup: installed - anvil 0.2.0 (529559c 2023-11-13T00:26:09.427880100Z)
foundryup: installed - chisel 0.2.0 (529559c 2023-11-13T00:26:09.443881100Z)
foundryup: done!

My contract is the example followed at https://book.getfoundry.sh/tutorials/solmate-nft
However I did try to compile then deploy the contract with solidity version 0.8.13 and then 0.8.19.
I also removed the command line arguments for ease of testing.
Contract:

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;

import "solmate/tokens/ERC721.sol";
import "openzeppelin-contracts/contracts/utils/Strings.sol";

contract NFT is ERC721 {
    uint256 public currentTokenId;

    constructor(
    ) ERC721("helloWorld", "HLW") {}

    function mintTo(address recipient) public payable returns (uint256) {
        uint256 newItemId = ++currentTokenId;
        _safeMint(recipient, newItemId);
        return newItemId;
    }

    function tokenURI(uint256 id) public view virtual override returns (string memory) {
        return Strings.toString(id);
    }
}

The command used is:

forge verify-contract \
    --chain-id 421614 \
    --num-of-optimizations 1000000 \
    --watch \
    --verifier-url https://api-sepolia.arbiscan.io/api \
    --etherscan-api-key API_Key_Generated_From_Arbiscan \
    --compiler-version v0.8.19+commit.7dd6d404 \
    0xeB06C440e2589bcE7EB5C783e77D2b4B05B57201 \
    src/Contract.sol:NFT

The output log and error given is:

Start verifying contract `0x06415f33b8F4d0Ca3C2f572B0C85E0F4106512ae` deployed on arbitrum-sepolia

Submitting verification for [src/Contract.sol:NFT] "0x06415f33b8F4d0Ca3C2f572B0C85E0F4106512ae".
Submitted contract for verification:
        Response: `OK`
        GUID: `u5fecgujsl23he6mvi1d3bf3gief1fqbcf35vmpbii8cgveewp`
        URL:
        https://sepolia.arbiscan.io/address/0x06415f33b8f4d0ca3c2f572b0c85e0f4106512ae
Contract verification status:
Response: `NOTOK`
Details: `Pending in queue`
Contract verification status:
Response: `NOTOK`
Details: `Fail - Unable to verify. Solidity Compilation Error: Source file requires different compiler version (current compiler is 0.8.19+commit.7dd6d404) - note that nightly builds are considered to be strictly less than the released version`
Contract failed to verify.

It seems that no matter what version of the compiler I use, it is impossible for me to verify it.

Thank you for any help.

@0xJamesBong
Copy link

Has this been resolved?

@sarobinson2011
Copy link

Echo all comments above, has this been resolved yet?

I'm seeing this same error (unable to verify a deployed contract) on multiple chains,

@0xfourzerofour
Copy link
Author

@sarobinson2011 yes the fix for me to make a PR to ethers-rs to add the new chain info. If the chain stuff is there, make sure you are on the nightly version and also see if nightly uses the most recent ethers version

@sarobinson2011
Copy link

I'm still seeing this same error for Arbitrum Sepolia and Aurora Testnet - I've run foundryup, am on the latest release. I can deploy and interact with contracts, but can't verify on anything but Ethereum Layer-1 testnets e.g. Sepolia.

@n00b21337
Copy link

I am having the same error. Using arbitrum, even if verify-contract says OK. Nothing happens and when I try forge verify-check I get either

Response: NOTOK
Details: `Fail - Unable to verify. Invalid or not supported solc version,

or

Response: NOTOK
Details: Invalid API Key

the first one is when I add arbiscan key to etherscan variable. the second one is when I dont do that.
Both gives errors, could be that there are 2 problems here somehow. Not sure why wouldnt arbiscan support 8.20 solc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
Archived in project
Development

No branches or pull requests

7 participants