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

feat: Prove contract inclusion with constructor args #3695

Closed
LHerskind opened this issue Dec 14, 2023 · 2 comments · Fixed by #3680
Closed

feat: Prove contract inclusion with constructor args #3695

LHerskind opened this issue Dec 14, 2023 · 2 comments · Fixed by #3680
Assignees

Comments

@LHerskind
Copy link
Contributor

The leaf in the contracts tree should include the constructor vk + args hash. That way ensuring that it can easily be used in factory setups.

Currently the pre-image of the leafs are (contract_address, portal_address, function_tree_root) which makes it difficult to figure out if the constructor was also the same as desired.

Why is this important? The functions might be the same, but if either the constructor or the arguments to it differs, it might set values differently to what was expected or other shenanigans.

@LHerskind
Copy link
Contributor Author

To be done as part of larger restructure related to #3533.

@LHerskind
Copy link
Contributor Author

Actually. The address of the contract is computed based on the deployer_public_key, contract_address_salt, function_tree_root and constructor_hash, where constructor_hash includes the constructor arguments and the constructor vk hash, so you could unwind that as well, allowing you do to it without making more changes to structs, but just throwing more data at it. Look in

if is_contract_deployment {
//TODO(https://github.com/AztecProtocol/aztec-packages/issues/3062) use locally computed private_call_vk_hash here
let constructor_hash = compute_constructor_hash(function_data, private_call_public_inputs.args_hash, contract_dep_data.constructor_vk_hash);
let new_contract_address = CompleteAddress::compute(
contract_dep_data.deployer_public_key,
contract_dep_data.contract_address_salt,
contract_dep_data.function_tree_root,
constructor_hash,
).address;

@LHerskind LHerskind changed the title refactor: Extend ContractLeafPreimages feat: Prove contract inclusion with constructor args Dec 14, 2023
benesjan added a commit that referenced this issue Dec 15, 2023
1. Fixes #3465
2. Fixes #3695
3. naming consistency fix in get sibling path methods,
4. refactored the e2e test and each type of proof is now in a nested
describe statement.
@github-project-automation github-project-automation bot moved this from Todo to Done in A3 Dec 15, 2023
michaelelliot pushed a commit to Swoir/noir_rs that referenced this issue Feb 28, 2024
1. Fixes AztecProtocol#3465
2. Fixes AztecProtocol#3695
3. naming consistency fix in get sibling path methods,
4. refactored the e2e test and each type of proof is now in a nested
describe statement.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants