foundry: Always fail to verify smart contract after upgrading foundry.

Component

Forge

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

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (03aa926 2023-06-05T09:38:42.448503000Z)

What command(s) is the bug in?

forge create --rpc-url “https://matic-mumbai.chainstacklabs.com” \ --constructor-args “AAAA” “AA” "https://gateway.pinata.cloud/ipfs/ … --verify \ src/AAAA.sol:AAAA

Operating System

macOS (Apple Silicon)

Describe the bug

Try to deploy my smart contract, always fail to verify the contract after running foundry up. before that everything works fine. here is the log I got:

[⠢] Compiling...
No files changed, compilation skipped
Deployer: 0x540b47fc7957bd6C16d5BDF41bed97B9f8b33C13
Deployed to: 0xa7D86a510bE9E3C4BAC144A92C83853d7146369b
Transaction hash: 0x53b8cdc00f9bee488cbf9705b655f710a8873d1e0b79c0bd8670a80f8a9f866b
Starting contract verification...
Waiting for etherscan to detect contract deployment...
Start verifying contract `0xa7d86a510be9e3c4bac144a92c83853d7146369b` deployed on mumbai

Submitting verification for [src/AxeLandNFTToken1.sol:AxeLandNFTToken1] "0xa7D86a510bE9E3C4BAC144A92C83853d7146369b".

Submitting verification for [src/AxeLandNFTToken1.sol:AxeLandNFTToken1] "0xa7D86a510bE9E3C4BAC144A92C83853d7146369b".

Submitting verification for [src/AxeLandNFTToken1.sol:AxeLandNFTToken1] "0xa7D86a510bE9E3C4BAC144A92C83853d7146369b".
Submitted contract for verification:
	Response: `OK`
	GUID: `q3gtjhgqaqkyrvxmrrz1sq9bvqcpemyxa23cvcfevmvmgy9xug`
	URL:
        https://mumbai.polygonscan.com/address/0xa7d86a510be9e3c4bac144a92c83853d7146369b
Contract verification status:
Response: `NOTOK`
Details: `Pending in queue`
Contract verification status:
Response: `NOTOK`
Details: `Fail - Unable to verify`
Contract failed to verify.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 6
  • Comments: 23 (7 by maintainers)

Most upvoted comments

Hey all, a fix is on the way with https://github.com/gakonst/ethers-rs/pull/2468 — we’ll let you know when this is upstreamed to foundry!

foundryup resolved my issue.

@Evalir Can confirm latest foundryup: installed - forge 0.2.0 (1a1d653 2023-06-14T00:06:18.409597000Z) worked for me, thanks!

I was able to resolve this by using foundryup --commit 577e8b8d. From my testing it seems that any contract that uses constructor arguments can no longer be verified. I believe this is a regression. To reproduce the issue, attempt to deploy and verify any contract with constructor args.

Hello everyone, yesterday I ran into the same problem with the deployment on sepolia and binance testnet

I went through the broadcast reports and found one embarrassing moment Here is a list of arguments for the deployment from my last attempt (unable to verify), after large values in uint256 for some reason there is an abbreviated spelling (we can see it in the console logs from verbosity).

"arguments": [
        "1686830400 \u001b[2;49;39m[1.686e9]\u001b[0m",
        "1697407200 \u001b[2;49;39m[1.697e9]\u001b[0m",
        "1697507200 \u001b[2;49;39m[1.697e9]\u001b[0m",
        "10000 \u001b[2;49;39m[1e4]\u001b[0m",
        "225"
      ]

Could it be that the same values (with an appendage on the right) are passed as arguments for verification?

Here are the same arguments, but from the previous version of the contract, which I deployed with successful verification a few weeks ago

"arguments": [
        "1686830400",
        "1697407200",
        "1697507200",
        "10000",
        "225"
      ]

I experienced the same verification issue on forge 0.2.0 (08a629a 2023-06-03T00:04:22.625130135Z), but was not able to validate the workaround from @jonathanpwang due to running into the foundry config error: Unknown evm version: paris for setting evm_version`` when trying to run at the foundry version specified above.

Response I got on the nightly commit was this:

Start verification for (1) contracts
Start verifying contract `0xa519457b3d3734a6ca54e3b8be7f408ac87feb0b` deployed on goerli

Submitting verification for [src/Preseller.sol:Preseller] "0xa519457b3d3734a6CA54e3B8be7f408ac87feB0B".
Submitted contract for verification:
        Response: `OK`
        GUID: `kmewdcmqcmrduuqhcfipyffqrspxhkh19vrzxfdpqza8tpznc1`
        URL:
        https://goerli.etherscan.io/address/0xa519457b3d3734a6ca54e3b8be7f408ac87feb0b
Contract verification status:
Response: `NOTOK`
Details: `Pending in queue`
Contract verification status:
Response: `NOTOK`
Details: `Fail - Unable to verify. Please check if the correct constructor argument was entered.`
Contract failed to verify.