-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat: forge verify-bytecode <address>
to verify that code at a commit hash matches on-chain code
#6893
Comments
I believe that this will also need to take into account whether the metadata hash is included. If the hash is included, then either full or partial verification can be performed. This could be an additional flag |
Good point. My understanding is the metadata hash will likely differ since the command will usually be run on a different machine than the one that originally compiled the code, and the hash can sometimes be machine-dependent in my experience. I’d suggest the command defaults to the metadata hash setting specified in the build profile, but allow overriding it with a flag like you suggested. I’ll update the spec above accordingly |
I could also imagine adding a |
I can take a stab at this! |
can this be closed? @yash-atreya |
Yep this was closed by #7319 |
Component
Forge
Describe the feature you would like
Motivation
Users often want to make sure that bytecode at an address can be tied to a certain git commit. Common use cases of this are:
It's a lot of work for a contract verification service to also validate that the code being verified exists at a given commit, for all frameworks and languages. But it is easy for frameworks themselves to implement this feature on a case by case basis.
Solution
A new feature named
forge verify-bytecode <address>
(open to other names) to execute this check. It has the following syntax:And it behaves as follows:
forge verify-bytecode <address>
.ETH_RPC_URL
is used as the default RPC, but an alternative can be provided using the--rpc-url
flag.forge build
.--constructor-args
or--constructor-args-path
, or uses--guess-constructor-args
(from feat(forge verify-contract):--guess-constructor-args
#6724)--verification-type
flag--block <blockTag>
arg, fork from the RPC at that block and simulate to get the runtime code.Additional context
No response
The text was updated successfully, but these errors were encountered: