Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
89a1292
chore: add graph_description_keccak test (#19575)
nishatkoti Jan 16, 2026
57378e2
chore: update commit hash in blake files in blake audit scope (#19593)
nishatkoti Jan 16, 2026
1dd93eb
Merge branch 'next' into merge-train/barretenberg
Jan 16, 2026
516fdce
Merge branch 'next' into merge-train/barretenberg
Jan 16, 2026
4f8329e
Merge branch 'next' into merge-train/barretenberg
Jan 16, 2026
3633dcd
Merge branch 'next' into merge-train/barretenberg
Jan 16, 2026
329465f
Merge branch 'next' into merge-train/barretenberg
Jan 16, 2026
891745a
Merge branch 'next' into merge-train/barretenberg
Jan 16, 2026
36325a3
feat: enable asserts in WASM builds (#19632)
johnathan79717 Jan 16, 2026
b25b244
chore: remove unnecessary "inputs" structs (#19660)
TomAFrench Jan 16, 2026
71882e7
Merge branch 'next' into merge-train/barretenberg
Jan 16, 2026
62ef976
Merge branch 'next' into merge-train/barretenberg
Jan 16, 2026
57d1acc
Merge branch 'next' into merge-train/barretenberg
Jan 16, 2026
475b608
Merge branch 'next' into merge-train/barretenberg
Jan 16, 2026
b108dde
Merge branch 'next' into merge-train/barretenberg
Jan 16, 2026
97000b1
Merge branch 'next' into merge-train/barretenberg
Jan 16, 2026
a72382f
fix: overflow in wasm assert (#19690)
ledwards2225 Jan 16, 2026
71273af
Merge branch 'next' into merge-train/barretenberg
Jan 16, 2026
0d4e1f8
Merge branch 'next' into merge-train/barretenberg
Jan 16, 2026
95e4c8e
Merge branch 'next' into merge-train/barretenberg
Jan 17, 2026
da34f8a
chore!: sha audit 2 (#19436)
ledwards2225 Jan 17, 2026
7e3b16c
Merge branch 'next' into merge-train/barretenberg
Jan 17, 2026
59a122c
Merge branch 'next' into merge-train/barretenberg
Jan 17, 2026
b7aaebb
chore: add logic audit scope (and add old bigfield scope) (#19680)
suyash67 Jan 17, 2026
ad041f7
Merge branch 'next' into merge-train/barretenberg
Jan 17, 2026
e6ddd21
Merge branch 'next' into merge-train/barretenberg
Jan 18, 2026
52b6275
Merge branch 'next' into merge-train/barretenberg
Jan 19, 2026
705a9c5
Merge branch 'next' into merge-train/barretenberg
Jan 19, 2026
11ac02c
Merge branch 'next' into merge-train/barretenberg
Jan 19, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -1266,6 +1266,47 @@ inline void StaticAnalyzer_<FF, CircuitBuilder>::remove_unnecessary_sha256_plook
}
}

/**
* @brief This method removes false positive cases from keccak lookup tables.
* Tables which are enumerated in keccak_plookup_tables are used by keccak lookup constraints. Some lookup-gate outputs
* are auxiliary (e.g. MSB) and may appear in only one gate but this is not dangerous. So we remove these variables.
* @tparam FF
* @tparam CircuitBuilder
* @param table_id
* @param gate_index
*/
template <typename FF, typename CircuitBuilder>
inline void StaticAnalyzer_<FF, CircuitBuilder>::remove_unnecessary_keccak_plookup_variables(BasicTableId& table_id,
size_t gate_index)
{
auto find_position = [&](uint32_t real_variable_index) {
return variables_in_one_gate.contains(real_variable_index);
};

std::unordered_set<BasicTableId> keccak_plookup_tables{
BasicTableId::KECCAK_INPUT, BasicTableId::KECCAK_OUTPUT, BasicTableId::KECCAK_CHI, BasicTableId::KECCAK_THETA,
BasicTableId::KECCAK_RHO, BasicTableId::KECCAK_RHO_1, BasicTableId::KECCAK_RHO_2, BasicTableId::KECCAK_RHO_3,
BasicTableId::KECCAK_RHO_4, BasicTableId::KECCAK_RHO_5, BasicTableId::KECCAK_RHO_6, BasicTableId::KECCAK_RHO_7,
BasicTableId::KECCAK_RHO_8, BasicTableId::KECCAK_RHO_9
};

auto& lookup_block = circuit_builder.blocks.lookup;

if (keccak_plookup_tables.contains(table_id)) {
uint32_t real_out_idx = this->to_real(lookup_block.w_o()[gate_index]);
uint32_t real_right_idx = this->to_real(lookup_block.w_r()[gate_index]);
if (variables_gate_counts[real_out_idx] != 1 || variables_gate_counts[real_right_idx] != 1) {
bool find_out = find_position(real_out_idx);
auto q_c = lookup_block.q_c()[gate_index];
if (q_c.is_zero()) {
if (find_out) {
variables_in_one_gate.erase(real_out_idx);
}
}
}
}
}

/**
* @brief this method removes false cases in lookup table for a given gate.
* it uses all functions above for lookup tables to remove all variables that appear in one gate,
Expand Down Expand Up @@ -1294,6 +1335,8 @@ inline void StaticAnalyzer_<FF, CircuitBuilder>::process_current_plookup_gate(si
this->remove_unnecessary_aes_plookup_variables(table_id, gate_index);
// false cases for sha256
this->remove_unnecessary_sha256_plookup_variables(table_id, gate_index);
// false cases for keccak
this->remove_unnecessary_keccak_plookup_variables(table_id, gate_index);
// if the amount of unique elements from columns of plookup tables = 1, it means that
// variable from this column aren't used and we can remove it.
if (column_1.size() == 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ template <typename FF, typename CircuitBuilder> class StaticAnalyzer_ {
void remove_unnecessary_range_constrains_variables();
void remove_unnecessary_aes_plookup_variables(bb::plookup::BasicTableId& table_id, size_t gate_index);
void remove_unnecessary_sha256_plookup_variables(bb::plookup::BasicTableId& table_id, size_t gate_index);
void remove_unnecessary_keccak_plookup_variables(bb::plookup::BasicTableId& table_id, size_t gate_index);
void remove_record_witness_variables();

std::unordered_set<uint32_t> get_variables_in_one_gate();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#include "barretenberg/boomerang_value_detection/graph.hpp"

#include "barretenberg/circuit_checker/circuit_checker.hpp"
#include "barretenberg/common/test.hpp"
#include "barretenberg/stdlib/hash/keccak/keccak.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"

#include <array>
#include <unordered_set>

using namespace bb;
using namespace bb::stdlib;
using namespace cdg;

using Builder = UltraCircuitBuilder;
using field_ct = field_t<Builder>;
using witness_ct = witness_t<Builder>;

/**
* @brief Fix witness for an array of field elements
*
* Static analyzer prints variables that only appear in one gate. By fixing witnesses,
* we ensure variables appear in at least 2 gates, filtering out false positives.
*/
template <size_t N> void fix_field_array(std::array<field_ct, N>& arr)
{
for (auto& elem : arr) {
elem.fix_witness();
}
}

TEST(boomerang_stdlib_keccak, test_graph_for_keccakf1600)
{
Builder builder;

// 25-lane input state as witnesses
std::array<field_ct, keccak<Builder>::NUM_KECCAK_LANES> state;
for (size_t i = 0; i < state.size(); ++i) {
state[i] = witness_ct(&builder, static_cast<uint64_t>(i + 1));
}
fix_field_array(state);

auto out_state = keccak<Builder>::permutation_opcode(state, &builder);
fix_field_array(out_state);

// Analyze graph structure
StaticAnalyzer graph(builder);
auto connected_components = graph.find_connected_components();
EXPECT_EQ(connected_components.size(), 1);

auto variables_in_one_gate = graph.get_variables_in_one_gate();
EXPECT_EQ(variables_in_one_gate.size(), 0);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Nishat], commit: 4a956ceb179c2fe855e4f1fd78f2594e7fc3f5ea}
// internal: { status: Complete, auditors: [Nishat], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================
Expand Down Expand Up @@ -154,4 +154,4 @@ static BLAKE2_INLINE void secure_zero_memory(void* v, size_t n)

} // namespace bb::crypto

#endif
#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Nishat], commit: 4a956ceb179c2fe855e4f1fd78f2594e7fc3f5ea}
// internal: { status: Complete, auditors: [Nishat], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Nishat], commit: 4a956ceb179c2fe855e4f1fd78f2594e7fc3f5ea}
// internal: { status: Complete, auditors: [Nishat], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Nishat], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================

#include "blake2s.hpp"
#include <gtest/gtest.h>

Expand Down Expand Up @@ -386,4 +392,4 @@ TEST(misc_blake2s, test_vectors)
std::vector<uint8_t> input(v.input.begin(), v.input.end());
EXPECT_EQ(crypto::blake2s(input), v.output);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Nishat], commit: 4a956ceb179c2fe855e4f1fd78f2594e7fc3f5ea}
// internal: { status: Complete, auditors: [Nishat], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================
Expand Down Expand Up @@ -83,4 +83,4 @@ constexpr void store_cv_words(out_array& bytes_out, key_array& cv_words)

#include "blake3s.tcc"

#endif
#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Nishat], commit: 4a956ceb179c2fe855e4f1fd78f2594e7fc3f5ea}
// internal: { status: Complete, auditors: [Nishat], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Nishat], commit: 4a956ceb179c2fe855e4f1fd78f2594e7fc3f5ea}
// internal: { status: Complete, auditors: [Nishat], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Nishat], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================

#include "blake3s.hpp"

#include <gtest/gtest.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Nishat], commit: 4a956ceb179c2fe855e4f1fd78f2594e7fc3f5ea}
// internal: { status: Complete, auditors: [Nishat], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Nishat], commit: 4a956ceb179c2fe855e4f1fd78f2594e7fc3f5ea}
// internal: { status: Complete, auditors: [Nishat], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Nishat], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================

#include "blake2s_constraint.hpp"
#include "acir_format.hpp"
#include "barretenberg/crypto/blake2s/blake2s.hpp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Nishat], commit: 4a956ceb179c2fe855e4f1fd78f2594e7fc3f5ea}
// internal: { status: Complete, auditors: [Nishat], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Nishat], commit: 4a956ceb179c2fe855e4f1fd78f2594e7fc3f5ea}
// internal: { status: Complete, auditors: [Nishat], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Nishat], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================

#include "blake3_constraint.hpp"
#include "acir_format.hpp"
#include "barretenberg/crypto/blake3s/blake3s.hpp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Nishat], commit: 4a956ceb179c2fe855e4f1fd78f2594e7fc3f5ea}
// internal: { status: Complete, auditors: [Nishat], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Nishat], commit: 4a956ceb179c2fe855e4f1fd78f2594e7fc3f5ea}
// internal: { status: Complete, auditors: [Nishat], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Nishat], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================

#include "barretenberg/crypto/blake2s/blake2s.hpp"
#include "barretenberg/circuit_checker/circuit_checker.hpp"
#include "barretenberg/flavor/ultra_flavor.hpp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Nishat], commit: 4a956ceb179c2fe855e4f1fd78f2594e7fc3f5ea}
// internal: { status: Complete, auditors: [Nishat], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Nishat], commit: 4a956ceb179c2fe855e4f1fd78f2594e7fc3f5ea}
// internal: { status: Complete, auditors: [Nishat], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Nishat], commit: 4a956ceb179c2fe855e4f1fd78f2594e7fc3f5ea}
// internal: { status: Complete, auditors: [Nishat], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Nishat], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================

#include "barretenberg/crypto/blake3s/blake3s.hpp"
#include "barretenberg/circuit_checker/circuit_checker.hpp"
#include "barretenberg/common/assert.hpp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Luke, Raju], commit: 4a956ceb179c2fe855e4f1fd78f2594e7fc3f5ea}
// internal: { status: Complete, auditors: [Luke, Raju], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Nishat], commit: 4a956ceb179c2fe855e4f1fd78f2594e7fc3f5ea}
// internal: { status: Complete, auditors: [Nishat], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Luke, Raju], commit: 4a956ceb179c2fe855e4f1fd78f2594e7fc3f5ea}
// internal: { status: Complete, auditors: [Luke, Raju], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// === AUDIT STATUS ===
// internal: { status: Complete, auditors: [Luke, Raju], commit: 4a956ceb179c2fe855e4f1fd78f2594e7fc3f5ea}
// internal: { status: Complete, auditors: [Luke, Raju], commit: 8fb8b041d4c9179f62da56a9c7bbf22c40db46cc}
// external_1: { status: not started, auditors: [], commit: }
// external_2: { status: not started, auditors: [], commit: }
// =====================
Expand Down