Skip to content

Commit 884af29

Browse files
authored
fix: Correct active range for databus (#16482)
Retrying [fix: Correct active range for databus](#16381 (comment)) which was reverted because of a possibliy flaky e2e test.
2 parents 8ebe8d7 + bd30c15 commit 884af29

File tree

3 files changed

+23
-20
lines changed

3 files changed

+23
-20
lines changed

barretenberg/cpp/scripts/test_civc_standalone_vks_havent_changed.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ cd ..
1111
# - Generate a hash for versioning: sha256sum bb-civc-inputs.tar.gz
1212
# - Upload the compressed results: aws s3 cp bb-civc-inputs.tar.gz s3://aztec-ci-artifacts/protocol/bb-civc-inputs-[hash(0:8)].tar.gz
1313
# Note: In case of the "Test suite failed to run ... Unexpected token 'with' " error, need to run: docker pull aztecprotocol/build:3.0
14-
pinned_short_hash="251cc432"
14+
pinned_short_hash="7298f572"
1515
pinned_civc_inputs_url="https://aztec-ci-artifacts.s3.us-east-2.amazonaws.com/protocol/bb-civc-inputs-${pinned_short_hash}.tar.gz"
1616

1717
function compress_and_upload {

barretenberg/cpp/src/barretenberg/honk/execution_trace/execution_trace_usage_tracker.hpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,18 @@ struct ExecutionTraceUsageTracker {
9999
active_ranges.push_back(Range{ start_idx, end_idx });
100100
}
101101

102-
// The active ranges must also include the rows where the actual databus and lookup table data are stored.
103-
// (Note: lookup tables are constructed from the beginning of the lookup block ; databus data is constructed at
104-
// the start of the trace).
105-
106-
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1152): should be able to use simply Range{ 0,
107-
// max_databus_size } but this breaks for certain choices of num_threads. It should also be possible to have the
108-
// lookup table data be Range{lookup_start, max_tables_size} but that also breaks.
109-
size_t databus_end =
110-
std::max(max_databus_size, static_cast<size_t>(fixed_sizes.busread.trace_offset() + max_sizes.busread));
111-
active_ranges.push_back(Range{ 0, databus_end });
112-
size_t lookups_start = fixed_sizes.lookup.trace_offset();
113-
size_t lookups_end = lookups_start + std::max(max_tables_size, static_cast<size_t>(max_sizes.lookup));
114-
active_ranges.emplace_back(Range{ lookups_start, lookups_end });
102+
// The active range for lookup-style blocks consists of two components: (1) rows containing the lookup/read
103+
// gates and (2) rows containing the table data itself. The Mega arithmetization contains two such blocks:
104+
// conventional lookups (lookup block) and the databus (busread block). Here we add the ranges corresponding
105+
// to the "table" data for these two blocks. The corresponding gate ranges were added above.
106+
size_t databus_data_start = 0; // Databus column data starts at idx 0
107+
size_t databus_data_end = databus_data_start + max_databus_size;
108+
active_ranges.push_back(Range{ databus_data_start, databus_data_end }); // region where databus contains data
109+
110+
// Note: start of table data is aligned with start of the lookup gates block
111+
size_t tables_start = fixed_sizes.lookup.trace_offset();
112+
size_t tables_end = tables_start + max_tables_size;
113+
active_ranges.emplace_back(Range{ tables_start, tables_end }); // region where table data is stored
115114
}
116115

117116
void print()

barretenberg/cpp/src/barretenberg/ultra_honk/decider_proving_key.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,16 +160,20 @@ void DeciderProvingKey_<Flavor>::allocate_databus_polynomials(const Circuit& cir
160160
polynomials.return_data_read_counts = Polynomial(MAX_DATABUS_SIZE, dyadic_size());
161161
polynomials.return_data_read_tags = Polynomial(MAX_DATABUS_SIZE, dyadic_size());
162162

163-
polynomials.databus_id = Polynomial(MAX_DATABUS_SIZE, dyadic_size());
164-
165163
// Allocate log derivative lookup argument inverse polynomials
166164
const size_t q_busread_end =
167165
circuit.blocks.busread.trace_offset() + circuit.blocks.busread.get_fixed_size(is_structured);
168-
polynomials.calldata_inverses = Polynomial(std::max(circuit.get_calldata().size(), q_busread_end), dyadic_size());
166+
const size_t calldata_size = circuit.get_calldata().size();
167+
const size_t secondary_calldata_size = circuit.get_secondary_calldata().size();
168+
const size_t return_data_size = circuit.get_return_data().size();
169+
170+
polynomials.databus_id = Polynomial(
171+
std::max({ calldata_size, secondary_calldata_size, return_data_size, q_busread_end }), dyadic_size());
172+
173+
polynomials.calldata_inverses = Polynomial(std::max(calldata_size, q_busread_end), dyadic_size());
169174
polynomials.secondary_calldata_inverses =
170-
Polynomial(std::max(circuit.get_secondary_calldata().size(), q_busread_end), dyadic_size());
171-
polynomials.return_data_inverses =
172-
Polynomial(std::max(circuit.get_return_data().size(), q_busread_end), dyadic_size());
175+
Polynomial(std::max(secondary_calldata_size, q_busread_end), dyadic_size());
176+
polynomials.return_data_inverses = Polynomial(std::max(return_data_size, q_busread_end), dyadic_size());
173177
}
174178

175179
/**

0 commit comments

Comments
 (0)