Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
ultra_verification_keys_comparator.hpp
Go to the documentation of this file.
3#include <array>
4#include <memory>
5namespace bb {
6
7template <typename OuterFlavor>
8static void compare_ultra_blocks_and_verification_keys(
10 std::array<std::shared_ptr<typename OuterFlavor::VerificationKey>, 2> verification_keys)
11{
12
13 // Retrieves the trace blocks (each consisting of a specific gate) from the recursive verifier circuit
14
15 bool broke(false);
16 auto check_eq = [&broke](auto& p1, auto& p2, size_t block_idx, size_t selector_idx) {
17 BB_ASSERT_EQ(p1.size(), p2.size());
18 for (size_t idx = 0; idx < p1.size(); idx++) {
19 if (p1[idx] != p2[idx]) {
20 info("Mismatch selector ", selector_idx, " in block ", block_idx, ", at ", idx);
21 broke = true;
22 break;
23 }
24 }
25 };
26
27 size_t block_idx = 0;
28 for (auto [block_0, block_1] : zip_view(blocks[0].get(), blocks[1].get())) {
29 BB_ASSERT_EQ(block_0.get_selectors().size(), block_1.get_selectors().size());
30 size_t selector_idx = 0;
31 for (auto [p_10, p_11] : zip_view(block_0.get_selectors(), block_1.get_selectors())) {
32 check_eq(p_10, p_11, block_idx, selector_idx);
33 selector_idx++;
34 }
35 block_idx++;
36 }
37
38 typename OuterFlavor::CommitmentLabels labels;
39 for (auto [vk_0, vk_1, label] :
40 zip_view(verification_keys[0]->get_all(), verification_keys[1]->get_all(), labels.get_precomputed())) {
41 if (vk_0 != vk_1) {
42 broke = true;
43 info("Mismatch verification key label: ", label, " left: ", vk_0, " right: ", vk_1);
44 }
45 }
46
47 BB_ASSERT_EQ(verification_keys[0]->log_circuit_size, verification_keys[1]->log_circuit_size);
48 BB_ASSERT_EQ(verification_keys[0]->num_public_inputs, verification_keys[1]->num_public_inputs);
49 BB_ASSERT_EQ(verification_keys[0]->pub_inputs_offset, verification_keys[1]->pub_inputs_offset);
50
51 BB_ASSERT(!broke);
52}
53
54} // namespace bb
#define BB_ASSERT(expression,...)
Definition assert.hpp:80
#define BB_ASSERT_EQ(actual, expected,...)
Definition assert.hpp:93
void info(Args... args)
Definition log.hpp:89
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13