Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into mw/blob-circuit
Browse files Browse the repository at this point in the history
  • Loading branch information
MirandaWood committed Nov 16, 2024
2 parents 862b1b2 + b3d0096 commit 3d46ec1
Show file tree
Hide file tree
Showing 130 changed files with 47,707 additions and 45,714 deletions.
87,661 changes: 44,243 additions & 43,418 deletions .github/spot-runner-action/dist/index.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .github/spot-runner-action/src/ec2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ export class Ec2Instance {
Ebs: {
VolumeSize: 64,
VolumeType: 'gp3',
Throughput: 125,
Iops: 3000
Throughput: 1000,
Iops: 5000
},
},
],
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ jobs:
run: earthly-ci --no-output ./+barretenberg-acir-tests-bb.js

noir-format:
needs: [build, configure]
needs: [build-images, configure]
runs-on: ${{ needs.configure.outputs.username }}-x86
if: needs.configure.outputs.noir == 'true' || needs.configure.outputs.noir-projects == 'true'
steps:
Expand All @@ -524,7 +524,7 @@ jobs:
earthly-ci --no-output ./+format
noir-test:
needs: [build, configure]
needs: [build-images, configure]
runs-on: ${{ needs.configure.outputs.username }}-x86
if: needs.configure.outputs.noir == 'true'
steps:
Expand All @@ -537,6 +537,7 @@ jobs:
run: earthly-ci --no-output ./noir+test

noir-examples:
# We delay this job until after the `build` job has completed as it depends on bb being built.
needs: [build, configure]
runs-on: ${{ needs.configure.outputs.username }}-x86
if: needs.configure.outputs.noir == 'true'
Expand All @@ -550,6 +551,7 @@ jobs:
run: earthly-ci --no-output ./noir+examples

noir-packages-test:
# We delay this job until after the `build` job has completed as it depends on bb.js being built.
needs: [build, configure]
runs-on: ${{ needs.configure.outputs.username }}-x86
if: needs.configure.outputs.barretenberg == 'true' || needs.configure.outputs.noir == 'true'
Expand Down
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 = 8fbf0c214576aa5d066a897cfe383a3e9645d53f
parent = bf4176f9fc2ae13ddc3f3ca534bc0611f85d7aa7
commit = 2147bc98c5a3cafbd8c06867dbd010c2dfeb5373
parent = beed29383fb8e2fb7e2ecd1c394908e098a494be
method = merge
cmdver = 0.4.6
4 changes: 2 additions & 2 deletions barretenberg/cpp/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ add_subdirectory(barretenberg/dsl)
add_subdirectory(barretenberg/ecc)
add_subdirectory(barretenberg/eccvm)
add_subdirectory(barretenberg/env)
add_subdirectory(barretenberg/execution_trace)
add_subdirectory(barretenberg/trace_to_polynomials)
add_subdirectory(barretenberg/examples)
add_subdirectory(barretenberg/flavor)
add_subdirectory(barretenberg/goblin)
Expand Down Expand Up @@ -128,7 +128,7 @@ set(BARRETENBERG_TARGET_OBJECTS
$<TARGET_OBJECTS:dsl_objects>
$<TARGET_OBJECTS:ecc_objects>
$<TARGET_OBJECTS:eccvm_objects>
$<TARGET_OBJECTS:execution_trace_objects>
$<TARGET_OBJECTS:trace_to_polynomials_objects>
$<TARGET_OBJECTS:simple_example_objects>
$<TARGET_OBJECTS:flavor_objects>
$<TARGET_OBJECTS:goblin_objects>
Expand Down
12 changes: 3 additions & 9 deletions barretenberg/cpp/src/barretenberg/bb/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,7 @@ void client_ivc_prove_output_all_msgpack(const std::string& bytecodePath,
}
// TODO(#7371) dedupe this with the rest of the similar code
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1101): remove use of auto_verify_mode
ClientIVC ivc;
ivc.auto_verify_mode = true;
ivc.trace_settings.structure = TraceStructure::E2E_FULL_TEST;
ClientIVC ivc{ { E2E_FULL_TEST_STRUCTURE }, /*auto_verify_mode=*/true };

