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

feat: Sort includes #571

Merged
merged 2 commits into from
Jul 4, 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion cpp/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ BraceWrapping:
SplitEmptyRecord: false
SplitEmptyNamespace: false
AllowShortFunctionsOnASingleLine : Inline
SortIncludes: false
SortIncludes: true
4 changes: 2 additions & 2 deletions cpp/src/barretenberg/barretenberg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
#include "ecc/curves/grumpkin/grumpkin.hpp"
#include "numeric/random/engine.hpp"
#include "numeric/uint256/uint256.hpp"
#include "proof_system/circuit_builder/turbo_circuit_builder.hpp"
#include "proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "plonk/proof_system/types/proof.hpp"
#include "plonk/proof_system/verification_key/verification_key.hpp"
#include "proof_system/circuit_builder/turbo_circuit_builder.hpp"
#include "proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "proof_system/types/circuit_type.hpp"
// TODO(https://github.com/AztecProtocol/barretenberg/issues/491):
// consider helper header(s) for serialization and other non-stdlib includes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

#include "barretenberg/stdlib/encryption/ecdsa/ecdsa.hpp"
#include "barretenberg/stdlib/hash/keccak/keccak.hpp"
#include "barretenberg/stdlib/primitives/curves/secp256k1.hpp"
#include "barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.hpp"
#include "barretenberg/stdlib/hash/sha256/sha256.hpp"
#include "barretenberg/stdlib/primitives/bool/bool.hpp"
#include "barretenberg/stdlib/primitives/field/field.hpp"
#include "barretenberg/stdlib/primitives/witness/witness.hpp"
#include "barretenberg/stdlib/merkle_tree/merkle_tree.hpp"
#include "barretenberg/stdlib/merkle_tree/membership.hpp"
#include "barretenberg/stdlib/merkle_tree/memory_store.hpp"
#include "barretenberg/stdlib/merkle_tree/memory_tree.hpp"
#include "barretenberg/stdlib/merkle_tree/merkle_tree.hpp"
#include "barretenberg/stdlib/primitives/bool/bool.hpp"
#include "barretenberg/stdlib/primitives/curves/secp256k1.hpp"
#include "barretenberg/stdlib/primitives/field/field.hpp"
#include "barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.hpp"
#include "barretenberg/stdlib/primitives/witness/witness.hpp"

using namespace benchmark;

Expand Down
4 changes: 2 additions & 2 deletions cpp/src/barretenberg/benchmark/honk_bench/honk.bench.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <benchmark/benchmark.h>
#include <cstddef>
#include "barretenberg/honk/composer/standard_composer.hpp"
#include "barretenberg/stdlib/primitives/field/field.hpp"
#include "barretenberg/stdlib/primitives/witness/witness.hpp"
#include <benchmark/benchmark.h>
#include <cstddef>

using namespace benchmark;
using namespace proof_system::plonk::stdlib;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "barretenberg/benchmark/honk_bench/benchmark_utilities.hpp"
#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp"
#include "barretenberg/honk/composer/standard_composer.hpp"
#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp"

using namespace benchmark;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "barretenberg/benchmark/honk_bench/benchmark_utilities.hpp"
#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp"
#include "barretenberg/plonk/composer/standard_composer.hpp"
#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp"

using namespace benchmark;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <benchmark/benchmark.h>

#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "barretenberg/honk/composer/ultra_composer.hpp"
#include "barretenberg/benchmark/honk_bench/benchmark_utilities.hpp"
#include "barretenberg/honk/composer/ultra_composer.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"

using namespace benchmark;
using namespace proof_system::plonk;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "barretenberg/benchmark/honk_bench/benchmark_utilities.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "barretenberg/plonk/composer/ultra_composer.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"

using namespace benchmark;

Expand Down
6 changes: 3 additions & 3 deletions cpp/src/barretenberg/benchmark/pippenger_bench/main.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include <chrono>
#include "barretenberg/common/assert.hpp"
#include <cstdlib>
#include "barretenberg/srs/factories/file_crs_factory.hpp"
#include "barretenberg/ecc/curves/bn254/bn254.hpp"
#include "barretenberg/ecc/scalar_multiplication/scalar_multiplication.hpp"
#include "barretenberg/polynomials/polynomial_arithmetic.hpp"
#include "barretenberg/srs/factories/file_crs_factory.hpp"
#include <chrono>
#include <cstdlib>

