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 verify-contract is no longer working due too metadata bytecodeHash is not set to none #1236

Closed
2 tasks done
pyk opened this issue Apr 8, 2022 · 6 comments
Closed
2 tasks done
Labels
C-forge Command: forge Cmd-forge-verify Command: forge verify-contract/check D-easy Difficulty: easy P-high Priority: high T-bug Type: bug

Comments

@pyk
Copy link
Contributor

pyk commented Apr 8, 2022

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 (d513291 2022-04-07T18:27:22.910788+00:00)

What command(s) is the bug in?

forge verify-contract

Operating System

macOS (M1)

Describe the bug

With recent introduction to use bytcodeHash as None by default #1180, it breaks the forge verify-contract.

Etherscan uses "bytecodeHash": "ipfs" by default to verify the smart contract but foundry doesn't set the metadata bytecode hash to none when submitting contract verification

@pyk pyk added the T-bug Type: bug label Apr 8, 2022
@onbjerg
Copy link
Collaborator

onbjerg commented Apr 8, 2022

cc @mattsse why did we disable it in the first place? I forgot

@onbjerg onbjerg added C-forge Command: forge P-high Priority: high D-easy Difficulty: easy Cmd-forge-verify Command: forge verify-contract/check labels Apr 8, 2022
@mattsse
Copy link
Member

mattsse commented Apr 8, 2022

because that causes non deterministic code, see also https://github.com/Uniswap/v3-core/blob/ed88be38ab2032d82bf10ac6f8d03aa631889d48/hardhat.config.ts#L57-L62

but this is not really a verify issue since that's not included in the verify request we're sending to etherscan, right?

sounds more like we should consider making ipfs the default?

and you can adjust this in the foundry.toml

@onbjerg
Copy link
Collaborator

onbjerg commented Apr 8, 2022

I think it is a verify issue because the metadata hash is added to the end of the bytecode, unsure though

@mattsse
Copy link
Member

mattsse commented Apr 8, 2022

but the bytecode is not part of the verify payload

https://docs.etherscan.io/api-endpoints/contracts#source-code-submission-gist

@pyk
Copy link
Contributor Author

pyk commented Apr 8, 2022

I think it is a verify issue because the metadata hash is added to the end of the bytecode, unsure though

@onbjerg @mattsse Yes the metadata hash is appended to the bytecode, hence the contract verification is failed when forge submit the verification using flattened file format instead of standard-input-json.

We can only override the metadata setting when using the standard-input-json format.

I have submitted PR on ethers and foundry to solve this problem gakonst/ethers-rs#1126 #1242

@mattsse
Copy link
Member

mattsse commented Apr 12, 2022

closing as this in no longer the default and we have json verify

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-forge Command: forge Cmd-forge-verify Command: forge verify-contract/check D-easy Difficulty: easy P-high Priority: high T-bug Type: bug
Projects
None yet
Development

No branches or pull requests

3 participants