// Accumulate the entire program stack into the IVC
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1116): remove manual setting of is_kernel once databus
Expand Down Expand Up @@ -446,9 +444,7 @@ bool foldAndVerifyProgram(const std::string& bytecodePath, const std::string& wi
init_bn254_crs(1 << 22);
init_grumpkin_crs(1 << 16);

ClientIVC ivc;
ivc.auto_verify_mode = true;
ivc.trace_settings.structure = TraceStructure::SMALL_TEST;
ClientIVC ivc{ { SMALL_TEST_STRUCTURE }, /*auto_verify_mode=*/true };

auto program_stack = acir_format::get_acir_program_stack(
bytecodePath, witnessPath, false); // TODO(https://github.com/AztecProtocol/barretenberg/issues/1013): this
Expand Down Expand Up @@ -499,9 +495,7 @@ void client_ivc_prove_output_all(const std::string& bytecodePath,
init_grumpkin_crs(1 << 16);

// TODO(https://github.com/AztecProtocol/barretenberg/issues/1101): remove use of auto_verify_mode
ClientIVC ivc;
ivc.auto_verify_mode = true;
ivc.trace_settings.structure = TraceStructure::E2E_FULL_TEST;
ClientIVC ivc{ { E2E_FULL_TEST_STRUCTURE }, /*auto_verify_mode=*/true };

auto program_stack = acir_format::get_acir_program_stack(
bytecodePath, witnessPath, false); // TODO(https://github.com/AztecProtocol/barretenberg/issues/1013): this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class ClientIVCBench : public benchmark::Fixture {
*/
BENCHMARK_DEFINE_F(ClientIVCBench, Full)(benchmark::State& state)
{
ClientIVC ivc;
ivc.trace_settings.structure = TraceStructure::CLIENT_IVC_BENCH;
ClientIVC ivc{ { CLIENT_IVC_BENCH_STRUCTURE } };

auto total_num_circuits = 2 * static_cast<size_t>(state.range(0)); // 2x accounts for kernel circuits
auto mocked_vkeys = mock_verification_keys(total_num_circuits);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,12 @@ void fill_trace(State& state, TraceSettings settings)

void fill_trace_client_ivc_bench(State& state)
{
fill_trace(state, { TraceStructure::CLIENT_IVC_BENCH, /*overflow_capacity=*/0 });
fill_trace(state, { CLIENT_IVC_BENCH_STRUCTURE });
}

void fill_trace_e2e_full_test(State& state)
{
fill_trace(state, { TraceStructure::E2E_FULL_TEST, /*overflow_capacity=*/0 });
fill_trace(state, { E2E_FULL_TEST_STRUCTURE });
}

static void pk_mem(State& state, void (*test_circuit_function)(State&)) noexcept
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace bb {

template <> auto UltraCircuitChecker::init_empty_values<UltraCircuitBuilder_<UltraArith<bb::fr>>>()
template <> auto UltraCircuitChecker::init_empty_values<UltraCircuitBuilder_<UltraExecutionTraceBlocks>>()
{
return UltraFlavor::AllValues{};
}
Expand Down Expand Up @@ -298,7 +298,7 @@ void UltraCircuitChecker::populate_values(
}

// Template method instantiations for each check method
template bool UltraCircuitChecker::check<UltraCircuitBuilder_<UltraArith<bb::fr>>>(
const UltraCircuitBuilder_<UltraArith<bb::fr>>& builder_in);
template bool UltraCircuitChecker::check<UltraCircuitBuilder_<UltraExecutionTraceBlocks>>(
const UltraCircuitBuilder_<UltraExecutionTraceBlocks>& builder_in);
template bool UltraCircuitChecker::check<MegaCircuitBuilder_<bb::fr>>(const MegaCircuitBuilder_<bb::fr>& builder_in);
} // namespace bb
9 changes: 7 additions & 2 deletions barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "barretenberg/goblin/goblin.hpp"
#include "barretenberg/goblin/mock_circuits.hpp"
#include "barretenberg/plonk_honk_shared/arithmetization/execution_trace_usage_tracker.hpp"
#include "barretenberg/plonk_honk_shared/execution_trace/execution_trace_usage_tracker.hpp"
#include "barretenberg/protogalaxy/protogalaxy_prover.hpp"
#include "barretenberg/protogalaxy/protogalaxy_verifier.hpp"
#include "barretenberg/stdlib/honk_verifier/decider_recursive_verifier.hpp"
Expand Down Expand Up @@ -120,10 +120,15 @@ class ClientIVC {

// TODO(https://github.com/AztecProtocol/barretenberg/issues/1101): eventually do away with this.
// Setting auto_verify_mode = true will cause kernel completion logic to be added to kernels automatically
bool auto_verify_mode = false;
bool auto_verify_mode;

bool initialized = false; // Is the IVC accumulator initialized

ClientIVC(TraceSettings trace_settings = {}, bool auto_verify_mode = false)
: trace_settings(trace_settings)
, auto_verify_mode(auto_verify_mode)
{}

void instantiate_stdlib_verification_queue(
ClientCircuit& circuit, const std::vector<std::shared_ptr<RecursiveVerificationKey>>& input_keys = {});

Expand Down
31 changes: 10 additions & 21 deletions barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ class ClientIVCTests : public ::testing::Test {
TraceSettings trace_settings,
size_t log2_num_gates = 16)
{
ClientIVC ivc; // temporary IVC instance needed to produce the complete kernel circuits
ivc.trace_settings = trace_settings;
ClientIVC ivc{ trace_settings }; // temporary IVC instance needed to produce the complete kernel circuits

std::vector<std::shared_ptr<VerificationKey>> vkeys;

Expand Down Expand Up @@ -162,8 +161,7 @@ TEST_F(ClientIVCTests, BadProofFailure)
{
// Confirm that the IVC verifies if nothing is tampered with
{
ClientIVC ivc;
ivc.trace_settings.structure = TraceStructure::SMALL_TEST;
ClientIVC ivc{ { SMALL_TEST_STRUCTURE } };

MockCircuitProducer circuit_producer;

Expand All @@ -178,8 +176,7 @@ TEST_F(ClientIVCTests, BadProofFailure)

// The IVC throws an exception if the FIRST fold proof is tampered with
{
ClientIVC ivc;
ivc.trace_settings.structure = TraceStructure::SMALL_TEST;
ClientIVC ivc{ { SMALL_TEST_STRUCTURE } };

MockCircuitProducer circuit_producer;

Expand All @@ -203,8 +200,7 @@ TEST_F(ClientIVCTests, BadProofFailure)

// The IVC fails if the SECOND fold proof is tampered with
{
ClientIVC ivc;
ivc.trace_settings.structure = TraceStructure::SMALL_TEST;
ClientIVC ivc{ { SMALL_TEST_STRUCTURE } };

MockCircuitProducer circuit_producer;

Expand All @@ -228,8 +224,7 @@ TEST_F(ClientIVCTests, BadProofFailure)

// The IVC fails if the 3rd/FINAL fold proof is tampered with
{
ClientIVC ivc;
ivc.trace_settings.structure = TraceStructure::SMALL_TEST;
ClientIVC ivc{ { SMALL_TEST_STRUCTURE } };

MockCircuitProducer circuit_producer;

Expand Down Expand Up @@ -277,8 +272,7 @@ TEST_F(ClientIVCTests, BasicLarge)
*/
TEST_F(ClientIVCTests, BasicStructured)
{
ClientIVC ivc;
ivc.trace_settings.structure = TraceStructure::SMALL_TEST;
ClientIVC ivc{ { SMALL_TEST_STRUCTURE } };

MockCircuitProducer circuit_producer;

Expand Down Expand Up @@ -324,8 +318,7 @@ TEST_F(ClientIVCTests, PrecomputedVerificationKeys)
*/
TEST_F(ClientIVCTests, StructuredPrecomputedVKs)
{
ClientIVC ivc;
ivc.trace_settings.structure = TraceStructure::SMALL_TEST;
ClientIVC ivc{ { SMALL_TEST_STRUCTURE } };

size_t NUM_CIRCUITS = 4;
size_t log2_num_gates = 5; // number of gates in baseline mocked circuit
Expand Down Expand Up @@ -356,8 +349,7 @@ TEST(ClientIVCBenchValidation, Full6)
bb::srs::init_crs_factory("../srs_db/ignition");
bb::srs::init_grumpkin_crs_factory("../srs_db/grumpkin");

ClientIVC ivc;
ivc.trace_settings.structure = TraceStructure::CLIENT_IVC_BENCH;
ClientIVC ivc{ { CLIENT_IVC_BENCH_STRUCTURE } };
size_t total_num_circuits{ 12 };
PrivateFunctionExecutionMockCircuitProducer circuit_producer;
auto precomputed_vkeys = circuit_producer.precompute_verification_keys(total_num_circuits, ivc.trace_settings);
Expand All @@ -376,8 +368,7 @@ TEST(ClientIVCBenchValidation, Full6MockedVKs)
bb::srs::init_crs_factory("../srs_db/ignition");
bb::srs::init_grumpkin_crs_factory("../srs_db/grumpkin");

ClientIVC ivc;
ivc.trace_settings.structure = TraceStructure::CLIENT_IVC_BENCH;
ClientIVC ivc{ { CLIENT_IVC_BENCH_STRUCTURE } };
size_t total_num_circuits{ 12 };
PrivateFunctionExecutionMockCircuitProducer circuit_producer;
auto mocked_vkeys = mock_verification_keys(total_num_circuits);
Expand All @@ -396,11 +387,9 @@ TEST(ClientIVCBenchValidation, Full6MockedVKs)
*/
TEST_F(ClientIVCTests, StructuredTraceOverflow)
{
ClientIVC ivc;

// Define trace settings with sufficient overflow capacity to accommodate each of the circuits to be accumulated
uint32_t overflow_capacity = 1 << 17;
ivc.trace_settings = { TraceStructure::SMALL_TEST, overflow_capacity };
ClientIVC ivc{ { SMALL_TEST_STRUCTURE, /*overflow_capacity=*/1 << 17 } };

MockCircuitProducer circuit_producer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ class ClientIVCAutoVerifyTests : public ::testing::Test {
*/
TEST_F(ClientIVCAutoVerifyTests, Basic)
{
ClientIVC ivc;
ivc.auto_verify_mode = true;
ClientIVC ivc{ {}, /*auto_verify_mode=*/true };

// Initialize the IVC with an arbitrary circuit
Builder circuit_0 = create_mock_circuit(ivc, /*is_kernel=*/false);
Expand All @@ -81,8 +80,7 @@ TEST_F(ClientIVCAutoVerifyTests, Basic)
*/
TEST_F(ClientIVCAutoVerifyTests, BasicOdd)
{
ClientIVC ivc;
ivc.auto_verify_mode = true;
ClientIVC ivc{ {}, /*auto_verify_mode=*/true };

// Initialize the IVC with an arbitrary circuit
Builder circuit_0 = create_mock_circuit(ivc, /*is_kernel=*/false);
Expand All @@ -105,8 +103,7 @@ TEST_F(ClientIVCAutoVerifyTests, BasicOdd)
*/
TEST_F(ClientIVCAutoVerifyTests, BasicLarge)
{
ClientIVC ivc;
ivc.auto_verify_mode = true;
ClientIVC ivc{ {}, /*auto_verify_mode=*/true };

// Construct a set of arbitrary circuits
size_t NUM_CIRCUITS = 6;
Expand All @@ -130,9 +127,7 @@ TEST_F(ClientIVCAutoVerifyTests, BasicLarge)
*/
TEST_F(ClientIVCAutoVerifyTests, BasicStructured)
{
ClientIVC ivc;
ivc.auto_verify_mode = true;
ivc.trace_settings.structure = TraceStructure::SMALL_TEST;
ClientIVC ivc{ { SMALL_TEST_STRUCTURE }, /*auto_verify_mode=*/true };

// Construct some circuits of varying size
Builder circuit_0 = create_mock_circuit(ivc, /*is_kernel=*/false, /*log2_num_gates=*/5);
Expand All @@ -155,8 +150,7 @@ TEST_F(ClientIVCAutoVerifyTests, BasicStructured)
*/
TEST_F(ClientIVCAutoVerifyTests, PrecomputedVerificationKeys)
{
ClientIVC ivc;
ivc.auto_verify_mode = true;
ClientIVC ivc{ {}, /*auto_verify_mode=*/true };

// Construct a set of arbitrary circuits
size_t NUM_CIRCUITS = 4;
Expand All @@ -183,9 +177,7 @@ TEST_F(ClientIVCAutoVerifyTests, PrecomputedVerificationKeys)
*/
TEST_F(ClientIVCAutoVerifyTests, StructuredPrecomputedVKs)
{
ClientIVC ivc;
ivc.auto_verify_mode = true;
ivc.trace_settings.structure = TraceStructure::SMALL_TEST;
ClientIVC ivc{ { SMALL_TEST_STRUCTURE }, /*auto_verify_mode=*/true };

// Construct a set of arbitrary circuits
size_t NUM_CIRCUITS = 4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ class ClientIVCIntegrationTests : public ::testing::Test {
*/
TEST_F(ClientIVCIntegrationTests, BenchmarkCaseSimple)
{
ClientIVC ivc;
ivc.trace_settings.structure = TraceStructure::CLIENT_IVC_BENCH;
ClientIVC ivc{ { CLIENT_IVC_BENCH_STRUCTURE } };

MockCircuitProducer circuit_producer;

Expand All @@ -60,8 +59,7 @@ TEST_F(ClientIVCIntegrationTests, BenchmarkCaseSimple)
*/
TEST_F(ClientIVCIntegrationTests, ConsecutiveKernels)
{
ClientIVC ivc;
ivc.trace_settings.structure = TraceStructure::CLIENT_IVC_BENCH;
ClientIVC ivc{ { CLIENT_IVC_BENCH_STRUCTURE } };

MockCircuitProducer circuit_producer;

Expand All @@ -88,8 +86,7 @@ TEST_F(ClientIVCIntegrationTests, ConsecutiveKernels)
*/
TEST_F(ClientIVCIntegrationTests, BenchmarkCasePrecomputedVKs)
{
ClientIVC ivc;
ivc.trace_settings.structure = TraceStructure::CLIENT_IVC_BENCH;
ClientIVC ivc{ { CLIENT_IVC_BENCH_STRUCTURE } };

size_t NUM_CIRCUITS = 6;

Expand Down Expand Up @@ -122,8 +119,7 @@ TEST_F(ClientIVCIntegrationTests, BenchmarkCasePrecomputedVKs)
*/
TEST_F(ClientIVCIntegrationTests, DatabusFailure)
{
ClientIVC ivc;
ivc.trace_settings.structure = TraceStructure::CLIENT_IVC_BENCH;
ClientIVC ivc{ { CLIENT_IVC_BENCH_STRUCTURE } };

MockCircuitProducer circuit_producer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ class PrivateFunctionExecutionMockCircuitProducer {
*/
auto precompute_verification_keys(const size_t num_circuits, TraceSettings trace_settings)
{
ClientIVC ivc; // temporary IVC instance needed to produce the complete kernel circuits
ivc.trace_settings = trace_settings;
ClientIVC ivc{ trace_settings }; // temporary IVC instance needed to produce the complete kernel circuits

std::vector<std::shared_ptr<VerificationKey>> vkeys;

Expand Down
Loading

0 comments on commit 3d46ec1

Please sign in to comment.