Skip to content
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
64 changes: 4 additions & 60 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ jobs:
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert stdlib_recursion_tests
- *save_logs

tx-rollup-tests:
join-split-tests:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
Expand All @@ -181,55 +181,7 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert rollup_proofs_tx_rollup_tests --gtest_filter=-rollup_full_tests.*
- *save_logs

tx-rollup-full-tests:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
steps:
- *checkout
- *setup_env
- run:
name: "Test"
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert rollup_proofs_tx_rollup_tests --gtest_filter=rollup_full_tests.*
- *save_logs

root-rollup-tests:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
steps:
- *checkout
- *setup_env
- run:
name: "Test"
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert rollup_proofs_root_rollup_tests --gtest_filter=-root_rollup_full_tests.*
- *save_logs

root-rollup-full-tests:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
steps:
- *checkout
- *setup_env
- run:
name: "Test"
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert rollup_proofs_root_rollup_tests --gtest_filter=root_rollup_full_tests.*
- *save_logs

root-verifier-tests:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
steps:
- *checkout
- *setup_env
- run:
name: "Test"
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert rollup_proofs_root_verifier_tests
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert join_split_example_proofs_join_split_tests --gtest_filter=-*full_proof*
- *save_logs

benchmark-aggregator:
Expand Down Expand Up @@ -261,21 +213,13 @@ workflows:
- barretenberg-tests: *bb_test
- stdlib-primitives-tests: *bb_test
- stdlib-recursion-tests: *bb_test
- tx-rollup-tests: *bb_test
- tx-rollup-full-tests: *bb_test
- root-rollup-tests: *bb_test
- root-rollup-full-tests: *bb_test
- root-verifier-tests: *bb_test
- join-split-tests: *bb_test
- benchmark-aggregator:
requires:
- barretenberg-tests
- stdlib-primitives-tests
- stdlib-recursion-tests
- tx-rollup-tests
- tx-rollup-full-tests
- root-verifier-tests
- root-rollup-tests
- root-rollup-full-tests
- join-split-tests
filters:
branches:
only:
Expand Down
8 changes: 2 additions & 6 deletions cpp/dockerfiles/Dockerfile.x86_64-linux-clang
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@ RUN git clone -b release/10.x --depth 1 https://github.com/llvm/llvm-project.git
WORKDIR /usr/src/barretenberg/cpp
COPY . .
# Only build binaries that are needed upstream.
RUN mkdir build && cd build && cmake -DOpenMP_omp_LIBRARY=/usr/local/lib/libomp.a .. && cmake --build . --parallel --target db_cli --target rollup_cli --target tx_factory --target keygen
RUN mkdir build && cd build && cmake -DOpenMP_omp_LIBRARY=/usr/local/lib/libomp.a .. && cmake --build . --parallel

FROM alpine:3.13
RUN apk update && apk add llvm10-libs
COPY --from=builder /usr/src/barretenberg/cpp/srs_db /usr/src/barretenberg/cpp/srs_db
COPY --from=builder /usr/src/barretenberg/cpp/build/bin/db_cli /usr/src/barretenberg/cpp/build/bin/db_cli
COPY --from=builder /usr/src/barretenberg/cpp/build/bin/rollup_cli /usr/src/barretenberg/cpp/build/bin/rollup_cli
COPY --from=builder /usr/src/barretenberg/cpp/build/bin/tx_factory /usr/src/barretenberg/cpp/build/bin/tx_factory
COPY --from=builder /usr/src/barretenberg/cpp/build/bin/keygen /usr/src/barretenberg/cpp/build/bin/keygen
COPY --from=builder /usr/src/barretenberg/cpp/srs_db /usr/src/barretenberg/cpp/srs_db
5 changes: 2 additions & 3 deletions cpp/dockerfiles/Dockerfile.x86_64-linux-gcc
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ RUN apk update \
curl
WORKDIR /usr/src/barretenberg/cpp
COPY . .
# Build the entire project (not just rollup_cli and db_cli), as we want to check everything builds under gcc.
# Build the entire project, as we want to check everything builds under gcc.
RUN mkdir build && cd build && cmake -DTOOLCHAIN=x86_64-linux-gcc -DCI=ON .. && cmake --build . --parallel

FROM alpine:3.13
RUN apk update && apk add libstdc++ libgomp
COPY --from=builder /usr/src/barretenberg/cpp/build/bin/db_cli /usr/src/barretenberg/cpp/build/bin/db_cli
COPY --from=builder /usr/src/barretenberg/cpp/build/bin/rollup_cli /usr/src/barretenberg/cpp/build/bin/rollup_cli
COPY --from=builder /usr/src/barretenberg/cpp/srs_db /usr/src/barretenberg/cpp/srs_db
9 changes: 2 additions & 7 deletions cpp/scripts/bb-tests
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
ci_failsafe_tests
crypto_aes128_tests
crypto_blake2s_tests
crypto_ecdsa_tests
Expand All @@ -9,12 +8,8 @@ ecc_tests
numeric_tests
plonk_tests
polynomials_tests
rollup_proofs_account_tests
rollup_proofs_claim_tests
rollup_proofs_inner_proof_data_tests
rollup_proofs_join_split_tests
rollup_proofs_notes_tests
rollup_proofs_standard_example_tests
join_split_example_proofs_inner_proof_data_tests
join_split_example_proofs_notes_tests
srs_tests
stdlib_aes128_tests
stdlib_blake2s_tests
Expand Down
8 changes: 1 addition & 7 deletions cpp/src/aztec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ add_subdirectory(crypto)
add_subdirectory(polynomials)
add_subdirectory(plonk)
add_subdirectory(stdlib)
add_subdirectory(rollup)
add_subdirectory(join_split_example)