// #include <valgrind/callgrind.h>
// CALLGRIND_START_INSTRUMENTATION;
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/barretenberg/benchmark/plonk_bench/plonk.bench.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <benchmark/benchmark.h>
#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp"
#include "barretenberg/plonk/composer/standard_composer.hpp"
#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp"
#include "barretenberg/stdlib/primitives/field/field.hpp"
#include <benchmark/benchmark.h>

using namespace benchmark;

Expand Down
4 changes: 2 additions & 2 deletions cpp/src/barretenberg/common/assert.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once
#include "assert.h"
#include <string>
#include <stdexcept>
#include <iostream>
#include <stdexcept>
#include <string>

// Compiler should optimize this out in release builds, without triggering an unused variable warning.
#define DONT_EVALUATE(expression) \
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/barretenberg/common/c_bind.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "./c_bind.hpp"
#include "./mem.hpp"
#include "./timer.hpp"
#include "./serialize.hpp"
#include "./slab_allocator.hpp"
#include "./timer.hpp"
#include <algorithm>

#ifndef NO_MULTITHREADING
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/barretenberg/common/c_bind.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <cstddef>
#include "./wasm_export.hpp"
#include "./serialize.hpp"
#include "./wasm_export.hpp"
#include <cstddef>

WASM_EXPORT void test_threads(uint32_t const* threads, uint32_t const* iterations, uint32_t* out);

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/barretenberg/common/constexpr_utils.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include <stddef.h>
#include <utility>
#include <tuple>
#include <utility>

/**
* @brief constexpr_utils defines some helper methods that perform some stl-equivalent operations
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/barretenberg/common/container.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once
#include <algorithm>
#include <stddef.h>
#include <vector>
#include <string>
#include <algorithm>
#include <vector>

template <typename C> C slice(C const& container, size_t start)
{
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/barretenberg/common/log.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once
#include <sstream>
#include "barretenberg/env/logstr.hpp"
#include "barretenberg/stdlib/primitives/circuit_builders/circuit_builders_fwd.hpp"
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include "barretenberg/stdlib/primitives/circuit_builders/circuit_builders_fwd.hpp"
#include "barretenberg/env/logstr.hpp"
#include <vector>

#define BENCHMARK_INFO_PREFIX "##BENCHMARK_INFO_PREFIX##"
#define BENCHMARK_INFO_SEPARATOR "#"
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/barretenberg/common/mem.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "./mem.hpp"
#include "./wasm_export.hpp"
#include "./slab_allocator.hpp"
#include "./wasm_export.hpp"

extern "C" {

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/barretenberg/common/parallel_for_atomic_pool.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "thread.hpp"
#include "log.hpp"
#include "thread.hpp"
#include <atomic>
#include <condition_variable>
#include <functional>
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/barretenberg/common/parallel_for_moody.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "barretenberg/common/thread.hpp"
#include "moody/blockingconcurrentqueue.h"
#include "log.hpp"
#include "moody/blockingconcurrentqueue.h"
#include "timer.hpp"
#include <atomic>
#include <condition_variable>
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/barretenberg/common/parallel_for_mutex_pool.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "thread.hpp"
#include "log.hpp"
#include "thread.hpp"
#include <atomic>
#include <condition_variable>
#include <functional>
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/barretenberg/common/parallel_for_queued.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "thread.hpp"
#include "log.hpp"
#include "thread.hpp"
#include <atomic>
#include <condition_variable>
#include <functional>
Expand Down
12 changes: 6 additions & 6 deletions cpp/src/barretenberg/common/serialize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
* - to_buffer
*/
#pragma once
#include <cassert>
#include <array>
#include "barretenberg/common/log.hpp"
#include "barretenberg/common/net.hpp"
#include <type_traits>
#include <vector>
#include <map>
#include <array>
#include <cassert>
#include <iostream>
#include "barretenberg/common/log.hpp"
#include <map>
#include <optional>
#include <type_traits>
#include <vector>

