forge verify-bytecode#7319
Conversation
|
@klkvr @mattsse need some help here. Here's the command I ran RUST_LOG=info forge vb 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 WETH9 --rpc-url https://eth.merkle.io The creation code onchain does not match the locally built one. I'm probably missing something here, would appreciate your help. |
|
#7326 created cyclical dependencies between |
|
@mattsse Facing an issue with forking and deploying the contract to verify the runtime bytecode. Error:
(code: -32603, message: method eth_sendTransaction not supported, data: None)I'm probably missing something about forking and its rpc. |
|
Facing some issues with |
Evalir
left a comment
There was a problem hiding this comment.
looking good—some comments
Evalir
left a comment
There was a problem hiding this comment.
looking good to me, pending @mds1 / @mattsse / @DaniPopes
mds1
left a comment
There was a problem hiding this comment.
This is working great, looks like all my feedback has been addressed, thank you! 🙌
Motivation
Ref #6893
Solution
Still a WIP
Implement a new command forge verify-bytecode. Placing the source code for this under https://github.com/foundry-rs/foundry/tree/master/crates/forge/bin/cmd/verify as bytecode.rs
Use ETH_RPC_URL to get runtime bytecode, etherscan api to get the constructor arguments and configs such as EVM version, compiler version, and optimizations. (https://docs.etherscan.io/api-endpoints/contracts#get-contract-source-code-for-verified-contract-source-codes) and lastly the creation code to be extracted from the creation_tx data.
Re: --verfication-type flag — Sourcify indicates whether its a partial or full match. If the user has specified a different verification type to sourcify, we can either throw an error or warn and continue with partial verification as default.
Re: verifying runtime code by running a fork at specified --block. If the block is not specified we can fetch the creationTxHash from etherscan and then use the ETH_RPC_URL to get block, run the fork and verify runtime code.