Skip to content

Commit 9f914e1

Browse files
authored
Merge branch 'v5' into charlie/fix-bb-socket-startup-timeout
2 parents a5db02d + 3ffc13a commit 9f914e1

119 files changed

Lines changed: 2633 additions & 1262 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "5.0.1"
2+
".": "5.1.0"
33
}

CLAUDE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ When staging files, prefer `git add -u` or name specific files rather than `git
5757
Never bulk-update lockfiles (`Cargo.lock`, `yarn.lock`). Use targeted updates only: `cargo update --precise <version> --package <name>` for Rust, and `yarn up <package>@<version>` in the relevant workspace for TypeScript. Bulk updates drag in unrelated transitive changes that make review impossible and frequently break reproducibility.
5858
</lockfile_discipline>
5959

60+
<standard_contract_repin>
61+
Never run `noir-projects/noir-contracts/bootstrap.sh pin-standard-build` on your own initiative. The pin exists so ordinary source or bytecode changes do NOT move the standard contracts' canonical addresses, and CI does not fail when the bytecode drifts. A re-pin is a deliberate redeploy decision for a human to make: if a change seems to need one, leave the pin, rebuild against it, and ask. See the comment on `pin-standard-build` for why re-pinning is breaking.
62+
</standard_contract_repin>
63+
6064
</git_workflow>
6165

6266
<code_formatting>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
30325f8d3e30771a
1+
f19b76f7fa0ff0cd

barretenberg/cpp/src/barretenberg/circuit_checker/ultra_circuit_builder_lookup.test.cpp

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include <gtest/gtest.h>
66
#include <unordered_map>
7+
#include <unordered_set>
78

89
using namespace bb;
910

@@ -121,6 +122,47 @@ TEST_F(UltraCircuitBuilderLookup, DifferentTablesGetUniqueIndices)
121122
EXPECT_EQ(builder.get_num_lookup_tables(), 3UL);
122123
}
123124

125+
// Every basic table reachable through any MultiTable must receive a unique, positive circuit-local
126+
// table_index. The LogDeriv lookup relation identifies a table solely by table_index (not BasicTableId),
127+
// so a generator that stores anything other than the builder-assigned index silently collapses distinct tables to one
128+
// identity. This sweeps the whole table space so any such generator is caught.
129+
TEST_F(UltraCircuitBuilderLookup, AllMultiTableBasicTablesGetUniquePositiveIndices)
130+
{
131+
Builder builder;
132+
for (size_t mt = 0; mt < static_cast<size_t>(plookup::MultiTableId::NUM_MULTI_TABLES); ++mt) {
133+
const auto& multitable = plookup::get_multitable(static_cast<plookup::MultiTableId>(mt));
134+
for (const auto id : multitable.basic_table_ids) {
135+
builder.get_table(id);
136+
}
137+
}
138+
139+
std::unordered_set<size_t> seen;
140+
for (const auto& table : builder.get_lookup_tables()) {
141+
EXPECT_GT(table.table_index, 0UL) << "non-positive index for basic table id " << static_cast<size_t>(table.id);
142+
EXPECT_TRUE(seen.insert(table.table_index).second)
143+
<< "duplicate table_index " << table.table_index << " for basic table id " << static_cast<size_t>(table.id);
144+
}
145+
EXPECT_NO_THROW(builder.finalize_circuit());
146+
}
147+
148+
TEST_F(UltraCircuitBuilderLookup, FinalizationRejectsDuplicateTableIndices)
149+
{
150+
Builder builder;
151+
builder.get_table(plookup::BasicTableId::UINT_XOR_SLICE_6_ROTATE_0);
152+
builder.get_table(plookup::BasicTableId::UINT_AND_SLICE_6_ROTATE_0);
153+
builder.get_lookup_tables()[1].table_index = builder.get_lookup_tables()[0].table_index;
154+
155+
EXPECT_THROW_OR_ABORT(builder.finalize_circuit(), "Lookup table indices must be unique within a circuit");
156+
}
157+
158+
TEST_F(UltraCircuitBuilderLookup, FinalizationRejectsZeroTableIndex)
159+
{
160+
Builder builder;
161+
builder.get_table(plookup::BasicTableId::UINT_XOR_SLICE_6_ROTATE_0).table_index = 0;
162+
163+
EXPECT_THROW_OR_ABORT(builder.finalize_circuit(), "Lookup table indices must be positive");
164+
}
165+
124166
// Verifies correct behavior when key_b_index is not provided (2-to-1 lookup without second index)
125167
TEST_F(UltraCircuitBuilderLookup, NoKeyBIndex)
126168
{

barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/plookup_tables.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,22 +285,22 @@ BasicTable create_basic_table(const BasicTableId id, const size_t index)
285285
if (id_var >= static_cast<size_t>(SECP256R1_FIXED_BASE_XLO_0) &&
286286
id_var < static_cast<size_t>(SECP256R1_FIXED_BASE_XHI_0)) {
287287
return secp256r1_fixed_base::table::generate_basic_table_runtime<secp256r1_fixed_base::table::AXIS_XLO>(
288-
id, id_var - static_cast<size_t>(SECP256R1_FIXED_BASE_XLO_0));
288+
id, id_var - static_cast<size_t>(SECP256R1_FIXED_BASE_XLO_0), index);
289289
}
290290
if (id_var >= static_cast<size_t>(SECP256R1_FIXED_BASE_XHI_0) &&
291291
id_var < static_cast<size_t>(SECP256R1_FIXED_BASE_YLO_0)) {
292292
return secp256r1_fixed_base::table::generate_basic_table_runtime<secp256r1_fixed_base::table::AXIS_XHI>(
293-
id, id_var - static_cast<size_t>(SECP256R1_FIXED_BASE_XHI_0));
293+
id, id_var - static_cast<size_t>(SECP256R1_FIXED_BASE_XHI_0), index);
294294
}
295295
if (id_var >= static_cast<size_t>(SECP256R1_FIXED_BASE_YLO_0) &&
296296
id_var < static_cast<size_t>(SECP256R1_FIXED_BASE_YHI_0)) {
297297
return secp256r1_fixed_base::table::generate_basic_table_runtime<secp256r1_fixed_base::table::AXIS_YLO>(
298-
id, id_var - static_cast<size_t>(SECP256R1_FIXED_BASE_YLO_0));
298+
id, id_var - static_cast<size_t>(SECP256R1_FIXED_BASE_YLO_0), index);
299299
}
300300
if (id_var >= static_cast<size_t>(SECP256R1_FIXED_BASE_YHI_0) &&
301301
id_var < static_cast<size_t>(SECP256R1_FIXED_BASE_END)) {
302302
return secp256r1_fixed_base::table::generate_basic_table_runtime<secp256r1_fixed_base::table::AXIS_YHI>(
303-
id, id_var - static_cast<size_t>(SECP256R1_FIXED_BASE_YHI_0));
303+
id, id_var - static_cast<size_t>(SECP256R1_FIXED_BASE_YHI_0), index);
304304
}
305305
switch (id) {
306306
case AES_SPARSE_MAP: {

barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/secp256r1_fixed_base.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,17 +143,18 @@ template <table::AxisIndex axis> generate_fn_ptr generate_fn_for_window(size_t w
143143
}
144144
} // namespace
145145

146-
template <table::AxisIndex axis> BasicTable table::generate_basic_table_runtime(BasicTableId id, size_t window_idx)
146+
template <table::AxisIndex axis>
147+
BasicTable table::generate_basic_table_runtime(BasicTableId id, size_t window_idx, size_t table_index)
147148
{
148149
BB_ASSERT_LT(window_idx, NUM_WINDOWS);
149-
return generate_fn_for_window<axis>(window_idx)(id, window_idx);
150+
return generate_fn_for_window<axis>(window_idx)(id, table_index);
150151
}
151152

152153
// Explicit instantiations for the four axes.
153-
template BasicTable table::generate_basic_table_runtime<table::AXIS_XLO>(BasicTableId, size_t);
154-
template BasicTable table::generate_basic_table_runtime<table::AXIS_XHI>(BasicTableId, size_t);
155-
template BasicTable table::generate_basic_table_runtime<table::AXIS_YLO>(BasicTableId, size_t);
156-
template BasicTable table::generate_basic_table_runtime<table::AXIS_YHI>(BasicTableId, size_t);
154+
template BasicTable table::generate_basic_table_runtime<table::AXIS_XLO>(BasicTableId, size_t, size_t);
155+
template BasicTable table::generate_basic_table_runtime<table::AXIS_XHI>(BasicTableId, size_t, size_t);
156+
template BasicTable table::generate_basic_table_runtime<table::AXIS_YLO>(BasicTableId, size_t, size_t);
157+
template BasicTable table::generate_basic_table_runtime<table::AXIS_YHI>(BasicTableId, size_t, size_t);
157158

158159
namespace {
159160
// Returns `&table::get_values<axis, window_idx>` for a runtime (axis, window_idx). The per-axis 32-entry

barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/secp256r1_fixed_base.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,11 @@ class table : public Secp256r1FixedBaseParams {
116116
static BasicTable generate_basic_table(BasicTableId id, size_t table_index);
117117

118118
/**
119-
* @brief Runtime dispatch helper used by plookup_tables.cpp::create_basic_table. Given an axis and a
120-
* runtime window_idx ∈ [0, NUM_WINDOWS), instantiate the corresponding generator.
119+
* @brief Runtime dispatch helper used by plookup_tables.cpp::create_basic_table. Selects table contents using
120+
* window_idx and assigns the independently supplied circuit-local table_index.
121121
*/
122-
template <AxisIndex axis> static BasicTable generate_basic_table_runtime(BasicTableId id, size_t table_index);
122+
template <AxisIndex axis>
123+
static BasicTable generate_basic_table_runtime(BasicTableId id, size_t window_idx, size_t table_index);
123124

124125
/**
125126
* @brief Construct one of the 10 MultiTables described in the file-header docstring.

barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_circuit_builder.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ template <typename ExecutionTrace> void UltraCircuitBuilder_<ExecutionTrace>::fi
5151
* our circuit is finalized, and we must not to execute these functions again.
5252
*/
5353
if (!this->circuit_finalized) {
54+
std::unordered_set<size_t> table_indices;
55+
for (const auto& table : lookup_tables) {
56+
BB_ASSERT_GT(table.table_index, 0U, "Lookup table indices must be positive");
57+
BB_ASSERT(table_indices.insert(table.table_index).second,
58+
"Lookup table indices must be unique within a circuit");
59+
}
60+
5461
process_non_native_field_multiplications();
5562
#ifndef ULTRA_FUZZ
5663
this->rom_ram_logic.process_ROM_arrays(this);

docs/docs-developers/docs/resources/migration_notes.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,22 @@ Aztec is in active development. Each version may introduce breaking changes that
99

1010
## TBD
1111

12+
### [Aztec.nr] Canonical HandshakeRegistry re-pinned at a new address
13+
14+
The canonical `HandshakeRegistry` has been re-pinned so that it includes the owner's address in its `PrivateMutable` initialization nullifiers, keeping the handshake state of accounts that share keys independent. The registry moves to a new address. Handshakes established with the previous registry instance are not visible to the new one and must be re-established. The other standard contracts keep their addresses.
15+
16+
### [Aztec.nr] Note property selectors are typed and use packed-layout indices
17+
18+
The selectors in the generated `properties()` used the field's position in the note struct declaration, which pointed at the wrong packed field for any note with an earlier field packing to more than one `Field` (a `Point`, an array, a nested struct). Selector indices are now the field's offset in the note's packed representation, so `select`/`sort` criteria constrain the field they name.
19+
20+
Breaking changes:
21+
22+
- `PropertySelector<T>` carries the selected property's type. Hand-constructed literals need a type annotation, e.g. `let selector: PropertySelector<Field> = PropertySelector { index: 0, offset: 0, length: 32 };`.
23+
- `select`/`sort` reject properties that pack to more than one `Field` at compile time.
24+
- `select` takes its value typed as the property's type. Cast the value if a mixed-type comparison was intentional.
25+
- `properties()` cannot be used with a custom `Packable` layout. Define property selectors manually for such notes.
26+
- Every note field type must implement `Packable`, even when the note's own `Packable` is hand-written.
27+
1228
### [Aztec.nr] History note nullification helpers renamed and restricted to own-contract notes
1329

1430
The `history::note` helpers that recompute a note's nullifier have been renamed with a `local_` prefix and now assert that the note belongs to the executing contract:

docs/docs-developers/docs/tutorials/js_tutorials/aztecjs-getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ yarn init -y
2424
Next, add the TypeScript dependencies:
2525

2626
```sh
27-
yarn add typescript @types/node tsx
27+
yarn add "typescript@^5.3.3" @types/node tsx
2828
```
2929

3030
:::tip

0 commit comments

Comments
 (0)