if(BENCHMARKS)
add_subdirectory(benchmark)
Expand Down Expand Up @@ -63,12 +63,6 @@ if(WASM)
$<TARGET_OBJECTS:stdlib_schnorr_objects>
$<TARGET_OBJECTS:stdlib_pedersen_objects>
$<TARGET_OBJECTS:stdlib_blake2s_objects>
# TODO: remove all except those needed for testing (join_split)
$<TARGET_OBJECTS:rollup_proofs_inner_proof_data_objects>
$<TARGET_OBJECTS:rollup_proofs_notes_objects>
$<TARGET_OBJECTS:rollup_proofs_account_objects>
$<TARGET_OBJECTS:rollup_proofs_join_split_objects>
$<TARGET_OBJECTS:rollup_proofs_claim_objects>
)

# With binaryen installed, it seems its wasm backend optimiser gets invoked automatically.
Expand Down
4 changes: 4 additions & 0 deletions cpp/src/aztec/join_split_example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if(NOT WASM)
link_libraries(leveldb)
endif()
add_subdirectory(proofs)
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@
#include <numeric/uint256/uint256.hpp>
#include <ecc/curves/grumpkin/grumpkin.hpp>

namespace rollup {
namespace join_split_example {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the circuit constants for circuits other than join-split can be removed.


constexpr size_t DATA_TREE_DEPTH = 32;
constexpr size_t NULL_TREE_DEPTH = 256;
constexpr size_t ROOT_TREE_DEPTH = 28;
constexpr size_t DEFI_TREE_DEPTH = 30;

constexpr size_t MAX_NO_WRAP_INTEGER_BIT_LENGTH = grumpkin::MAX_NO_WRAP_INTEGER_BIT_LENGTH;
constexpr size_t MAX_TXS_BIT_LENGTH = 10;
Expand All @@ -22,9 +19,6 @@ constexpr size_t MAX_NUM_ASSETS_BIT_LENGTH = 30;
constexpr size_t MAX_NUM_ASSETS = 1 << MAX_NUM_ASSETS_BIT_LENGTH;
constexpr size_t ALIAS_HASH_BIT_LENGTH = 224;

constexpr uint32_t NUM_BRIDGE_CALLS_PER_BLOCK = 32;
constexpr uint32_t NUM_INTERACTION_RESULTS_PER_BLOCK = 32;

namespace circuit_gate_count {

/*
Expand All @@ -36,41 +30,24 @@ is_circuit_change_expected to zero and change the modified circuit gate counts a
constexpr bool is_circuit_change_expected = 0;
/* The below constants are only used for regression testing; to identify accidental changes to circuit
constraints. They need to be changed when there is a circuit change. */
constexpr uint32_t ACCOUNT = 23967;
constexpr uint32_t JOIN_SPLIT = 64047;
constexpr uint32_t CLAIM = 22684;
constexpr uint32_t ROLLUP = 1173221;
constexpr uint32_t ROOT_ROLLUP = 5481327;
constexpr uint32_t ROOT_VERIFIER = 7435892;
}; // namespace circuit_gate_count

namespace circuit_gate_next_power_of_two {
/* The below constants are used in tests to detect undesirable circuit changes. They should not be changed unless we
want to exceed the next power of two limit. */
constexpr uint32_t ACCOUNT = 32768;
constexpr uint32_t JOIN_SPLIT = 65536;
constexpr uint32_t CLAIM = 32768;
constexpr uint32_t ROLLUP = 2097152;
constexpr uint32_t ROOT_ROLLUP = 8388608;
constexpr uint32_t ROOT_VERIFIER = 8388608;
}; // namespace circuit_gate_next_power_of_two

namespace circuit_vk_hash {
/* These below constants are only used for regression testing; to identify accidental changes to circuit
constraints. They need to be changed when there is a circuit change. Note that they are written in the reverse order
to comply with the from_buffer<>() method. */
constexpr auto ACCOUNT = uint256_t(0xcd6d70c733eaf823, 0x6505d3402817ad3d, 0xbf9e2b6a262589cf, 0xafcc546b55cc45e3);
constexpr auto JOIN_SPLIT = uint256_t(0xb23c7772f47bc823, 0x5493625d4f08603c, 0x21ac50a5929576f9, 0xb7b3113c131460e5);
constexpr auto CLAIM = uint256_t(0x878301ebba40ab60, 0x931466762c62d661, 0x40aad71ec3496905, 0x9f47aaa109759d0a);
constexpr auto ROLLUP = uint256_t(0x8712bcbeb11180c5, 0x598412e4f700c484, 0xfe50ad453c8e4288, 0xa7340fac5feb663f);
constexpr auto ROOT_ROLLUP = uint256_t(0xcf2fee21f089b32f, 0x90c6187354cf70d4, 0x3a5a90b8c86d8c64, 0xd55af088ddc86db7);
;
constexpr auto ROOT_VERIFIER =
uint256_t(0xe91df73df393fb5f, 0x99a9fa13abfbb206, 0x2ffe8c891cbde8c2, 0xdcb051e8ca06df5e);
}; // namespace circuit_vk_hash

namespace ProofIds {
enum { PADDING = 0, DEPOSIT = 1, WITHDRAW = 2, SEND = 3, ACCOUNT = 4, DEFI_DEPOSIT = 5, DEFI_CLAIM = 6 };
};

} // namespace rollup
} // namespace join_split_example
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <ecc/curves/grumpkin/grumpkin.hpp>
#include <crypto/schnorr/schnorr.hpp>

