From 85e1fb96e87f32c7f129bb061e8748addf67e147 Mon Sep 17 00:00:00 2001 From: benesjan Date: Wed, 7 Jun 2023 08:49:57 +0000 Subject: [PATCH 1/2] feat: including encrypted logs hash in calldata hash preimage --- .../circuits/rollup/components/components.cpp | 18 +++++++++++++++++- .../circuits/rollup/test_utils/utils.cpp | 4 +++- circuits/cpp/src/aztec3/constants.hpp | 2 ++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/circuits/cpp/src/aztec3/circuits/rollup/components/components.cpp b/circuits/cpp/src/aztec3/circuits/rollup/components/components.cpp index a3365047ddf..5ddda78fa05 100644 --- a/circuits/cpp/src/aztec3/circuits/rollup/components/components.cpp +++ b/circuits/cpp/src/aztec3/circuits/rollup/components/components.cpp @@ -106,9 +106,13 @@ std::array compute_kernels_calldata_hash(std::array 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 + KERNEL_NUM_ENCRYPTED_LOGS_HASHES * 2 + // + KERNEL_NUM_UNENCRYPTED_LOGS_HASHES * 2 + ) * 2; std::array calldata_hash_inputs; @@ -117,6 +121,8 @@ std::array compute_kernels_calldata_hash(std::array compute_kernels_calldata_hash(std::array 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 + KERNEL_NUM_ENCRYPTED_LOGS_HASHES * 2 + // + KERNEL_NUM_UNENCRYPTED_LOGS_HASHES * 2 + ) * 2; auto const size = number_of_inputs * 32; std::vector input_data(size, 0); diff --git a/circuits/cpp/src/aztec3/constants.hpp b/circuits/cpp/src/aztec3/constants.hpp index 47675a0f520..b35c32c26fb 100644 --- a/circuits/cpp/src/aztec3/constants.hpp +++ b/circuits/cpp/src/aztec3/constants.hpp @@ -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; From c9c5f1e001c335d581a55ff9faefdb429c667a48 Mon Sep 17 00:00:00 2001 From: benesjan Date: Wed, 7 Jun 2023 15:04:31 +0000 Subject: [PATCH 2/2] chore: commenting out logs code to make CI pass --- .../aztec3/circuits/rollup/components/components.cpp | 12 +++++++----- .../src/aztec3/circuits/rollup/test_utils/utils.cpp | 4 +++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/circuits/cpp/src/aztec3/circuits/rollup/components/components.cpp b/circuits/cpp/src/aztec3/circuits/rollup/components/components.cpp index 5ddda78fa05..877d77376fa 100644 --- a/circuits/cpp/src/aztec3/circuits/rollup/components/components.cpp +++ b/circuits/cpp/src/aztec3/circuits/rollup/components/components.cpp @@ -110,7 +110,9 @@ std::array compute_kernels_calldata_hash(std::array 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_NUM_ENCRYPTED_LOGS_HASHES * 2 + 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; @@ -158,10 +160,10 @@ std::array compute_kernels_calldata_hash(std::array 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_NUM_ENCRYPTED_LOGS_HASHES * 2 + 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;