From 5e53345270873a3af2b47f6f078e3b4f1cc973d0 Mon Sep 17 00:00:00 2001 From: Jean M <132435771+jeanmon@users.noreply.github.com> Date: Thu, 14 Sep 2023 18:08:43 +0200 Subject: [PATCH] chore(circuits): clean up of some superfluous header includes (#2302) A cleanup PR consisting mainly in removing superfluous header includes. # Checklist: Remove the checklist to signal you've completed it. Enable auto-merge if the PR is ready to merge. - [x] If the pull request requires a cryptography review (e.g. cryptographic algorithm implementations) I have added the 'crypto' tag. - [x] I have reviewed my diff in github, line by line and removed unexpected formatting changes, testing logs, or commented-out code. - [x] Every change is related to the PR description. - [ ] I have [linked](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) this pull request to relevant issues (if any exist). --- circuits/cpp/src/aztec3/circuits/abis/c_bind.h | 2 -- .../src/aztec3/circuits/abis/call_stack_item.hpp | 1 - .../aztec3/circuits/abis/contract_storage_read.hpp | 1 - .../abis/private_circuit_public_inputs.hpp | 1 - .../circuits/abis/public_circuit_public_inputs.hpp | 1 - .../abis/rollup/merge/merge_rollup_inputs.hpp | 1 - .../abis/rollup/merge/previous_rollup_data.hpp | 1 - .../abis/rollup/root/root_rollup_public_inputs.hpp | 3 --- circuits/cpp/src/aztec3/circuits/abis/types.hpp | 6 ------ .../src/aztec3/circuits/kernel/public/.test.cpp | 14 ++++---------- .../src/aztec3/circuits/kernel/public/c_bind.cpp | 8 ++++---- .../src/aztec3/circuits/kernel/public/common.cpp | 2 ++ .../src/aztec3/circuits/kernel/public/common.hpp | 13 ++----------- .../cpp/src/aztec3/circuits/kernel/public/init.hpp | 1 - ...blic_kernel_circuit_private_previous_kernel.cpp | 9 ++++++--- ...ublic_kernel_circuit_public_previous_kernel.cpp | 9 ++++++--- 16 files changed, 24 insertions(+), 49 deletions(-) diff --git a/circuits/cpp/src/aztec3/circuits/abis/c_bind.h b/circuits/cpp/src/aztec3/circuits/abis/c_bind.h index 94bcc9047926..285aa0298a9b 100644 --- a/circuits/cpp/src/aztec3/circuits/abis/c_bind.h +++ b/circuits/cpp/src/aztec3/circuits/abis/c_bind.h @@ -1,5 +1,3 @@ -#include "aztec3/circuits/hash.hpp" - #include #include diff --git a/circuits/cpp/src/aztec3/circuits/abis/call_stack_item.hpp b/circuits/cpp/src/aztec3/circuits/abis/call_stack_item.hpp index 0065c62643bb..f964abe594a3 100644 --- a/circuits/cpp/src/aztec3/circuits/abis/call_stack_item.hpp +++ b/circuits/cpp/src/aztec3/circuits/abis/call_stack_item.hpp @@ -6,7 +6,6 @@ #include "aztec3/circuits/abis/types.hpp" #include "aztec3/utils/msgpack_derived_equals.hpp" -#include "aztec3/utils/msgpack_derived_output.hpp" #include "aztec3/utils/types/circuit_types.hpp" #include "aztec3/utils/types/convert.hpp" #include "aztec3/utils/types/native_types.hpp" diff --git a/circuits/cpp/src/aztec3/circuits/abis/contract_storage_read.hpp b/circuits/cpp/src/aztec3/circuits/abis/contract_storage_read.hpp index 0f9ea0a3fcee..0748759a494c 100644 --- a/circuits/cpp/src/aztec3/circuits/abis/contract_storage_read.hpp +++ b/circuits/cpp/src/aztec3/circuits/abis/contract_storage_read.hpp @@ -1,5 +1,4 @@ #pragma once -#include "aztec3/utils/msgpack_derived_output.hpp" #include "aztec3/utils/types/circuit_types.hpp" #include "aztec3/utils/types/convert.hpp" #include "aztec3/utils/types/native_types.hpp" diff --git a/circuits/cpp/src/aztec3/circuits/abis/private_circuit_public_inputs.hpp b/circuits/cpp/src/aztec3/circuits/abis/private_circuit_public_inputs.hpp index b216cd17529b..7894c8bb9d96 100644 --- a/circuits/cpp/src/aztec3/circuits/abis/private_circuit_public_inputs.hpp +++ b/circuits/cpp/src/aztec3/circuits/abis/private_circuit_public_inputs.hpp @@ -9,7 +9,6 @@ #include "aztec3/utils/types/convert.hpp" #include "aztec3/utils/types/native_types.hpp" -#include "barretenberg/common/serialize.hpp" #include namespace aztec3::circuits::abis { diff --git a/circuits/cpp/src/aztec3/circuits/abis/public_circuit_public_inputs.hpp b/circuits/cpp/src/aztec3/circuits/abis/public_circuit_public_inputs.hpp index 0784704c192b..75d2b804020d 100644 --- a/circuits/cpp/src/aztec3/circuits/abis/public_circuit_public_inputs.hpp +++ b/circuits/cpp/src/aztec3/circuits/abis/public_circuit_public_inputs.hpp @@ -6,7 +6,6 @@ #include "../../constants.hpp" #include "aztec3/circuits/abis/historic_block_data.hpp" -#include "aztec3/utils/msgpack_derived_output.hpp" #include "aztec3/utils/types/circuit_types.hpp" #include "aztec3/utils/types/native_types.hpp" diff --git a/circuits/cpp/src/aztec3/circuits/abis/rollup/merge/merge_rollup_inputs.hpp b/circuits/cpp/src/aztec3/circuits/abis/rollup/merge/merge_rollup_inputs.hpp index b1ea045ad28c..bf1c30dc2919 100644 --- a/circuits/cpp/src/aztec3/circuits/abis/rollup/merge/merge_rollup_inputs.hpp +++ b/circuits/cpp/src/aztec3/circuits/abis/rollup/merge/merge_rollup_inputs.hpp @@ -1,5 +1,4 @@ #pragma once -#include "aztec3/circuits/abis/append_only_tree_snapshot.hpp" #include "aztec3/circuits/abis/rollup/merge/previous_rollup_data.hpp" #include diff --git a/circuits/cpp/src/aztec3/circuits/abis/rollup/merge/previous_rollup_data.hpp b/circuits/cpp/src/aztec3/circuits/abis/rollup/merge/previous_rollup_data.hpp index 0a6cc5e0f609..53b2de8ce626 100644 --- a/circuits/cpp/src/aztec3/circuits/abis/rollup/merge/previous_rollup_data.hpp +++ b/circuits/cpp/src/aztec3/circuits/abis/rollup/merge/previous_rollup_data.hpp @@ -1,5 +1,4 @@ #pragma once -#include "aztec3/circuits/abis/append_only_tree_snapshot.hpp" #include "aztec3/circuits/abis/membership_witness.hpp" #include "aztec3/circuits/abis/rollup/base/base_or_merge_rollup_public_inputs.hpp" #include "aztec3/constants.hpp" diff --git a/circuits/cpp/src/aztec3/circuits/abis/rollup/root/root_rollup_public_inputs.hpp b/circuits/cpp/src/aztec3/circuits/abis/rollup/root/root_rollup_public_inputs.hpp index 96603192162a..18cfbb5fc201 100644 --- a/circuits/cpp/src/aztec3/circuits/abis/rollup/root/root_rollup_public_inputs.hpp +++ b/circuits/cpp/src/aztec3/circuits/abis/rollup/root/root_rollup_public_inputs.hpp @@ -3,9 +3,6 @@ #include "aztec3/circuits/abis/append_only_tree_snapshot.hpp" #include "aztec3/circuits/abis/global_variables.hpp" #include "aztec3/constants.hpp" -#include "aztec3/utils/types/circuit_types.hpp" -#include "aztec3/utils/types/convert.hpp" -#include "aztec3/utils/types/native_types.hpp" #include diff --git a/circuits/cpp/src/aztec3/circuits/abis/types.hpp b/circuits/cpp/src/aztec3/circuits/abis/types.hpp index 5fdcba476ebb..e0601e48fc04 100644 --- a/circuits/cpp/src/aztec3/circuits/abis/types.hpp +++ b/circuits/cpp/src/aztec3/circuits/abis/types.hpp @@ -2,12 +2,6 @@ #include "private_circuit_public_inputs.hpp" #include "public_circuit_public_inputs.hpp" -#include "aztec3/constants.hpp" -#include "aztec3/utils/array.hpp" -#include "aztec3/utils/types/circuit_types.hpp" -#include "aztec3/utils/types/convert.hpp" -#include "aztec3/utils/types/native_types.hpp" - #include namespace aztec3::circuits::abis { diff --git a/circuits/cpp/src/aztec3/circuits/kernel/public/.test.cpp b/circuits/cpp/src/aztec3/circuits/kernel/public/.test.cpp index 53befdfc941a..8f89b495ed20 100644 --- a/circuits/cpp/src/aztec3/circuits/kernel/public/.test.cpp +++ b/circuits/cpp/src/aztec3/circuits/kernel/public/.test.cpp @@ -6,12 +6,8 @@ #include "aztec3/circuits/abis/call_stack_item.hpp" #include "aztec3/circuits/abis/combined_accumulated_data.hpp" #include "aztec3/circuits/abis/combined_constant_data.hpp" -#include "aztec3/circuits/abis/contract_deployment_data.hpp" -#include "aztec3/circuits/abis/function_data.hpp" -#include "aztec3/circuits/abis/historic_block_data.hpp" -#include "aztec3/circuits/abis/kernel_circuit_public_inputs.hpp" +#include "aztec3/circuits/abis/contract_storage_update_request.hpp" #include "aztec3/circuits/abis/previous_kernel_data.hpp" -#include "aztec3/circuits/abis/private_circuit_public_inputs.hpp" #include "aztec3/circuits/abis/public_kernel/public_call_data.hpp" #include "aztec3/circuits/abis/public_kernel/public_kernel_inputs.hpp" #include "aztec3/circuits/abis/tx_context.hpp" @@ -26,7 +22,7 @@ #include -namespace { +namespace aztec3::circuits::kernel::public_kernel { using DummyCircuitBuilder = aztec3::utils::DummyCircuitBuilder; using aztec3::circuits::abis::public_kernel::PublicKernelInputs; using NT = aztec3::utils::types::NativeTypes; @@ -34,6 +30,8 @@ using aztec3::circuits::abis::CallContext; using aztec3::circuits::abis::CallStackItem; using aztec3::circuits::abis::CombinedAccumulatedData; using aztec3::circuits::abis::CombinedConstantData; +using aztec3::circuits::abis::ContractStorageRead; +using aztec3::circuits::abis::ContractStorageUpdateRequest; using aztec3::circuits::abis::HistoricBlockData; using aztec3::circuits::abis::NewContractData; using aztec3::circuits::abis::OptionallyRevealedData; @@ -45,10 +43,6 @@ using aztec3::circuits::abis::TxContext; using aztec3::circuits::abis::TxRequest; using aztec3::circuits::abis::public_kernel::PublicCallData; using aztec3::utils::source_arrays_are_in_target; -} // namespace - -namespace aztec3::circuits::kernel::public_kernel { - using PublicCallStackItem = CallStackItem; template diff --git a/circuits/cpp/src/aztec3/circuits/kernel/public/c_bind.cpp b/circuits/cpp/src/aztec3/circuits/kernel/public/c_bind.cpp index 6471eb6654de..33fa83c4f3cf 100644 --- a/circuits/cpp/src/aztec3/circuits/kernel/public/c_bind.cpp +++ b/circuits/cpp/src/aztec3/circuits/kernel/public/c_bind.cpp @@ -14,16 +14,14 @@ namespace { using Builder = UltraCircuitBuilder; using NT = aztec3::utils::types::NativeTypes; -using DummyCircuitBuilder = aztec3::utils::DummyCircuitBuilder; +using DummyBuilder = aztec3::utils::DummyCircuitBuilder; using aztec3::circuits::abis::KernelCircuitPublicInputs; using aztec3::circuits::abis::public_kernel::PublicKernelInputs; using aztec3::circuits::kernel::public_kernel::native_public_kernel_circuit_private_previous_kernel; using aztec3::circuits::kernel::public_kernel::native_public_kernel_circuit_public_previous_kernel; -} // namespace // WASM Cbinds - -CBIND(public_kernel__sim, [](PublicKernelInputs public_kernel_inputs) { +CBIND(public_kernel__sim, [](PublicKernelInputs const& public_kernel_inputs) { DummyBuilder builder = DummyBuilder("public_kernel__sim"); KernelCircuitPublicInputs const result = public_kernel_inputs.previous_kernel.public_inputs.is_private @@ -31,3 +29,5 @@ CBIND(public_kernel__sim, [](PublicKernelInputs public_kernel_inputs) { : native_public_kernel_circuit_public_previous_kernel(builder, public_kernel_inputs); return builder.result_or_error(result); }); + +} // namespace diff --git a/circuits/cpp/src/aztec3/circuits/kernel/public/common.cpp b/circuits/cpp/src/aztec3/circuits/kernel/public/common.cpp index c0e1338f0a58..bd08b4c5bdbf 100644 --- a/circuits/cpp/src/aztec3/circuits/kernel/public/common.cpp +++ b/circuits/cpp/src/aztec3/circuits/kernel/public/common.cpp @@ -7,6 +7,8 @@ namespace aztec3::circuits::kernel::public_kernel { +using aztec3::utils::array_pop; + void common_initialise_end_values(PublicKernelInputs const& public_kernel_inputs, KernelCircuitPublicInputs& circuit_outputs) { diff --git a/circuits/cpp/src/aztec3/circuits/kernel/public/common.hpp b/circuits/cpp/src/aztec3/circuits/kernel/public/common.hpp index 32ff40c4c5a1..7ee34f3d6144 100644 --- a/circuits/cpp/src/aztec3/circuits/kernel/public/common.hpp +++ b/circuits/cpp/src/aztec3/circuits/kernel/public/common.hpp @@ -2,8 +2,6 @@ #include "init.hpp" -#include "aztec3/circuits/abis/contract_storage_read.hpp" -#include "aztec3/circuits/abis/contract_storage_update_request.hpp" #include "aztec3/circuits/abis/kernel_circuit_public_inputs.hpp" #include "aztec3/circuits/abis/public_data_update_request.hpp" #include "aztec3/circuits/abis/public_kernel/public_kernel_inputs.hpp" @@ -11,25 +9,18 @@ #include "aztec3/utils/array.hpp" #include "aztec3/utils/dummy_circuit_builder.hpp" +namespace aztec3::circuits::kernel::public_kernel { + using NT = aztec3::utils::types::NativeTypes; -using aztec3::circuits::abis::ContractStorageRead; -using aztec3::circuits::abis::ContractStorageUpdateRequest; using aztec3::circuits::abis::KernelCircuitPublicInputs; using aztec3::circuits::abis::PublicDataRead; using aztec3::circuits::abis::PublicDataUpdateRequest; using aztec3::circuits::abis::public_kernel::PublicKernelInputs; using DummyBuilder = aztec3::utils::DummyCircuitBuilder; -using aztec3::circuits::check_membership; -using aztec3::circuits::compute_public_data_tree_index; -using aztec3::circuits::compute_public_data_tree_value; -using aztec3::circuits::root_from_sibling_path; using aztec3::utils::array_length; -using aztec3::utils::array_pop; using aztec3::utils::array_push; using aztec3::utils::push_array_to_array; -namespace aztec3::circuits::kernel::public_kernel { - /** * @brief Validate that all pre-images on the call stack hash to equal the accumulated data * @tparam The type of kernel input diff --git a/circuits/cpp/src/aztec3/circuits/kernel/public/init.hpp b/circuits/cpp/src/aztec3/circuits/kernel/public/init.hpp index 5a7e60acb778..f859a77ea937 100644 --- a/circuits/cpp/src/aztec3/circuits/kernel/public/init.hpp +++ b/circuits/cpp/src/aztec3/circuits/kernel/public/init.hpp @@ -1,5 +1,4 @@ #pragma once -#include "aztec3/circuits/abis/public_kernel/public_kernel_inputs.hpp" #include "aztec3/circuits/apps/oracle_wrapper.hpp" #include "aztec3/circuits/recursion/aggregator.hpp" #include "aztec3/oracle/oracle.hpp" diff --git a/circuits/cpp/src/aztec3/circuits/kernel/public/native_public_kernel_circuit_private_previous_kernel.cpp b/circuits/cpp/src/aztec3/circuits/kernel/public/native_public_kernel_circuit_private_previous_kernel.cpp index fa5b8f2563bd..5ec0470d1bb0 100644 --- a/circuits/cpp/src/aztec3/circuits/kernel/public/native_public_kernel_circuit_private_previous_kernel.cpp +++ b/circuits/cpp/src/aztec3/circuits/kernel/public/native_public_kernel_circuit_private_previous_kernel.cpp @@ -4,13 +4,18 @@ #include "aztec3/circuits/abis/kernel_circuit_public_inputs.hpp" #include "aztec3/circuits/abis/public_kernel/public_kernel_inputs.hpp" -#include "aztec3/constants.hpp" #include "aztec3/utils/array.hpp" #include "aztec3/utils/circuit_errors.hpp" #include "aztec3/utils/dummy_circuit_builder.hpp" +// Purpose of this anonymous namespace is to avoid to clash with the validate_inputs() +// counterpart defined in native_public_kernel_circuit_public_previous_kernel.cpp namespace { using CircuitErrorCode = aztec3::utils::CircuitErrorCode; +using aztec3::circuits::kernel::public_kernel::NT; +using DummyBuilder = aztec3::utils::DummyCircuitBuilder; +using aztec3::circuits::abis::public_kernel::PublicKernelInputs; +using aztec3::utils::array_length; /** * @brief Validates the kernel circuit inputs specific to having a private previous kernel @@ -32,11 +37,9 @@ void validate_inputs(DummyBuilder& builder, PublicKernelInputs const& public namespace aztec3::circuits::kernel::public_kernel { using aztec3::circuits::abis::KernelCircuitPublicInputs; -using aztec3::circuits::abis::public_kernel::PublicKernelInputs; using aztec3::circuits::kernel::public_kernel::common_initialise_end_values; using aztec3::circuits::kernel::public_kernel::common_validate_kernel_execution; -using DummyBuilder = aztec3::utils::DummyCircuitBuilder; /** * @brief Entry point for the native public kernel circuit with a private previous kernel diff --git a/circuits/cpp/src/aztec3/circuits/kernel/public/native_public_kernel_circuit_public_previous_kernel.cpp b/circuits/cpp/src/aztec3/circuits/kernel/public/native_public_kernel_circuit_public_previous_kernel.cpp index 3f36e9a0ae71..5fc62e690d37 100644 --- a/circuits/cpp/src/aztec3/circuits/kernel/public/native_public_kernel_circuit_public_previous_kernel.cpp +++ b/circuits/cpp/src/aztec3/circuits/kernel/public/native_public_kernel_circuit_public_previous_kernel.cpp @@ -5,11 +5,16 @@ #include "aztec3/circuits/abis/kernel_circuit_public_inputs.hpp" #include "aztec3/circuits/abis/public_kernel/public_kernel_inputs.hpp" -#include "aztec3/utils/array.hpp" #include "aztec3/utils/dummy_circuit_builder.hpp" +// Purpose of this anonymous namespace is to avoid to clash with the validate_inputs() +// counterpart defined in native_public_kernel_circuit_private_previous_kernel.cpp namespace { using CircuitErrorCode = aztec3::utils::CircuitErrorCode; +using aztec3::circuits::kernel::public_kernel::NT; +using DummyBuilder = aztec3::utils::DummyCircuitBuilder; +using aztec3::circuits::abis::public_kernel::PublicKernelInputs; + /** * @brief Validates the kernel circuit inputs specific to having a public previous kernel * @param builder The circuit builder @@ -27,10 +32,8 @@ void validate_inputs(DummyBuilder& builder, PublicKernelInputs const& public namespace aztec3::circuits::kernel::public_kernel { using aztec3::circuits::abis::KernelCircuitPublicInputs; -using aztec3::circuits::abis::public_kernel::PublicKernelInputs; using aztec3::circuits::kernel::public_kernel::common_validate_kernel_execution; -using DummyBuilder = aztec3::utils::DummyCircuitBuilder; /** * @brief Entry point for the native public kernel circuit with a public previous kernel