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

bug(forge script): contract created by constructor fails to be verified #6023

Closed
2 tasks done
zhangninghai opened this issue Oct 11, 2023 · 7 comments
Closed
2 tasks done
Assignees
Labels
Cmd-forge-script Command: forge script Cmd-forge-verify Command: forge verify-contract/check T-bug Type: bug
Milestone

Comments

@zhangninghai
Copy link

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 (f9ca6ec 2023-10-09T00:31:35.276575000Z)

What command(s) is the bug in?

forge script script/proxy2.s.sol:CounterScript --rpc-url $HOLESKY_RPC_URL --broadcast --verify -vvvv

Operating System

macOS (Apple Silicon)

Describe the bug

截屏2023-10-11 13 58 57 截屏2023-10-11 13 33 26

Submitted contract for verification:
Response: OK
GUID: r2guhchw9zuqmd77wngnkbdfn6719m9esaemenrzmprhetwkat
URL:
https://holesky.etherscan.io/address/0xd2cee67865574f35d794f3093c3ff0d2f16b8c1b
Contract verification status:
Response: NOTOK
Details: Pending in queue
Contract verification status:
Response: NOTOK
Details: Fail - Unable to verify. Compiled contract deployment bytecode does NOT match the transaction deployment bytecode.
Contract failed to verify.

Inherit the contract, the contract created inside the constructor failed to verify

@zhangninghai zhangninghai added the T-bug Type: bug label Oct 11, 2023
@gakonst gakonst added this to Foundry Oct 11, 2023
@github-project-automation github-project-automation bot moved this to Todo in Foundry Oct 11, 2023
@zerosnacks zerosnacks added T-to-investigate Type: to investigate Cmd-forge-verify Command: forge verify-contract/check Cmd-forge-script Command: forge script labels Jul 4, 2024
@zerosnacks zerosnacks changed the title forge script Contract verification created by constructor failed bug(forge script): contract verification created by constructor failed Jul 4, 2024
@zerosnacks zerosnacks changed the title bug(forge script): contract verification created by constructor failed bug(forge script): contract created by constructor fails to be verified Jul 4, 2024
@zerosnacks
Copy link
Member

For future reference and additional details:

OP is correct that this is an issue

    /**
     * @dev Initializes an upgradeable proxy managed by an instance of a {ProxyAdmin} with an `initialOwner`,
     * backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in
     * {ERC1967Proxy-constructor}.
     */
    constructor(address _logic, address initialOwner, bytes memory _data) payable ERC1967Proxy(_logic, _data) {
        _admin = address(new ProxyAdmin(initialOwner));
        // Set the storage value and emit an event for ERC-1967 compatibility
        ERC1967Utils.changeAdmin(_proxyAdmin());
    }

Log:

ONCHAIN EXECUTION COMPLETE & SUCCESSFUL.
##
Start verification for (3) contracts
Start verifying contract `0x59CE128F9daDD7337BFE06a779B3DD777D565b89` deployed on holesky

Submitting verification for [src/Counter.sol:Counter] 0x59CE128F9daDD7337BFE06a779B3DD777D565b89.
Submitted contract for verification:
	Response: `OK`
	GUID: `v8b6p19gcxbef9vfifyxbywcv5st9fztgj2p4jhqs6ntbe1nmn`
	URL: https://holesky.etherscan.io/address/0x59ce128f9dadd7337bfe06a779b3dd777d565b89
Contract verification status:
Response: `NOTOK`
Details: `Pending in queue`
Contract verification status:
Response: `OK`
Details: `Pass - Verified`
Contract successfully verified
Start verifying contract `0x70C6E67b14e0daA3cB2e629bB42e351d113E4799` deployed on holesky

Submitting verification for [src/Counter.sol:Proxy] 0x70C6E67b14e0daA3cB2e629bB42e351d113E4799.
Submitted contract for verification:
	Response: `OK`
	GUID: `mpxpzxcybk8g7xyhxx7gbzna5va32g457mjbwhk5d5yygkygmj`
	URL: https://holesky.etherscan.io/address/0x70c6e67b14e0daa3cb2e629bb42e351d113e4799
Contract verification status:
Response: `NOTOK`
Details: `Pending in queue`
Contract verification status:
Response: `OK`
Details: `Pass - Verified`
Contract successfully verified
Start verifying contract `0x8b6B1A8d6998d40400C982dED20CE04382c4E5F5` deployed on holesky

Submitting verification for [lib/openzeppelin-contracts/contracts/proxy/transparent/ProxyAdmin.sol:ProxyAdmin] 0x8b6B1A8d6998d40400C982dED20CE04382c4E5F5.
Submitted contract for verification:
	Response: `OK`
	GUID: `gwgglm2niwm9xvg4akdwmfl33vspjkxughqaps1xazzghw72sc`
	URL: https://holesky.etherscan.io/address/0x8b6b1a8d6998d40400c982ded20ce04382c4e5f5
Contract verification status:
Response: `NOTOK`
Details: `Pending in queue`
Contract verification status:
Response: `NOTOK`
Details: `Fail - Unable to verify. Compiled contract deployment bytecode does NOT match the transaction deployment bytecode.`
Contract failed to verify.

@zerosnacks zerosnacks added A-compatibility Area: compatibility and removed T-to-investigate Type: to investigate A-compatibility Area: compatibility labels Jul 4, 2024
@StackOverflowExcept1on
Copy link
Contributor

@zerosnacks I have the same problem, but with a slight difference: ProxyAdmin verification fails and this leads to the fact that all deployed contracts after ProxyAdmin cannot be verified.

@klkvr
Copy link
Member

klkvr commented Jul 10, 2024

Is this only happening on holesky? I was able to manually verify 0x8b6b1a8d6998d40400c982ded20ce04382c4e5f5 by submitting json input bundle to etherscan, however, the verification through forge verify-contract 0x8b6b1a8d6998d40400c982ded20ce04382c4e5f5 --constructor-args '0000000000000000000000001804c8ab1f12e6bbf3894d4083f33e07309d1f38' didn't work, though arguments are correct

I was also able to successfuly verify such deployment on sepolia

@StackOverflowExcept1on
Copy link
Contributor

@klkvr
Copy link
Member

klkvr commented Jul 10, 2024

so it seems that this is indeed an Etherscan bug. I was only able to reproduce this on Holesky. Verification is failing during both script execution and if trying to verify manually through forge verify-contract

however, if you run forge verify-contract --show-standard-json-input and submit printed input manually, verification succeeds

@homeyong
Copy link

Previously have some issue on Holesky, but now it is fixed.
Can you please try again and let us know if it's still happening?

Thanks

@zerosnacks
Copy link
Member

Confirming this is no longer an issue on Holesky, marking ticket as resolved.

@github-project-automation github-project-automation bot moved this from Todo to Done in Foundry Nov 4, 2024
@grandizzy grandizzy moved this from Done to Completed in Foundry Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cmd-forge-script Command: forge script Cmd-forge-verify Command: forge verify-contract/check T-bug Type: bug
Projects
Status: Completed
Development

No branches or pull requests

5 participants