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

Forge script -- verify failing on polygon #5379

Closed
2 tasks done
FabienCoutant opened this issue Jul 13, 2023 · 2 comments
Closed
2 tasks done

Forge script -- verify failing on polygon #5379

FabienCoutant opened this issue Jul 13, 2023 · 2 comments
Labels
T-bug Type: bug
Milestone

Comments

@FabienCoutant
Copy link

FabienCoutant commented Jul 13, 2023

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 (e488e2b 2023-07-10T15:17:42.605282000Z)

What command(s) is the bug in?

forge script script/01_ImplementationManager.s.sol --rpc-url ${NETWORK} --broadcast --verify --optimize

Operating System

macOS (Apple Silicon)

Describe the bug

Trying to deploy my contract and verify it using forge script on polygon but the verification failing every times (I had deployed on sepolia without any issue)

Here my foundry.toml setup :

[rpc_endpoints]
mainnet = "https://mainnet.infura.io/v3/${INFURA_KEY}"
sepolia = "https://sepolia.infura.io/v3/${INFURA_KEY}"
polygon = "https://polygon-mainnet.infura.io/v3/${INFURA_KEY}"

[etherscan]
mainnet = {key = "${ETHERSCAN_API_KEY}" }
sepolia = {key = "${ETHERSCAN_API_KEY}" }
polygon = {key = "${POLYGONSCAN_API_KEY}", chain = 137, url = "https://api.polygonscan.com/api/" }

# See more config options https://github.com/foundry-rs/foundry/tree/master/config

and here the cmd run and the result:

> cross-env && forge script script/01_ImplementationManager.s.sol --rpc-url ${NETWORK} --broadcast --verify --optimize

[⠰] Compiling...
No files changed, compilation skipped
Script ran successfully.

EIP-3855 is not supported in one or more of the RPCs used.
Unsupported Chain IDs: 137.
Contracts deployed with a Solidity version equal or higher than 0.8.20 might not work properly.
For more information, please see https://eips.ethereum.org/EIPS/eip-3855

## Setting up (1) EVMs.

==========================

Chain 137

Estimated gas price: 164.981681361 gwei

Estimated total gas used for script: 323286

Estimated amount required: 0.053336267840472246 ETH

==========================

###
Finding wallets for all the necessary addresses...
##
Sending transactions [0 - 0].
⠁ [00:00:00] [##########################################################################################################################################################################################] 1/1 txes (0.0s)
Transactions saved to: /Users/xutyr/Dev/Cloover/Contracts/broadcast/01_ImplementationManager.s.sol/137/run-latest.json

Sensitive values saved to: /Users/xutyr/Dev/Cloover/Contracts/cache/01_ImplementationManager.s.sol/137/run-latest.json

##
Waiting for receipts.
⠉ [00:00:06] [######################################################################################################################################################################################] 1/1 receipts (0.0s)
##### polygon
✅ Hash: 0x06897546e6d8cbd24d50924bfdde831ac633a30909f25a27a4db84337f5fc26a
Contract Address: 0x4840f5a6d73E5841ec99Db9a221B447cF0375407
Block: 45030705
Paid: 0.037706475225533604 ETH (248682 gas * 151.625269322 gwei)


Transactions saved to: /Users/xutyr/Dev/Cloover/Contracts/broadcast/01_ImplementationManager.s.sol/137/run-latest.json

Sensitive values saved to: /Users/xutyr/Dev/Cloover/Contracts/cache/01_ImplementationManager.s.sol/137/run-latest.json



==========================

ONCHAIN EXECUTION COMPLETE & SUCCESSFUL.
Total Paid: 0.037706475225533604 ETH (248682 gas * avg 151.625269322 gwei)
##
Start verification for (1) contracts
Start verifying contract `0x4840f5a6d73e5841ec99db9a221b447cf0375407` deployed on polygon

Transactions saved to: /Users/xutyr/Dev/Cloover/Contracts/broadcast/01_ImplementationManager.s.sol/137/run-latest.json

Sensitive values saved to: /Users/xutyr/Dev/Cloover/Contracts/cache/01_ImplementationManager.s.sol/137/run-latest.json

Error: 
expected value at line 1 column 1
 ELIFECYCLE  Command failed with exit code 1.

But it's working using verify-contract

╰─ forge verify-contract \                        
    --chain-id 137 \
    --num-of-optimizations 200 \
    --watch \
    --constructor-args $(cast abi-encode "constructor(address)" "0x6273393d54d7133b5b24500f7bd85152b3bd5d71") \
    --etherscan-api-key "MyKey" \
    --compiler-version v0.8.19+commit.7dd6d404 \
    0x4840f5a6d73E5841ec99Db9a221B447cF0375407 \
    src/core/ImplementationManager.sol:ImplementationManager
Start verifying contract `0x4840f5a6d73E5841ec99Db9a221B447cF0375407` deployed on polygon

Submitting verification for [src/core/ImplementationManager.sol:ImplementationManager] "0x4840f5a6d73E5841ec99Db9a221B447cF0375407".

Submitted contract for verification:
        Response: `OK`
        GUID: `1icrqdpjdzvwh4mgzbfejwcwqnpfjcxi8mrmw2nxhmykrejppv`
        URL:
        https://polygonscan.com/address/0x4840f5a6d73E5841ec99Db9a221B447cF0375407
Contract verification status:
Response: `NOTOK`
Details: `Pending in queue`
Contract verification status:
Response: `OK`
Details: `Pass - Verified`
Contract successfully verified
@FabienCoutant FabienCoutant added the T-bug Type: bug label Jul 13, 2023
@gakonst gakonst added this to Foundry Jul 13, 2023
@github-project-automation github-project-automation bot moved this to Todo in Foundry Jul 13, 2023
@Evalir Evalir added this to the v1.0.0 milestone Jul 13, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in Foundry Jul 13, 2023
@FabienCoutant FabienCoutant reopened this Jul 13, 2023
@kevinstubbs
Copy link

Just had this happen to me, however it was because I was using an etherscan API key rather than polygonscan API key. I see it might not be the case for you (having a separate env variable for that), but I would double-check that you really have the correct key from polygonscan in there.

@Evalir
Copy link
Member

Evalir commented Aug 18, 2023

Closing as duplicate of #5251

@Evalir Evalir closed this as completed Aug 18, 2023
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

3 participants