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
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ TEST_F(ClientIVCAPITests, ProveAndVerifyFileBasedFlow)
auto verify_vk_equivalence = [&](const std::filesystem::path& vk1_path, const ClientIVC::MegaVerificationKey& vk2) {
auto vk1_data = read_file(vk1_path);
auto vk1 = from_buffer<ClientIVC::MegaVerificationKey>(vk1_data);
ASSERT(msgpack::msgpack_check_eq(vk1, vk2, "VK from prove should match VK from write_vk"));
ASSERT_TRUE(msgpack::msgpack_check_eq(vk1, vk2, "VK from prove should match VK from write_vk"));
};

// Helper lambda to verify proof
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "barretenberg/commitment_schemes/ipa/ipa.hpp"
#include "barretenberg/common/assert.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include <benchmark/benchmark.h>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once
#include <benchmark/benchmark.h>

#include "barretenberg/common/assert.hpp"
#include "barretenberg/crypto/merkle_tree/membership.hpp"
#include "barretenberg/goblin/mock_circuits.hpp"
#include "barretenberg/stdlib/encryption/ecdsa/ecdsa.hpp"
Expand Down Expand Up @@ -39,9 +40,9 @@ template <typename Builder> void generate_basic_arithmetic_circuit(Builder& buil
}

size_t est_gate_count = builder.get_estimated_num_finalized_gates();
ASSERT(est_gate_count <=
(1UL << log2_num_gates) -
GATE_COUNT_BUFFER); // Check that the finalized gate count won't exceed the desired gate count.
BB_ASSERT_LTE(est_gate_count,
(1UL << log2_num_gates) - GATE_COUNT_BUFFER,
"Check that the finalized gate count won't exceed the desired gate count.");
}

