Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions barretenberg/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ if(ENABLE_ASAN)
endif()

if(FUZZING)
add_definitions(-DULTRA_FUZZ)
if(SHOW_INFORMATION)
add_definitions(-DSHOW_INFORMATION=1)
endif()
Expand All @@ -81,9 +82,6 @@ if(FUZZING)
add_definitions(-DDISABLE_CUSTOM_MUTATORS=1)
endif()

add_compile_options(-fsanitize=fuzzer)
add_link_options(-fsanitize=fuzzer)

set(MULTITHREADING OFF)
endif()

Expand Down
7 changes: 6 additions & 1 deletion barretenberg/cpp/cmake/module.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ function(barretenberg_module MODULE_NAME)

file(GLOB_RECURSE FUZZERS_SOURCE_FILES *.fuzzer.cpp)
if(FUZZING AND FUZZERS_SOURCE_FILES)
add_definitions(-DULTRA_FUZZ)
foreach(FUZZER_SOURCE_FILE ${FUZZERS_SOURCE_FILES})
get_filename_component(FUZZER_NAME_STEM ${FUZZER_SOURCE_FILE} NAME_WE)
add_executable(
Expand All @@ -231,6 +230,12 @@ function(barretenberg_module MODULE_NAME)
"-fsanitize=fuzzer"
)

target_compile_options(
${MODULE_NAME}_${FUZZER_NAME_STEM}_fuzzer
PRIVATE
"-fsanitize=fuzzer"
)

target_link_libraries(
${MODULE_NAME}_${FUZZER_NAME_STEM}_fuzzer
PRIVATE
Expand Down
10 changes: 6 additions & 4 deletions barretenberg/cpp/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,11 @@ add_subdirectory(barretenberg/transcript)
add_subdirectory(barretenberg/translator_vm)
add_subdirectory(barretenberg/ultra_honk)
add_subdirectory(barretenberg/vm)
add_subdirectory(barretenberg/vm2)
add_subdirectory(barretenberg/wasi)
add_subdirectory(barretenberg/world_state)
if(NOT FUZZING)
add_subdirectory(barretenberg/world_state)
add_subdirectory(barretenberg/vm2)
endif()

if(SMT)
add_subdirectory(barretenberg/smt_verification)
Expand Down Expand Up @@ -175,13 +177,13 @@ set(BARRETENBERG_TARGET_OBJECTS
$<TARGET_OBJECTS:translator_vm_objects>
$<TARGET_OBJECTS:ultra_honk_objects>)

if(NOT DISABLE_AZTEC_VM)
if(NOT DISABLE_AZTEC_VM AND NOT FUZZING)
# enable AVM
list(APPEND BARRETENBERG_TARGET_OBJECTS $<TARGET_OBJECTS:vm_objects>)
list(APPEND BARRETENBERG_TARGET_OBJECTS $<TARGET_OBJECTS:vm2_objects>)
endif()

if(NOT WASM)
if(NOT WASM AND NOT FUZZING)
# enable merkle trees and lmdb
list(APPEND BARRETENBERG_TARGET_OBJECTS $<TARGET_OBJECTS:crypto_merkle_tree_objects>)
list(APPEND BARRETENBERG_TARGET_OBJECTS $<TARGET_OBJECTS:lmdblib_objects>)
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ template <typename Builder> class FieldBase {
instruction_opcode == Instruction::OPCODE::WITNESS ||
instruction_opcode == Instruction::OPCODE::CONSTANT_WITNESS) {
*Data = instruction.id;
bb::fr::serialize_to_buffer(instruction.arguments.element.data, Data + 1);
bb::fr::serialize_to_buffer(instruction.arguments.element, Data + 1);
}

if constexpr (instruction_opcode == Instruction::OPCODE::ASSERT_ZERO ||
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,17 @@ extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size)
bool checked = circuit_builder.check_circuit();

// Construct proof
TranslatorProver prover(circuit_builder, prover_transcript);
auto proving_key = std::make_shared<TranslatorProvingKey>(circuit_builder);
TranslatorProver prover(proving_key, prover_transcript);
auto proof = prover.construct_proof();

// Verify proof
auto verifier_transcript = std::make_shared<bb::TranslatorFlavor::Transcript>(prover_transcript->proof_data);
verifier_transcript->template receive_from_prover<Fq>("init");
TranslatorVerifier verifier(prover.key, verifier_transcript);
bool verified = verifier.verify_proof(proof);
auto verification_key = std::make_shared<TranslatorFlavor::VerificationKey>(proving_key->proving_key);
TranslatorVerifier verifier(verification_key, verifier_transcript);
bool verified = verifier.verify_proof(proof, x, translation_batching_challenge);
(void)checked;
(void)verified;
return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size)
Fr z_2 = Fr(*(uint256_t*)(buffer));

bb::TranslatorCircuitBuilder::AccumulationInput single_accumulation_step =
bb::generate_witness_values(op, p_x_lo, p_x_hi, p_y_lo, p_y_hi, z_1, z_2, previous_accumulator, v, x);
bb::TranslatorCircuitBuilder::generate_witness_values(
op, p_x_lo, p_x_hi, p_y_lo, p_y_hi, z_1, z_2, previous_accumulator, v, x);

auto circuit_builder = bb::TranslatorCircuitBuilder(v, x);
circuit_builder.create_accumulation_gate(single_accumulation_step);
if (!circuit_builder.check_circuit()) {
return 1;
}
return 0;
}
}