Skip to content

Commit

Permalink
fix #2917
Browse files Browse the repository at this point in the history
  • Loading branch information
spypsy committed Oct 18, 2023
2 parents 347ee2f + a07087d commit 6661e67
Show file tree
Hide file tree
Showing 992 changed files with 2,442 additions and 120,649 deletions.
6 changes: 3 additions & 3 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
".": "0.8.14",
"barretenberg": "0.8.14",
"barretenberg/ts": "0.8.14"
".": "0.9.0",
"barretenberg": "0.9.0",
"barretenberg/ts": "0.9.0"
}
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
# Changelog

## [0.9.0](https://github.com/AztecProtocol/aztec-packages/compare/aztec-packages-v0.8.14...aztec-packages-v0.9.0) (2023-10-17)


### ⚠ BREAKING CHANGES

* nuking `PublicToken` and `PrivateAirdropToken` ([#2873](https://github.com/AztecProtocol/aztec-packages/issues/2873))
* Change blake3 to blake2 in private kernel ([#2861](https://github.com/AztecProtocol/aztec-packages/issues/2861))
* nuking private token ([#2822](https://github.com/AztecProtocol/aztec-packages/issues/2822))

### Features

* Add input support for chained transactions ("pending_read_requests" in private kernel circuit) ([#2869](https://github.com/AztecProtocol/aztec-packages/issues/2869)) ([c1dff38](https://github.com/AztecProtocol/aztec-packages/commit/c1dff38c2f878add4f0bcc41ef7d95ac1def19fb))
* Bump msgpack ([#2884](https://github.com/AztecProtocol/aztec-packages/issues/2884)) ([d7b7fb1](https://github.com/AztecProtocol/aztec-packages/commit/d7b7fb1d70cfb6a592d4cf24c0da92ed9acc7d38))
* Contract ts interface to use only aztec.js imports ([#2876](https://github.com/AztecProtocol/aztec-packages/issues/2876)) ([6952a1a](https://github.com/AztecProtocol/aztec-packages/commit/6952a1ab95b1febd0f1767e3560b2a8cc59622d2))
* Download msgpack ([#2885](https://github.com/AztecProtocol/aztec-packages/issues/2885)) ([8ac8beb](https://github.com/AztecProtocol/aztec-packages/commit/8ac8bebaa8dad39df6f3d6f622e215574062ac52))
* Faucet ([#2856](https://github.com/AztecProtocol/aztec-packages/issues/2856)) ([5bad35f](https://github.com/AztecProtocol/aztec-packages/commit/5bad35f3c0b5048511062f40cd5d45d69bf16355))
* Nuking `PublicToken` and `PrivateAirdropToken` ([#2873](https://github.com/AztecProtocol/aztec-packages/issues/2873)) ([c74311d](https://github.com/AztecProtocol/aztec-packages/commit/c74311d97ade2cac419e4a5999d1187b7a2c1473))
* Nuking private token ([#2822](https://github.com/AztecProtocol/aztec-packages/issues/2822)) ([5d93a47](https://github.com/AztecProtocol/aztec-packages/commit/5d93a470122aaddfcbd1e59e54568357df871098)), closes [#2350](https://github.com/AztecProtocol/aztec-packages/issues/2350)


### Bug Fixes

* Aztec node to save outbox adddress to config ([#2867](https://github.com/AztecProtocol/aztec-packages/issues/2867)) ([b6418a6](https://github.com/AztecProtocol/aztec-packages/commit/b6418a6bf225fcc53e250474172da3b047f5e511))
* Create data dir on node boot ([#2864](https://github.com/AztecProtocol/aztec-packages/issues/2864)) ([2d498b3](https://github.com/AztecProtocol/aztec-packages/commit/2d498b352364debf59af940f0a69c453651a4ad0))
* Don't repeatedly scan for missing messages ([#2886](https://github.com/AztecProtocol/aztec-packages/issues/2886)) ([3fe1cc8](https://github.com/AztecProtocol/aztec-packages/commit/3fe1cc857b83c20bdd5701f685334316db34dd85))
* Fix trailing pipe causing everything to rebuild. Sorry... ([d13ba75](https://github.com/AztecProtocol/aztec-packages/commit/d13ba75bf5bdc7c11b848ca9c8a281f9eec6b015))
* Pad L1 to L2 messages upon retrieval from L1 ([#2879](https://github.com/AztecProtocol/aztec-packages/issues/2879)) ([457669e](https://github.com/AztecProtocol/aztec-packages/commit/457669e81d654c0b77fcf2c7bf98eb335f0914ff))
* Sequencer aborts in-progress block ([#2883](https://github.com/AztecProtocol/aztec-packages/issues/2883)) ([b0915a8](https://github.com/AztecProtocol/aztec-packages/commit/b0915a8d618ac2e8d1401c41527af85648e0b2eb))


### Miscellaneous

* Change blake3 to blake2 in private kernel ([#2861](https://github.com/AztecProtocol/aztec-packages/issues/2861)) ([d629940](https://github.com/AztecProtocol/aztec-packages/commit/d62994073d0476bb62fab16c02fdc484da9edc44))
* Clean canary env & fixes ([#2880](https://github.com/AztecProtocol/aztec-packages/issues/2880)) ([20ad577](https://github.com/AztecProtocol/aztec-packages/commit/20ad57795ac3c66e88ac36af8ceca9235ad86e6b))
* Making anvil silent again ([#2866](https://github.com/AztecProtocol/aztec-packages/issues/2866)) ([90ae5dc](https://github.com/AztecProtocol/aztec-packages/commit/90ae5dc0efa93272950c734ad645b418de7a014c))
* Spell check on forbidden words. ([#2887](https://github.com/AztecProtocol/aztec-packages/issues/2887)) ([06bc4f9](https://github.com/AztecProtocol/aztec-packages/commit/06bc4f952e0e3ae853aaef7b2002eea67c1a1ee0))


### Documentation

* Initial 'protocol description' toc ([#2844](https://github.com/AztecProtocol/aztec-packages/issues/2844)) ([cb18f45](https://github.com/AztecProtocol/aztec-packages/commit/cb18f455d02b00b30da20c6afbeb806921b3a1cf))

## [0.8.14](https://github.com/AztecProtocol/aztec-packages/compare/aztec-packages-v0.8.13...aztec-packages-v0.8.14) (2023-10-13)


Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.8.14 x-release-please-version
v0.9.0 x-release-please-version
4 changes: 2 additions & 2 deletions barretenberg/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/AztecProtocol/barretenberg
branch = master
commit = 9d92a4b81285f38b4195b05cafdd6bc887be23d5
parent = cd253a8f0742348141e7102d247d786ca1d48d6d
commit = 491aa9d0f86d0b19b05d0805bfe3dbcccb249472
parent = a60c70dca1d920ad88511f77be3ad186afab7bdb
method = merge
cmdver = 0.4.6
8 changes: 8 additions & 0 deletions barretenberg/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [0.9.0](https://github.com/AztecProtocol/aztec-packages/compare/barretenberg-v0.8.14...barretenberg-v0.9.0) (2023-10-17)


### Features

* Bump msgpack ([#2884](https://github.com/AztecProtocol/aztec-packages/issues/2884)) ([d7b7fb1](https://github.com/AztecProtocol/aztec-packages/commit/d7b7fb1d70cfb6a592d4cf24c0da92ed9acc7d38))
* Download msgpack ([#2885](https://github.com/AztecProtocol/aztec-packages/issues/2885)) ([8ac8beb](https://github.com/AztecProtocol/aztec-packages/commit/8ac8bebaa8dad39df6f3d6f622e215574062ac52))

## [0.8.14](https://github.com/AztecProtocol/aztec-packages/compare/barretenberg-v0.8.13...barretenberg-v0.8.14) (2023-10-13)


Expand Down
2 changes: 1 addition & 1 deletion barretenberg/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.8.14 x-release-please-version
v0.9.0 x-release-please-version
3 changes: 2 additions & 1 deletion barretenberg/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.24)
project(
Barretenberg
DESCRIPTION "BN254 elliptic curve library, and PLONK SNARK prover"
VERSION 0.8.14 # x-release-please-version
VERSION 0.9.0 # x-release-please-version
LANGUAGES CXX C
)
# Insert version into `bb` config file
Expand Down Expand Up @@ -141,6 +141,7 @@ include(cmake/threading.cmake)
include(cmake/gtest.cmake)
include(cmake/benchmark.cmake)
include(cmake/module.cmake)
include(cmake/msgpack.cmake)
add_subdirectory(src)
if (ENABLE_ASAN AND NOT(FUZZING))
find_program(LLVM_SYMBOLIZER_PATH NAMES llvm-symbolizer-16)
Expand Down
10 changes: 10 additions & 0 deletions barretenberg/cpp/cmake/module.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ function(barretenberg_module MODULE_NAME)
${ARGN}
${TBB_IMPORTED_TARGETS}
)

# enable msgpack downloading via dependency (solves race condition)
add_dependencies(${MODULE_NAME} msgpack-c)
add_dependencies(${MODULE_NAME}_objects msgpack-c)
list(APPEND lib_targets ${MODULE_NAME})

set(MODULE_LINK_NAME ${MODULE_NAME})
Expand Down Expand Up @@ -117,6 +121,9 @@ function(barretenberg_module MODULE_NAME)
${TBB_IMPORTED_TARGETS}
)

# enable msgpack downloading via dependency (solves race condition)
add_dependencies(${MODULE_NAME}_test_objects msgpack-c)
add_dependencies(${MODULE_NAME}_tests msgpack-c)
if(NOT WASM AND NOT CI)
# If collecting coverage data, set profile
# For some reason processor affinity doesn't work, so the developer has to set it manually anyway
Expand Down Expand Up @@ -219,6 +226,9 @@ function(barretenberg_module MODULE_NAME)
${TBB_IMPORTED_TARGETS}
)

# enable msgpack downloading via dependency (solves race condition)
add_dependencies(${MODULE_NAME}_bench_objects msgpack-c)
add_dependencies(${MODULE_NAME}_bench msgpack-c)
add_custom_target(
run_${MODULE_NAME}_bench
COMMAND ${MODULE_NAME}_bench
Expand Down
16 changes: 16 additions & 0 deletions barretenberg/cpp/cmake/msgpack.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
include(ExternalProject)

# External project: Download msgpack-c from GitHu
set(MSGPACK_PREFIX "${CMAKE_BINARY_DIR}/_deps/msgpack-c")
set(MSGPACK_INCLUDE "${MSGPACK_PREFIX}/src/msgpack-c/include")

ExternalProject_Add(
msgpack-c
PREFIX ${MSGPACK_PREFIX}
GIT_REPOSITORY "https://github.com/AztecProtocol/msgpack-c.git"
GIT_TAG af447c28f0bafe761290a72754212436e530941b
CONFIGURE_COMMAND "" # No configure step
BUILD_COMMAND "" # No build step
INSTALL_COMMAND "" # No install step
UPDATE_COMMAND "" # No update step
)
5 changes: 2 additions & 3 deletions barretenberg/cpp/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@ if(WASM)
add_link_options(-Wl,--export-memory,--import-memory,--stack-first,-z,stack-size=1048576,--max-memory=4294967296)
endif()

include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/msgpack-c/include)

include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${MSGPACK_INCLUDE})

# I feel this should be limited to ecc, however it's currently used in headers that go across libraries,
# and there currently isn't an easy way to inherit the DDISABLE_SHENANIGANS parameter.
if(DISABLE_ASM)
message(STATUS "Using fallback non-assembly methods for field multiplications.")
message("Using fallback non-assembly methods for field multiplications.")
add_definitions(-DDISABLE_SHENANIGANS=1)
else()
message(STATUS "Using optimized assembly for field arithmetic.")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "barretenberg/polynomials/barycentric.hpp"
#include "barretenberg/ecc/curves/bn254/fr.hpp"
#include "barretenberg/polynomials/univariate.hpp"
#include <benchmark/benchmark.h>

using namespace benchmark;
Expand All @@ -17,9 +17,8 @@ namespace proof_system::benchmark {
void extend_2_to_6(State& state) noexcept
{
auto univariate = Univariate<FF, 2>::get_random();
BarycentricData<FF, 2, 6> barycentric_2_to_6;
for (auto _ : state) {
DoNotOptimize(barycentric_2_to_6.extend(univariate));
DoNotOptimize(univariate.extend_to<6>());
}
}
BENCHMARK(extend_2_to_6);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,15 @@ using FF = barretenberg::fr;

template <typename Flavor, typename Relation> void execute_relation(::benchmark::State& state)
{
// Generate beta and gamma
auto beta = FF::random_element();
auto gamma = FF::random_element();
auto public_input_delta = FF::random_element();

RelationParameters<FF> params{
.beta = beta,
.gamma = gamma,
.public_input_delta = public_input_delta,
};

using AllValues = typename Flavor::AllValues;
using ArrayOfValuesOverSubrelations = typename Relation::ArrayOfValuesOverSubrelations;
using SumcheckArrayOfValuesOverSubrelations = typename Relation::SumcheckArrayOfValuesOverSubrelations;

auto params = proof_system::RelationParameters<FF>::get_random();

// Extract an array containing all the polynomial evaluations at a given row i
AllValues new_value;
// Define the appropriate ArrayOfValuesOverSubrelations type for this relation and initialize to zero
ArrayOfValuesOverSubrelations accumulator;
// Define the appropriate SumcheckArrayOfValuesOverSubrelations type for this relation and initialize to zero
SumcheckArrayOfValuesOverSubrelations accumulator;
// Evaluate each constraint in the relation and check that each is satisfied

for (auto _ : state) {
Expand Down
26 changes: 17 additions & 9 deletions barretenberg/cpp/src/barretenberg/honk/flavor/ecc_vm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ template <typename CycleGroup_T, typename Curve_T, typename PCS_T> class ECCVMBa
// static_assert(instantiate_barycentric_utils<FF, MAX_RANDOM_RELATION_LENGTH>());

// define the containers for storing the contributions from each relation in Sumcheck
using TupleOfTuplesOfUnivariates = decltype(create_relation_univariates_container<FF, Relations>());
using TupleOfArraysOfValues = decltype(create_relation_values_container<FF, Relations>());
using SumcheckTupleOfTuplesOfUnivariates = decltype(create_sumcheck_tuple_of_tuples_of_univariates<Relations>());
using TupleOfArraysOfValues = decltype(create_sumcheck_tuple_of_arrays_of_values<Relations>());

private:
/**
Expand Down Expand Up @@ -656,7 +656,8 @@ template <typename CycleGroup_T, typename Curve_T, typename PCS_T> class ECCVMBa
using FoldedPolynomials = AllEntities<std::vector<FF>, PolynomialHandle>;

/**
* @brief A field element for each entity of the flavor.
* @brief A field element for each entity of the flavor. These entities represent the prover polynomials evaluated
* at one point.
*/
class AllValues : public AllEntities<FF, FF> {
public:
Expand All @@ -678,7 +679,7 @@ template <typename CycleGroup_T, typename Curve_T, typename PCS_T> class ECCVMBa
*/
class AllPolynomials : public AllEntities<Polynomial, PolynomialHandle> {
public:
AllValues get_row(const size_t row_idx)
AllValues get_row(const size_t row_idx) const
{
AllValues result;
size_t column_idx = 0; // // TODO(https://github.com/AztecProtocol/barretenberg/issues/391) zip
Expand Down Expand Up @@ -711,19 +712,26 @@ template <typename CycleGroup_T, typename Curve_T, typename PCS_T> class ECCVMBa
}
};

/**
* @brief A container for univariates used during sumcheck.
*/
template <size_t LENGTH>
using ProverUnivariates = AllEntities<barretenberg::Univariate<FF, LENGTH>, barretenberg::Univariate<FF, LENGTH>>;

/**
* @brief A container for univariates produced during the hot loop in sumcheck.
* @todo TODO(#390): Simplify this by moving MAX_RELATION_LENGTH?
*/
template <size_t MAX_RELATION_LENGTH>
using ExtendedEdges = AllEntities<barretenberg::Univariate<FF, MAX_RELATION_LENGTH>,
barretenberg::Univariate<FF, MAX_RELATION_LENGTH>>;
using ExtendedEdges = ProverUnivariates<MAX_RELATION_LENGTH>;

/**
* @brief A container for polynomials handles; only stores spans.
* @brief A container for the prover polynomials handles; only stores spans.
*/
class ProverPolynomials : public AllEntities<PolynomialHandle, PolynomialHandle> {
public:
/**
* @brief Returns the evaluations of all prover polynomials at one point on the boolean hypercube, which
* represents one row in the execution trace.
*/
AllValues get_row(const size_t row_idx)
{
AllValues result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ TEST(Flavor, Getters)

Flavor::VerificationKey verification_key;
Flavor::ProverPolynomials prover_polynomials;
Flavor::ExtendedEdges<Flavor::NUM_ALL_ENTITIES> edges;
Flavor::AllValues evals;
Flavor::CommitmentLabels commitment_labels;

Expand Down
47 changes: 33 additions & 14 deletions barretenberg/cpp/src/barretenberg/honk/flavor/goblin_ultra.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ class GoblinUltra {
static constexpr size_t MAX_RANDOM_RELATION_LENGTH = MAX_RELATION_LENGTH + 1;
static constexpr size_t NUM_RELATIONS = std::tuple_size<Relations>::value;

// define the container for storing the univariate contribution from each relation in Sumcheck
using TupleOfTuplesOfUnivariates = decltype(create_relation_univariates_container<FF, Relations>());
using TupleOfArraysOfValues = decltype(create_relation_values_container<FF, Relations>());
template <size_t NUM_INSTANCES>
using ProtogalaxyTupleOfTuplesOfUnivariates =
decltype(create_protogalaxy_tuple_of_tuples_of_univariates<Relations, NUM_INSTANCES>());
using SumcheckTupleOfTuplesOfUnivariates = decltype(create_sumcheck_tuple_of_tuples_of_univariates<Relations>());
using TupleOfArraysOfValues = decltype(create_sumcheck_tuple_of_arrays_of_values<Relations>());

// Whether or not the first row of the execution trace is reserved for 0s to enable shifts
static constexpr bool has_zero_row = true;
Expand Down Expand Up @@ -302,11 +304,6 @@ class GoblinUltra {
*/
using VerificationKey = VerificationKey_<PrecomputedEntities<Commitment, CommitmentHandle>>;

/**
* @brief A container for polynomials handles; only stores spans.
*/
using ProverPolynomials = AllEntities<PolynomialHandle, PolynomialHandle>;

/**
* @brief A container for storing the partially evaluated multivariates produced by sumcheck.
*/
Expand All @@ -323,16 +320,21 @@ class GoblinUltra {
}
};

/**
* @brief A container for univariates used during Protogalaxy folding and sumcheck.
* @details During folding and sumcheck, the prover evaluates the relations on these univariates.
*/
template <size_t LENGTH>
using ProverUnivariates = AllEntities<barretenberg::Univariate<FF, LENGTH>, barretenberg::Univariate<FF, LENGTH>>;

/**
* @brief A container for univariates produced during the hot loop in sumcheck.
* @todo TODO(#390): Simplify this by moving MAX_RELATION_LENGTH?
*/
template <size_t MAX_RELATION_LENGTH>
using ExtendedEdges = AllEntities<barretenberg::Univariate<FF, MAX_RELATION_LENGTH>,
barretenberg::Univariate<FF, MAX_RELATION_LENGTH>>;
using ExtendedEdges = ProverUnivariates<MAX_RELATION_LENGTH>;

/**
* @brief A field element for each entity of the flavor.
* @brief A field element for each entity of the flavor. These entities represent the prover polynomials evaluated
* at one point.
*/
class AllValues : public AllEntities<FF, FF> {
public:
Expand All @@ -341,6 +343,23 @@ class GoblinUltra {
AllValues(std::array<FF, NUM_ALL_ENTITIES> _data_in) { this->_data = _data_in; }
};

/**
* @brief A container for the prover polynomials handles; only stores spans.
*/
class ProverPolynomials : public AllEntities<PolynomialHandle, PolynomialHandle> {
public:
AllValues get_row(const size_t row_idx) const
{
AllValues result;
size_t column_idx = 0; // TODO(https://github.com/AztecProtocol/barretenberg/issues/391) zip
for (auto& column : this->_data) {
result[column_idx] = column[row_idx];
column_idx++;
}
return result;
}
};

/**
* @brief A container for commitment labels.
* @note It's debatable whether this should inherit from AllEntities. since most entries are not strictly needed. It
Expand Down Expand Up @@ -429,7 +448,7 @@ class GoblinUltra {

class FoldingParameters {
public:
FF gate_separation_challenge;
std::vector<FF> gate_separation_challenges;
FF target_sum;
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ template <typename BuilderType> class GoblinUltraRecursive_ {
static constexpr size_t NUM_RELATIONS = std::tuple_size<Relations>::value;

// define the container for storing the univariate contribution from each relation in Sumcheck
using TupleOfTuplesOfUnivariates = decltype(create_relation_univariates_container<FF, Relations>());
using TupleOfArraysOfValues = decltype(create_relation_values_container<FF, Relations>());
using SumcheckTupleOfTuplesOfUnivariates = decltype(create_sumcheck_tuple_of_tuples_of_univariates<Relations>());
using TupleOfArraysOfValues = decltype(create_sumcheck_tuple_of_arrays_of_values<Relations>());

private:
template <typename DataType, typename HandleType>
Expand Down Expand Up @@ -343,7 +343,8 @@ template <typename BuilderType> class GoblinUltraRecursive_ {
};

/**
* @brief A field element for each entity of the flavor.
* @brief A field element for each entity of the flavor. These entities represent the prover polynomials evaluated
* at one point.
*/
class AllValues : public AllEntities<FF, FF> {
public:
Expand Down
Loading

0 comments on commit 6661e67

Please sign in to comment.