template <typename Prover>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "./graph.hpp"
#include "barretenberg/common/assert.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"
#include <algorithm>
#include <array>
Expand Down Expand Up @@ -430,7 +431,7 @@ inline std::vector<uint32_t> StaticAnalyzer_<FF>::get_rom_table_connected_compon
bb::UltraCircuitBuilder& ultra_builder, const bb::RomTranscript& rom_array)
{
size_t block_index = find_block_index(ultra_builder, ultra_builder.blocks.aux);
ASSERT(block_index == 5);
BB_ASSERT_EQ(block_index, 5U);

// Every RomTranscript data structure has 2 main components that are interested for static analyzer:
// 1) records contains values that were put in the gate, we can use them to create connections between variables
Expand Down Expand Up @@ -491,7 +492,7 @@ inline std::vector<uint32_t> StaticAnalyzer_<FF>::get_ram_table_connected_compon
bb::UltraCircuitBuilder& ultra_builder, const bb::RamTranscript& ram_array)
{
size_t block_index = find_block_index(ultra_builder, ultra_builder.blocks.aux);
ASSERT(block_index == 5);
BB_ASSERT_EQ(block_index, 5U);
std::vector<uint32_t> ram_table_variables;
for (const auto& record : ram_array.records) {
std::vector<uint32_t> gate_variables;
Expand Down Expand Up @@ -1115,12 +1116,12 @@ inline void StaticAnalyzer_<FF>::remove_record_witness_variables(bb::UltraCircui
auto block_data = ultra_builder.blocks.get();
size_t blk_idx = find_block_index(ultra_builder, ultra_builder.blocks.aux);
std::vector<uint32_t> to_remove;
ASSERT(blk_idx == 5);
BB_ASSERT_EQ(blk_idx, 5U);
for (const auto& var_idx : variables_in_one_gate) {
KeyPair key = { var_idx, blk_idx };
if (auto search = variable_gates.find(key); search != variable_gates.end()) {
std::vector<size_t> gate_indexes = variable_gates[key];
ASSERT(gate_indexes.size() == 1);
BB_ASSERT_EQ(gate_indexes.size(), 1U);
size_t gate_idx = gate_indexes[0];
auto q_1 = block_data[blk_idx].q_1()[gate_idx];
auto q_2 = block_data[blk_idx].q_2()[gate_idx];
Expand Down Expand Up @@ -1269,7 +1270,7 @@ void StaticAnalyzer_<FF>::print_variable_in_one_gate(bb::UltraCircuitBuilder& ul
const auto& block_data = ultra_builder.blocks.get();
for (const auto& [key, gates] : variable_gates) {
if (key.first == real_idx) {
ASSERT(gates.size() == 1);
BB_ASSERT_EQ(gates.size(), 1U);
size_t gate_index = gates[0];
UltraBlock block = block_data[key.second];
info("---- printing variables in this gate");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ TEST_F(BoomerangGoblinRecursiveVerifierTests, graph_description_basic)
auto proof = prover.construct_proof();
bool verified = verifier.verify_proof(proof);

ASSERT(verified);
ASSERT_TRUE(verified);
}
auto translator_pairing_points = output.points_accumulator;
translator_pairing_points.P0.x.fix_witness();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "ultra_circuit_checker.hpp"
#include "barretenberg/common/assert.hpp"
#include "barretenberg/flavor/mega_flavor.hpp"
#include "barretenberg/stdlib/primitives/circuit_builders/circuit_builders.hpp"
#include <unordered_set>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "barretenberg/client_ivc/client_ivc.hpp"
#include "barretenberg/client_ivc/mock_circuit_producer.hpp"
#include "barretenberg/client_ivc/test_bench_shared.hpp"
#include "barretenberg/common/assert.hpp"
#include "barretenberg/common/mem.hpp"
#include "barretenberg/common/test.hpp"
#include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp"
Expand Down Expand Up @@ -299,7 +300,7 @@ TEST_F(ClientIVCTests, WrongProofComponentFailure)

tampered_proof.goblin_proof.merge_proof = civc_proof_2.goblin_proof.merge_proof;

EXPECT_DEATH(ClientIVC::verify(tampered_proof, civc_vk_1), ".*IPA verification fails.*");
EXPECT_THROW_OR_ABORT(ClientIVC::verify(tampered_proof, civc_vk_1), ".*IPA verification fails.*");
}

{
Expand All @@ -308,7 +309,7 @@ TEST_F(ClientIVCTests, WrongProofComponentFailure)

tampered_proof.mega_proof = civc_proof_2.mega_proof;

EXPECT_DEATH(ClientIVC::verify(tampered_proof, civc_vk_1), ".*IPA verification fails.*");
EXPECT_THROW_OR_ABORT(ClientIVC::verify(tampered_proof, civc_vk_1), ".*IPA verification fails.*");
}

{
Expand All @@ -317,7 +318,7 @@ TEST_F(ClientIVCTests, WrongProofComponentFailure)

tampered_proof.goblin_proof.eccvm_proof = civc_proof_2.goblin_proof.eccvm_proof;

EXPECT_DEATH(ClientIVC::verify(tampered_proof, civc_vk_1), ".*IPA verification fails.*");
EXPECT_THROW_OR_ABORT(ClientIVC::verify(tampered_proof, civc_vk_1), ".*IPA verification fails.*");
}

{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// external_2: { status: not started, auditors: [], date: YYYY-MM-DD }
// =====================

#include "barretenberg/common/assert.hpp"
#include "barretenberg/srs/global_crs.hpp"
#define IPA_FUZZ_TEST
#include "./mock_transcript.hpp"
Expand Down Expand Up @@ -75,7 +76,7 @@ extern "C" void LLVMFuzzerInitialize(int*, char***)
// Don't use dereference casts, since the data may be not aligned and it causes segfault
uint256_t read_uint256(const uint8_t* data, size_t buffer_size = 32)
{
ASSERT(buffer_size <= 32);
BB_ASSERT_LTE(buffer_size, 32U);

uint64_t parts[4] = { 0, 0, 0, 0 };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ TEST_F(KZGTest, ZeroPolynomial)
}

// Sanity check
ASSERT(zero.is_zero());
ASSERT_TRUE(zero.is_zero());

const Fr challenge = Fr::random_element();
const Fr evaluation = zero.evaluate(challenge);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "barretenberg/commitment_schemes/claim.hpp"
#include "barretenberg/commitment_schemes/commitment_key.hpp"
#include "barretenberg/commitment_schemes/verification_key.hpp"
#include "barretenberg/common/assert.hpp"
#include "barretenberg/stdlib/primitives/curves/bn254.hpp"
#include "barretenberg/transcript/transcript.hpp"

Expand Down Expand Up @@ -373,7 +374,7 @@ template <typename Curve> class ShplonkVerifier_ {
, commitments({ quotient })
, scalars{ Fr{ 1 } }
{
ASSERT(num_claims > 1, "Using Shplonk with just one claim. Should use batch reduction.");
BB_ASSERT_GT(num_claims, 1U, "Using Shplonk with just one claim. Should use batch reduction.");
const size_t num_commitments = commitments.size();
commitments.reserve(num_commitments);
scalars.reserve(num_commitments);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ TYPED_TEST(ShplonkTest, ExportBatchClaimAndVerify)
// KZG verifier
auto final_proof_points =
KZG<curve::BN254>::reduce_verify_batch_opening_claim(batched_verifier_claim, verifier_transcript);
ASSERT(this->vk().pairing_check(final_proof_points[0], final_proof_points[1]));
ASSERT_TRUE(this->vk().pairing_check(final_proof_points[0], final_proof_points[1]));
} else {
// Verify IPA proof
auto vk = create_verifier_commitment_key<VerifierCommitmentKey<curve::Grumpkin>>();
Expand Down
Loading
Loading