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

chore(circuits): clean up of some superfluous header includes #2302

Merged
merged 1 commit into from
Sep 14, 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
2 changes: 0 additions & 2 deletions circuits/cpp/src/aztec3/circuits/abis/c_bind.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include "aztec3/circuits/hash.hpp"

#include <barretenberg/barretenberg.hpp>

#include <algorithm>
Expand Down
1 change: 0 additions & 1 deletion circuits/cpp/src/aztec3/circuits/abis/call_stack_item.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "aztec3/utils/types/convert.hpp"
#include "aztec3/utils/types/native_types.hpp"

#include "barretenberg/common/serialize.hpp"
#include <barretenberg/barretenberg.hpp>

namespace aztec3::circuits::abis {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
@@ -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 <type_traits>
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <barretenberg/barretenberg.hpp>

Expand Down
6 changes: 0 additions & 6 deletions circuits/cpp/src/aztec3/circuits/abis/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <barretenberg/barretenberg.hpp>

namespace aztec3::circuits::abis {
Expand Down
14 changes: 4 additions & 10 deletions circuits/cpp/src/aztec3/circuits/kernel/public/.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -26,14 +22,16 @@

#include <array>

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;
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;
Expand All @@ -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<NT, aztec3::circuits::abis::PublicTypes>;

template <size_t SIZE>
Expand Down
8 changes: 4 additions & 4 deletions circuits/cpp/src/aztec3/circuits/kernel/public/c_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
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<NT> public_kernel_inputs) {
CBIND(public_kernel__sim, [](PublicKernelInputs<NT> const& public_kernel_inputs) {
DummyBuilder builder = DummyBuilder("public_kernel__sim");
KernelCircuitPublicInputs<NT> const result =
public_kernel_inputs.previous_kernel.public_inputs.is_private
? native_public_kernel_circuit_private_previous_kernel(builder, public_kernel_inputs)
: native_public_kernel_circuit_public_previous_kernel(builder, public_kernel_inputs);
return builder.result_or_error(result);
});

} // namespace
2 changes: 2 additions & 0 deletions circuits/cpp/src/aztec3/circuits/kernel/public/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

namespace aztec3::circuits::kernel::public_kernel {

using aztec3::utils::array_pop;

void common_initialise_end_values(PublicKernelInputs<NT> const& public_kernel_inputs,
KernelCircuitPublicInputs<NT>& circuit_outputs)
{
Expand Down
13 changes: 2 additions & 11 deletions circuits/cpp/src/aztec3/circuits/kernel/public/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,25 @@

#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"
#include "aztec3/circuits/hash.hpp"
#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
Expand Down
1 change: 0 additions & 1 deletion circuits/cpp/src/aztec3/circuits/kernel/public/init.hpp
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -32,11 +37,9 @@ void validate_inputs(DummyBuilder& builder, PublicKernelInputs<NT> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -27,10 +32,8 @@ void validate_inputs(DummyBuilder& builder, PublicKernelInputs<NT> 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
Expand Down