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

Logs in base rollup circuit #746

Merged
merged 3 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,15 @@ std::array<fr, 2> compute_kernels_calldata_hash(std::array<abis::PreviousKernelD
// 8 public data update requests (4 per kernel) -> 16 fields
// 4 l2 -> l1 messages (2 per kernel) -> 4 fields
// 2 contract deployments (1 per kernel) -> 6 fields
// 2 encrypted logs hashes (1 per kernel) -> 4 fields
// 2 unencrypted logs hashes (1 per kernel) -> 4 fields
auto const number_of_inputs =
(KERNEL_NEW_COMMITMENTS_LENGTH + KERNEL_NEW_NULLIFIERS_LENGTH + KERNEL_PUBLIC_DATA_UPDATE_REQUESTS_LENGTH * 2 +
KERNEL_NEW_L2_TO_L1_MSGS_LENGTH + KERNEL_NEW_CONTRACTS_LENGTH * 3) *
KERNEL_NEW_L2_TO_L1_MSGS_LENGTH + KERNEL_NEW_CONTRACTS_LENGTH * 3
// TODO #769, relevant issue https://github.com/AztecProtocol/aztec-packages/issues/769
// + KERNEL_NUM_ENCRYPTED_LOGS_HASHES * 2
// + KERNEL_NUM_UNENCRYPTED_LOGS_HASHES * 2
) *
2;
std::array<NT::fr, number_of_inputs> calldata_hash_inputs;

Expand All @@ -117,6 +123,8 @@ std::array<fr, 2> compute_kernels_calldata_hash(std::array<abis::PreviousKernelD
auto new_nullifiers = kernel_data[i].public_inputs.end.new_nullifiers;
auto public_data_update_requests = kernel_data[i].public_inputs.end.public_data_update_requests;
auto newL2ToL1msgs = kernel_data[i].public_inputs.end.new_l2_to_l1_msgs;
auto encryptedLogsHash = kernel_data[i].public_inputs.end.encrypted_logs_hash;
// auto unencryptedLogsHash = kernel_data[i].public_inputs.end.unencrypted_logs_hash;

size_t offset = 0;

Expand Down Expand Up @@ -151,6 +159,16 @@ std::array<fr, 2> compute_kernels_calldata_hash(std::array<abis::PreviousKernelD
auto new_contracts = kernel_data[i].public_inputs.end.new_contracts;
calldata_hash_inputs[offset + i * 2] = new_contracts[0].contract_address;
calldata_hash_inputs[offset + i * 2 + 1] = new_contracts[0].portal_contract_address;

// TODO #769, relevant issue https://github.com/AztecProtocol/aztec-packages/issues/769
// offset += KERNEL_NEW_CONTRACTS_LENGTH * 2 * 2;
// calldata_hash_inputs[offset + i * 2] = encryptedLogsHash[0];
// calldata_hash_inputs[offset + i * 2 + 1] = encryptedLogsHash[1];

// offset += KERNEL_NUM_ENCRYPTED_LOGS_HASHES * 2;

// calldata_hash_inputs[offset + i * 2] = unencryptedLogsHash[0];
// calldata_hash_inputs[offset + i * 2 + 1] = unencryptedLogsHash[1];
}

constexpr auto num_bytes = calldata_hash_inputs.size() * 32;
Expand Down
6 changes: 5 additions & 1 deletion circuits/cpp/src/aztec3/circuits/rollup/test_utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ std::vector<uint8_t> get_empty_calldata_leaf()
{
auto const number_of_inputs =
(KERNEL_NEW_COMMITMENTS_LENGTH + KERNEL_NEW_NULLIFIERS_LENGTH + KERNEL_PUBLIC_DATA_UPDATE_REQUESTS_LENGTH * 2 +
KERNEL_NEW_L2_TO_L1_MSGS_LENGTH + KERNEL_NEW_CONTRACTS_LENGTH * 3) *
KERNEL_NEW_L2_TO_L1_MSGS_LENGTH + KERNEL_NEW_CONTRACTS_LENGTH * 3
// TODO #769, relevant issue https://github.com/AztecProtocol/aztec-packages/issues/769
// + KERNEL_NUM_ENCRYPTED_LOGS_HASHES * 2
// + KERNEL_NUM_UNENCRYPTED_LOGS_HASHES * 2
) *
2;
auto const size = number_of_inputs * 32;
std::vector<uint8_t> input_data(size, 0);
Expand Down
2 changes: 2 additions & 0 deletions circuits/cpp/src/aztec3/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ constexpr size_t KERNEL_NEW_L2_TO_L1_MSGS_LENGTH = 2;
constexpr size_t KERNEL_OPTIONALLY_REVEALED_DATA_LENGTH = 4;
constexpr size_t KERNEL_PUBLIC_DATA_UPDATE_REQUESTS_LENGTH = 4;
constexpr size_t KERNEL_PUBLIC_DATA_READS_LENGTH = 4;
constexpr size_t KERNEL_NUM_ENCRYPTED_LOGS_HASHES = 1;
constexpr size_t KERNEL_NUM_UNENCRYPTED_LOGS_HASHES = 1;

constexpr size_t VK_TREE_HEIGHT = 3;
constexpr size_t FUNCTION_TREE_HEIGHT = 4;
Expand Down