#ifndef __i386__
__extension__ using uint128_t = unsigned __int128;
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/barretenberg/common/slab_allocator.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "slab_allocator.hpp"
#include <barretenberg/common/assert.hpp>
#include <barretenberg/common/log.hpp>
#include <barretenberg/common/mem.hpp>
#include <barretenberg/common/assert.hpp>
#include <numeric>
#include <unordered_map>

Expand Down
8 changes: 4 additions & 4 deletions cpp/src/barretenberg/common/slab_allocator.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once
#include <unordered_map>
#include <map>
#include "./assert.hpp"
#include "./log.hpp"
#include <list>
#include <map>
#include <memory>
#include "./log.hpp"
#include "./assert.hpp"
#include <unordered_map>
#ifndef NO_MULTITHREADING
#include <mutex>
#endif
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/barretenberg/common/streams.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once
#include <iomanip>
#include <ostream>
#include <map>
#include <vector>
#include <optional>
#include <ostream>
#include <vector>

namespace std {

Expand Down
8 changes: 4 additions & 4 deletions cpp/src/barretenberg/common/thread.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once
#include <vector>
#include <thread>
#include <atomic>
#include <functional>
#include <barretenberg/numeric/bitop/get_msb.hpp>
#include <barretenberg/env/hardware_concurrency.hpp>
#include <barretenberg/numeric/bitop/get_msb.hpp>
#include <functional>
#include <thread>
#include <vector>

inline size_t get_num_cpus()
{
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/barretenberg/common/throw_or_abort.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#include <string>
#include "log.hpp"
#include <string>

inline void throw_or_abort [[noreturn]] (std::string const& err)
{
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/barretenberg/common/timer.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once
#include <cstdio>
#include <ctime>
#include <string>
#include <sys/resource.h>
#include <sys/time.h>
#include <ctime>

/**
* @brief Get the execution between a block of code.
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/barretenberg/crypto/aes128/aes128.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "aes128.hpp"

#include "memory.h"
#include <array>
#include <cstddef>
#include <cstdint>
#include <array>
#include "memory.h"

#include <iostream>
namespace crypto {
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/barretenberg/crypto/aes128/aes128.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
* Based off of tiny-AES by @kokke : https://github.com/kokke/tiny-AES-c
**/

#include "memory.h"
#include <array>
#include <cstddef>
#include <cstdint>
#include <array>
#include "memory.h"

#include <iostream>
namespace crypto {
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/barretenberg/crypto/blake2s/blake2s.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
*/
#pragma once

#include <cstdint>
#include <array>
#include <cstddef>
#include <cstdint>
#include <vector>
#include <array>

namespace blake2 {

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/barretenberg/crypto/blake2s/c_bind.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "blake2s.hpp"
#include "barretenberg/ecc/curves/bn254/fr.hpp"
#include "blake2s.hpp"
#include <barretenberg/common/wasm_export.hpp>

using namespace barretenberg;
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/barretenberg/crypto/blake2s/c_bind.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <cstdint>
#include <cstddef>
#include "barretenberg/ecc/curves/bn254/fr.hpp"
#include "barretenberg/common/wasm_export.hpp"
#include "barretenberg/ecc/curves/bn254/fr.hpp"
#include <cstddef>
#include <cstdint>

extern "C" {

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/barretenberg/crypto/blake3s/blake3s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
*/

#include <assert.h>
#include <iostream>
#include <stdbool.h>
#include <string.h>
#include <iostream>
#include <type_traits>

#include "blake3-impl.hpp"
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/barretenberg/crypto/blake3s/blake3s.test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "blake3s.hpp"
#include "../blake2s/blake2s.hpp"
#include "blake3s.hpp"

#include <gtest/gtest.h>

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/barretenberg/crypto/blake3s/c_bind.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "blake3s.hpp"
#include "barretenberg/ecc/curves/bn254/fr.hpp"
#include "blake3s.hpp"

#define WASM_EXPORT __attribute__((visibility("default")))

Expand Down
Loading