diff --git a/circuits/cpp/src/aztec3/circuits/abis/c_bind.h b/circuits/cpp/src/aztec3/circuits/abis/c_bind.h index 94bcc904792..285aa0298a9 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 0065c62643b..f964abe594a 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 0f9ea0a3fce..0748759a494 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 b216cd17529..7894c8bb9d9 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 0784704c192..75d2b804020 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 b1ea045ad28..bf1c30dc291 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 0a6cc5e0f60..53b2de8ce62 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 96603192162..18cfbb5fc20 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 5fdcba476eb..e0601e48fc0 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 53befdfc941..8f89b495ed2 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 6471eb6654d..33fa83c4f3c 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 c0e1338f0a5..bd08b4c5bdb 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 32ff40c4c5a..7ee34f3d614 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 5a7e60acb77..f859a77ea93 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 fa5b8f2563b..5ec0470d1bb 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 3f36e9a0ae7..5fc62e690d3 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