Skip to content

Commit

Permalink
feat: Sort includes (AztecProtocol/barretenberg#571)
Browse files Browse the repository at this point in the history
  • Loading branch information
codygunton authored Jul 4, 2023
1 parent 7856b03 commit 3c302e6
Show file tree
Hide file tree
Showing 423 changed files with 966 additions and 971 deletions.
2 changes: 1 addition & 1 deletion barretenberg/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 barretenberg/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
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
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
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 barretenberg/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 barretenberg/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 barretenberg/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
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 barretenberg/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 barretenberg/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 barretenberg/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
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
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
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
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 barretenberg/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
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 barretenberg/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 barretenberg/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 barretenberg/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
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 barretenberg/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 barretenberg/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 barretenberg/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 barretenberg/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
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 barretenberg/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
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
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
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

0 comments on commit 3c302e6

Please sign in to comment.