Skip to content

feat(public kernel): add new_commitments, new_nullifiers, new_l2_to_l1_msgs aggregation #753

Merged
Maddiaa0 merged 29 commits into
masterfrom
md/new-commitments-public
Jun 8, 2023
Merged

feat(public kernel): add new_commitments, new_nullifiers, new_l2_to_l1_msgs aggregation #753
Maddiaa0 merged 29 commits into
masterfrom
md/new-commitments-public

Conversation

@Maddiaa0

@Maddiaa0 Maddiaa0 commented Jun 5, 2023

Copy link
Copy Markdown
Member

Description

closes: #752
part of larger work: #750 (public -> private messaging)

Also included l2 to l1 messaging as it looked like the same work!

Works towards allowing public execution contexts to include new commitments in their outputs (scoped to contract address)

Do not merge before: #762

Note: a small fix to remake-bindings has been added in this pr, issue here:

Checklist:

  • I have reviewed my diff in github, line by line.
  • Every change is related to the PR description.
  • I have linked this pull request to the issue(s) that it resolves.
  • There are no unexpected formatting changes, superfluous debug logs, or commented-out code.
  • The branch has been merged or rebased against the head of its merge target.
  • I'm happy for the PR to be merged at the reviewer's next convenience.

@Maddiaa0 Maddiaa0 marked this pull request as ready for review June 6, 2023 12:29
@Maddiaa0 Maddiaa0 requested review from LHerskind and rahul-kothari and removed request for LHerskind and rahul-kothari June 6, 2023 12:29
@Maddiaa0 Maddiaa0 changed the title feat: add new_commitments aggregation to public kernel feat: add new_commitments, new_l2_to_l1_msgs aggregation to public kernel Jun 6, 2023

@LHerskind LHerskind left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few comments

Comment thread circuits/cpp/src/aztec3/circuits/kernel/public/.test.cpp Outdated
Comment thread circuits/cpp/src/aztec3/circuits/kernel/public/common.hpp
Comment thread circuits/cpp/src/aztec3/circuits/kernel/public/common.hpp Outdated
Comment thread yarn-project/circuits.js/package.json
Comment thread yarn-project/noir-contracts/src/contracts/noir-aztec3/src/abi.nr Outdated
@Maddiaa0 Maddiaa0 force-pushed the md/new-commitments-public branch from 7d0acd5 to 32d5641 Compare June 6, 2023 18:39
@Maddiaa0 Maddiaa0 force-pushed the md/new-commitments-public branch from 32d5641 to 34d0742 Compare June 6, 2023 18:44
@Maddiaa0

Maddiaa0 commented Jun 6, 2023

Copy link
Copy Markdown
Member Author

This pr builds ontop of #762, which create propagation errors when adding aggregating kernels that are too large

fix: noir
@Maddiaa0 Maddiaa0 force-pushed the md/new-commitments-public branch from 65c4dba to 2038413 Compare June 6, 2023 18:56
@Maddiaa0 Maddiaa0 changed the title feat: add new_commitments, new_l2_to_l1_msgs aggregation to public kernel feat(public kernel): add new_commitments, new_l2_to_l1_msgs aggregation Jun 6, 2023
@Maddiaa0 Maddiaa0 requested a review from LHerskind June 6, 2023 19:09
{
// Get the new commitments
const auto& public_call_public_inputs = public_kernel_inputs.public_call.call_stack_item.public_inputs;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the private kernel, we have a check here to see if the call is static, since no changes are allowed. Is this also true for public?

https://github.com/AztecProtocol/aztec3-packages/blob/c6b68f7f05ba97d41d32d0eb3b016aa9ce670d04/circuits/cpp/src/aztec3/circuits/kernel/private/private_kernel_circuit.cpp#L101

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch this looks like it should be here too!

private_call_stack: arr_copy_slice(fields, [0; crate::abi::MAX_PRIVATE_CALL_STACK], 23),
public_call_stack: arr_copy_slice(fields, [0; crate::abi::MAX_PUBLIC_CALL_STACK], 27),
new_l2_to_l1_msgs:arr_copy_slice(fields, [0; crate::abi::MAX_L1_MSG_STACK], 31),
new_l2_to_l1_msgs:arr_copy_slice(fields, [0; crate::abi::MAX_L2_TO_L1_MSG_STACK], 35),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this 35?

global MAX_PUBLIC_CALL_STACK: comptime Field = 4;
global MAX_L1_MSG_STACK : comptime Field = 2;
global MAX_L2_TO_L1_MSG_STACK : comptime Field = 2;
global PUBLIC_INPUTS_LENGTH : comptime Field = 41;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for me- why is this 41 when the other is 43?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

messed in the master merge, good catch!

// in the public kernel, function can't be a constructor or private
new FunctionData(makeSelector(seed + 0x1), false, false),
makePublicCircuitPublicInputs(seed + 0x10),
makePublicCircuitPublicInputs(seed + 0x10, undefined, full),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can skip the undefined by just using named parameters like so:
makePublicCircuitPublicInputs(seed + 0x10, full=full)

@LHerskind LHerskind left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a jump of 4 that seems invalid, but otherwise mostly some naming.

Comment thread circuits/cpp/src/aztec3/circuits/kernel/public/common.hpp
Comment thread yarn-project/noir-contracts/src/contracts/noir-aztec3/src/abi.nr Outdated
Comment thread yarn-project/noir-contracts/src/contracts/noir-aztec3/src/abi.nr Outdated
Comment thread yarn-project/noir-contracts/src/contracts/noir-aztec3/src/abi.nr Outdated
Comment thread yarn-project/noir-contracts/src/contracts/noir-aztec3/src/abi.nr Outdated
Comment thread yarn-project/noir-contracts/src/contracts/noir-aztec3/src/abi.nr Outdated
Comment thread yarn-project/noir-contracts/src/contracts/noir-aztec3/src/context.nr Outdated
@Maddiaa0 Maddiaa0 closed this Jun 7, 2023
@Maddiaa0 Maddiaa0 reopened this Jun 7, 2023
@Maddiaa0 Maddiaa0 changed the title feat(public kernel): add new_commitments, new_l2_to_l1_msgs aggregation feat(public kernel): add new_commitments, new_nullifiers, new_l2_to_l1_msgs aggregation Jun 7, 2023
@Maddiaa0 Maddiaa0 requested a review from LHerskind June 7, 2023 17:27
@Maddiaa0 Maddiaa0 force-pushed the md/new-commitments-public branch from e36c399 to 9a9eee1 Compare June 7, 2023 17:52

@LHerskind LHerskind left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Maddiaa0 Maddiaa0 merged commit ca7b916 into master Jun 8, 2023
@Maddiaa0 Maddiaa0 deleted the md/new-commitments-public branch June 8, 2023 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(public->private): Add the ability to create new commitments to the public execution context

4 participants