Skip to content

Commit

Permalink
chore: stop calling public kernel tail
Browse files Browse the repository at this point in the history
  • Loading branch information
dbanks12 committed Nov 14, 2024
1 parent e305f48 commit 1ff73fb
Show file tree
Hide file tree
Showing 650 changed files with 56,506 additions and 10,323 deletions.
9 changes: 1 addition & 8 deletions .github/ci-setup-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,11 @@ runs:
echo HOME=$RUN_HOME >> $GITHUB_ENV
mkdir -p $RUN_HOME
- name: Cache Submodules
id: cache-submodules
uses: actions/cache@v4
with:
path: .git/modules
key: submodules-${{ hashFiles('.gitmodules') }}-spot-ebs

- name: Checkout Submodules
shell: bash
run: |
git config --global --add safe.directory '*'
git submodule sync --recursive && git submodule update --init --recursive
git submodule update --init --recursive
# TODO reconsider how jq gets into image
- name: Setup jq
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/publish-aztec-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,11 @@ jobs:
working-directory: ./aztec-up/terraform
run: |
terraform init
TAG=${{ env.DEPLOY_TAG }}
if [ "${{ github.ref_name }}" == "master" ]; then
TAG=master
else
TAG=${{ env.DEPLOY_TAG }}
fi
export TF_VAR_VERSION=${TAG#aztec-packages-v}
terraform apply -auto-approve
Expand Down
20 changes: 10 additions & 10 deletions avm-transpiler/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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 = c76755f0cba150633949c40506aa53dd4c7e9ec8
parent = 32a546cbabee6570a3e84bbd15cf0ab3dd58f9a3
commit = e13d72485ea6fc45715ce424b2e1a88f7d21376e
parent = 5997c823077d686107408caa8b4d148e115b62ac
method = merge
cmdver = 0.4.6
2 changes: 1 addition & 1 deletion barretenberg/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ option(DISABLE_AZTEC_VM "Don't build Aztec VM (acceptable if iterating on core p
option(MULTITHREADING "Enable multi-threading" ON)
option(OMP_MULTITHREADING "Enable OMP multi-threading" OFF)
option(FUZZING "Build ONLY fuzzing harnesses" OFF)
option(ENABLE_PAR_ALGOS "Enable parallel algorithms" ON)
option(ENABLE_PAR_ALGOS "Enable parallel algorithms" OFF)
option(COVERAGE "Enable collecting coverage from tests" OFF)
option(ENABLE_ASAN "Address sanitizer for debugging tricky memory corruption" OFF)
option(ENABLE_HEAVY_TESTS "Enable heavy tests when collecting coverage" OFF)
Expand Down
13 changes: 9 additions & 4 deletions barretenberg/cpp/pil/avm/alu.pil
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,21 @@ namespace alu(256);
pol commit cmp_gadget_input_b;
pol commit cmp_gadget_result;
pol commit cmp_gadget_gt;
pol commit cmp_gadget_non_ff_gt;

// We use the comparison gadget to test GT for the following operations
cmp_gadget_gt = op_lt + op_lte + op_div + op_shr + op_shl;
pol CMP_GADGET_GT = op_lt + op_lte + op_div + op_shr + op_shl;
cmp_gadget_gt = CMP_GADGET_GT * ff_tag;
cmp_gadget_non_ff_gt = CMP_GADGET_GT * (1 - ff_tag);

// The cmp gadget is on when we are either testing GT or EQ
cmp_gadget_sel - (cmp_gadget_gt + op_eq) = 0;
cmp_gadget_sel - (cmp_gadget_gt + op_eq + cmp_gadget_non_ff_gt) = 0;

// Permutation to the Comparison Gadget
#[PERM_CMP_ALU]
cmp.sel_cmp {cmp.clk, cmp.input_a, cmp.input_b, cmp.result, cmp.op_eq, cmp.op_gt}
cmp.sel_cmp {cmp.clk, cmp.input_a, cmp.input_b, cmp.result, cmp.op_eq, cmp.op_gt, cmp.op_non_ff_gt}
is
cmp_gadget_sel {clk, cmp_gadget_input_a, cmp_gadget_input_b, cmp_gadget_result, op_eq, cmp_gadget_gt };
cmp_gadget_sel {clk, cmp_gadget_input_a, cmp_gadget_input_b, cmp_gadget_result, op_eq, cmp_gadget_gt, cmp_gadget_non_ff_gt };


// =============== HELPER POLYNOMIAL RELATIONS =================================================
Expand Down Expand Up @@ -143,6 +147,7 @@ namespace alu(256);

// This holds the product over the integers
// (u1 multiplication only cares about a_lo and b_lo)
// TODO(9937): The following is not well constrained as this expression overflows the field.
pol PRODUCT = a_lo * b_lo + (1 - u1_tag) * (LIMB_BITS_POW * partial_prod_lo + MAX_BITS_POW * (partial_prod_hi + a_hi * b_hi));

// =============== ADDITION/SUBTRACTION Operation Constraints =================================================
Expand Down
21 changes: 20 additions & 1 deletion barretenberg/cpp/pil/avm/gadgets/cmp.pil
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,25 @@ namespace cmp(256);
pol commit input_b;
pol commit result;

// ========= NON FF GT Short-circuit computation ===============================
// If this is a non-ff check, we can short circuit (a > b) by checking
// 0 < a - b - 1 < 2**128 --> i.e. we just check we dont underlow which for "small" sized 128-bit number is just a
// single 128 bit range check
// This will be constrained by the calling function - maybe through instruction decomposition
pol commit op_non_ff_gt;
// Value of a - b
pol commit diff;

pol A_GT_B = input_a - input_b - 1;
pol B_GTE_A = input_b - input_a;
op_non_ff_gt * (diff - (A_GT_B * result) - (B_GTE_A * (1 - result))) = 0;

#[PERM_RNG_NON_FF_CMP]
range_check.cmp_non_ff_rng_chk {range_check.clk, range_check.value}
is
op_non_ff_gt {range_chk_clk, diff};

// ========= FF GT computation ===============================
// We range check two columns per row of the cmp gadget, the lo and hi bit ranges resp.
#[PERM_RNG_CMP_LO]
range_check.cmp_lo_bits_rng_chk {range_check.clk, range_check.value}
Expand All @@ -32,7 +51,7 @@ namespace cmp(256);
pol commit op_eq;
pol commit op_gt;

sel_cmp = op_eq + op_gt;
sel_cmp = op_eq + op_gt + op_non_ff_gt;

// There are some standardised constraints on this gadget
// The result is always a boolean
Expand Down
3 changes: 3 additions & 0 deletions barretenberg/cpp/pil/avm/gadgets/range_check.pil
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ namespace range_check(256);
// We range check 128 bits in the cmp trace
cmp_lo_bits_rng_chk * (rng_chk_bits - 128) = 0;
cmp_hi_bits_rng_chk * (rng_chk_bits - 128) = 0;
// For non FF
pol commit cmp_non_ff_rng_chk;
cmp_non_ff_rng_chk * (rng_chk_bits - 128) = 0;

// ==== ALU TRACE RANGE CHECKS ====
pol commit alu_rng_chk;
1 change: 0 additions & 1 deletion barretenberg/cpp/pil/avm/gas.pil
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ namespace main(256);
// We range check that the absolute value of the differences between each row of l2 and da gas are 32 bits.
pol commit l2_gas_u16_r0;
pol commit l2_gas_u16_r1;
// Do we need DA?
main.abs_l2_rem_gas = l2_gas_u16_r0 + l2_gas_u16_r1 * 2**16;

#[LOOKUP_L2_GAS_RNG_CHK_0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,15 @@ template <class Curve> class CommitmentKey {
// Percentage of constant coefficients below which we resort to the conventional commit method
constexpr size_t CONSTANT_THRESHOLD = 50;

// Compute the active range complement over which the polynomial is assumed to be constant within each range
// Compute the active range complement over which the polynomial is assumed to be constant within each range.
// Note: the range from the end of the last active range to the end of the polynomial is excluded from the
// complement since the polynomial is assumed to be zero there.
std::vector<std::pair<size_t, size_t>> active_ranges_complement;
for (size_t i = 0; i < active_ranges.size() - 1; ++i) {
const size_t start = active_ranges[i].second;
const size_t end = active_ranges[i + 1].first;
active_ranges_complement.emplace_back(start, end);
}
// Final complement range goes from end of last active range to the end of the polynomial
active_ranges_complement.emplace_back(active_ranges.back().second, polynomial.end_index());

// Compute the total number of scalars in the constant regions
size_t total_num_complement_scalars = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,19 @@ template <typename Curve> class CommitmentKeyTest : public ::testing::Test {
polynomial.at(idx) = Fr::random_element();
}
start_idx += fixed_size;
if (non_zero_complement) { // fill complement with random constant value
}

// If non_zero_complement, populate the space between active regions with a random constant value
if (non_zero_complement) {
for (size_t i = 0; i < active_range_endpoints.size() - 1; ++i) {
const size_t start = active_range_endpoints[i].second;
const size_t end = active_range_endpoints[i + 1].first;
Fr const_val = Fr::random_element();
for (size_t idx = end_idx; idx < start_idx; ++idx) {
for (size_t idx = start; idx < end; ++idx) {
polynomial.at(idx) = const_val;
}
}
}
// fill complement region between end of last fixed block and end of polynomial
if (non_zero_complement) {
Fr const_val = polynomial[active_range_endpoints.back().second];
for (size_t i = active_range_endpoints.back().second; i < polynomial.end_index(); ++i) {
polynomial.at(i) = const_val;
}
}

return { polynomial, active_range_endpoints };
}
Expand Down
1 change: 1 addition & 0 deletions barretenberg/cpp/src/barretenberg/common/zip_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ static_assert(__cplusplus >= 201703L,
" must be c++17 or greater"); // could be rewritten in c++11, but the features you must use will be buggy
// in an older compiler anyways.
#include "barretenberg/common/assert.hpp"
#include <algorithm>
#include <cassert>
#include <functional>
#include <iostream>
Expand Down
Loading

0 comments on commit 1ff73fb

Please sign in to comment.