diff --git a/barretenberg/cpp/src/barretenberg/bb/main.cpp b/barretenberg/cpp/src/barretenberg/bb/main.cpp index 0f7c839efd77..a4d422b9baf0 100644 --- a/barretenberg/cpp/src/barretenberg/bb/main.cpp +++ b/barretenberg/cpp/src/barretenberg/bb/main.cpp @@ -896,8 +896,8 @@ void avm_prove(const std::filesystem::path& bytecode_path, vinfo("hints.externalcall_hints size: ", avm_hints.externalcall_hints.size()); vinfo("hints.contract_instance_hints size: ", avm_hints.contract_instance_hints.size()); - // Hardcoded circuit size for now, with enough to support 16-bit range checks - init_bn254_crs(1 << 17); + vinfo("initializing crs with size: ", avm_trace::Execution::SRS_SIZE); + init_bn254_crs(avm_trace::Execution::SRS_SIZE); // Prove execution and return vk auto const [verification_key, proof] = diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.cpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.cpp index de3f5151c193..81aefd531879 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.cpp @@ -1,6 +1,7 @@ #include "barretenberg/vm/avm_trace/avm_execution.hpp" #include "barretenberg/bb/log.hpp" #include "barretenberg/common/serialize.hpp" +#include "barretenberg/common/throw_or_abort.hpp" #include "barretenberg/numeric/uint256/uint256.hpp" #include "barretenberg/vm/avm_trace/avm_common.hpp" #include "barretenberg/vm/avm_trace/avm_deserialization.hpp" @@ -124,6 +125,11 @@ std::tuple Execution::prove(std::vector SRS_SIZE) { + throw_or_abort("Circuit subgroup size (" + std::to_string(circuit_builder.get_circuit_subgroup_size()) + + ") exceeds SRS_SIZE (" + std::to_string(SRS_SIZE) + ")"); + } + AVM_TRACK_TIME("prove/check_circuit", circuit_builder.check_circuit()); auto composer = AvmComposer(); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.hpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.hpp index e9df9f569f05..18ec36e626fb 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.hpp @@ -14,6 +14,10 @@ namespace bb::avm_trace { class Execution { public: + // Hardcoded circuit size for now, with enough to support 16-bit range checks and more. + // The SRS size is expected to be ~67MB at this size. + static constexpr size_t SRS_SIZE = 1 << 20; + Execution() = default; static std::vector getDefaultPublicInputs();