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

[contract-deploy] Store bytecode hash for a contract in addition to verification key hashes #3395

Closed
Tracked by #4052
spalladino opened this issue Nov 22, 2023 · 3 comments
Labels
A-protocol Area: relates to designing / explaining the protocol

Comments

@spalladino
Copy link
Collaborator

Today we use the verification key hash to identify each function in a contract. However, this means that unconstrained code isn't committed to, so an app could provide the bytecode for a contract with altered unconstrained code (eg the code that interacts with the oracle) and the user would have no way to know. Same applies to unconstrained functions in a contract, a dapp could inject whatever code they want in those, and potentially use it to exfiltrate private information. We should commit to the bytecode hash of a contract somewhere, in addition to the verification key.

@spalladino
Copy link
Collaborator Author

Comment from @zac-williamson:

I think we would need both
In the Kernel circuit, the user provides the Verification Key of the function circuit as a private input. We validate that the key is correct by checking its hash against the vk hash in the contracts tree.
We still need to be able to do this check - a bytecode hash or a hash of vk + bytecode won’t cut it here

@spalladino spalladino added the A-protocol Area: relates to designing / explaining the protocol label Jan 8, 2024
@spalladino spalladino changed the title Store bytecode hash for a contract in addition to verification key hashes [contract-deploy] Store bytecode hash for a contract in addition to verification key hashes Aug 26, 2024
@spalladino
Copy link
Collaborator Author

This issue may already be implemented but currently disabled. See also #5860.

@sklppy88
Copy link
Contributor

Closed as the bytecode hash is already included in the function artifact hash (computeFunctionArtifactHash), which is eventually used in the artifact function tree, (computeArtifactFunctionTree), artifact function tree root (computeArtifactFunctionTreeRoot), and artifact hash preimage (computeArtifactHashPreimage). All we need to do is re-enable this check as described by #5860.

@github-project-automation github-project-automation bot moved this from Todo to Done in A3 Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-protocol Area: relates to designing / explaining the protocol
Projects
Archived in project
Development

No branches or pull requests

2 participants