namespace rollup {
namespace join_split_example {
namespace fixtures {

typedef crypto::schnorr::key_pair<grumpkin::fr, grumpkin::g1> grumpkin_key_pair;
Expand Down Expand Up @@ -39,4 +39,4 @@ inline user_context create_user_context(numeric::random::Engine* engine = nullpt
}

} // namespace fixtures
} // namespace rollup
} // namespace join_split_example
3 changes: 3 additions & 0 deletions cpp/src/aztec/join_split_example/proofs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
add_subdirectory(inner_proof_data)
add_subdirectory(join_split)
add_subdirectory(notes)
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
? "StandardPlonk" \
: typeid(composer) == typeid(waffle::TurboComposer) ? "TurboPlonk" : "NULLPlonk")

namespace rollup {
namespace join_split_example {
namespace proofs {

struct circuit_data {
Expand Down Expand Up @@ -264,4 +264,4 @@ circuit_data get_circuit_data(std::string const& name,
}

} // namespace proofs
} // namespace rollup
} // namespace join_split_example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
barretenberg_module(
join_split_example_proofs_inner_proof_data
numeric
ecc)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "inner_proof_data.hpp"

namespace rollup {
namespace join_split_example {
namespace proofs {

inner_proof_data::inner_proof_data(std::vector<uint8_t> const& proof_data)
Expand All @@ -24,4 +24,4 @@ inner_proof_data::inner_proof_data(std::vector<uint8_t> const& proof_data)
}

} // namespace proofs
} // namespace rollup
} // namespace join_split_example
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <ecc/curves/grumpkin/grumpkin.hpp>
#include <array>

namespace rollup {
namespace join_split_example {
namespace proofs {

using namespace barretenberg;
Expand Down Expand Up @@ -101,4 +101,4 @@ inline std::ostream& operator<<(std::ostream& os, inner_proof_data const& data)
}

} // namespace proofs
} // namespace rollup
} // namespace join_split_example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <gtest/gtest.h>

using namespace barretenberg;
using namespace rollup::proofs;
using namespace join_split_example::proofs;

namespace {
auto& rand_engine = numeric::random::get_debug_engine();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
barretenberg_module(
rollup_proofs_account
rollup_proofs_inner_proof_data
rollup_proofs_notes
join_split_example_proofs_join_split
join_split_example_proofs_inner_proof_data
join_split_example_proofs_notes
crypto_schnorr
stdlib_blake2s
stdlib_sha256
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

using namespace barretenberg;
using namespace plonk::stdlib::types::turbo;
using namespace rollup::proofs::join_split;
using namespace join_split_example::proofs::join_split;

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

Expand Down
9 changes: 9 additions & 0 deletions cpp/src/aztec/join_split_example/proofs/join_split/c_bind.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <cstdint>

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

extern "C" {

WASM_EXPORT uint32_t join_split__get_new_proving_key_data(uint8_t** output);

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
#include "../notes/native/index.hpp"
#include <stdlib/merkle_tree/hash_path.hpp>

namespace rollup {
namespace join_split_example {
namespace proofs {
namespace join_split {

using namespace rollup::proofs::join_split;
using namespace join_split_example::proofs::join_split;
using namespace plonk::stdlib::types::turbo;
using namespace rollup::proofs::notes::native;
using namespace join_split_example::proofs::notes::native;
using namespace plonk::stdlib::merkle_tree;

join_split_tx noop_tx()
Expand Down Expand Up @@ -73,4 +73,4 @@ circuit_data get_circuit_data(std::shared_ptr<waffle::ReferenceStringFactory> co

} // namespace join_split
} // namespace proofs
} // namespace rollup
} // namespace join_split_example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "join_split_tx.hpp"
#include "../compute_circuit_data.hpp"

namespace rollup {
namespace join_split_example {
namespace proofs {
namespace join_split {

Expand All @@ -14,4 +14,4 @@ circuit_data get_circuit_data(std::shared_ptr<waffle::ReferenceStringFactory> co

} // namespace join_split
} // namespace proofs
} // namespace rollup
} // namespace join_split_example
Loading