Skip to content

Commit

Permalink
chore(avm): bump SRS to 1 << 20 (#7575)
Browse files Browse the repository at this point in the history
  • Loading branch information
fcarreiro authored Jul 23, 2024
1 parent 548701e commit fad37a7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions barretenberg/cpp/src/barretenberg/bb/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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] =
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -124,6 +125,11 @@ std::tuple<AvmFlavor::VerificationKey, HonkProof> Execution::prove(std::vector<u
auto circuit_builder = bb::AvmCircuitBuilder();
circuit_builder.set_trace(std::move(trace));

if (circuit_builder.get_circuit_subgroup_size() > 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<FF> getDefaultPublicInputs();
Expand Down

0 comments on commit fad37a7

Please sign in to comment.