From c14430dbff0f179aa752452a7ca8ae71ea4fac11 Mon Sep 17 00:00:00 2001 From: Suyash Bagad Date: Fri, 19 May 2023 01:28:20 +0530 Subject: [PATCH] Add missing `hash_index` while compressing vk. (https://github.com/AztecProtocol/barretenberg/pull/457) * Add missing `hash_index` while compressing vk. * comment back vk tests with hash index > 0. --- .../recursion/verification_key/verification_key.hpp | 9 +++++---- .../recursion/verification_key/verification_key.test.cpp | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/verification_key/verification_key.hpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/verification_key/verification_key.hpp index 915f63e5a32..0c91945554c 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/verification_key/verification_key.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/verification_key/verification_key.hpp @@ -339,7 +339,8 @@ template struct verification_key { return compressed_key; } - static barretenberg::fr compress_native(const std::shared_ptr& key, const size_t = 0) + static barretenberg::fr compress_native(const std::shared_ptr& key, + const size_t hash_index = 0) { std::vector preimage_data; @@ -365,10 +366,10 @@ template struct verification_key { barretenberg::fr compressed_key; if constexpr (Composer::type == ComposerType::PLOOKUP) { - compressed_key = - from_buffer(crypto::pedersen_commitment::lookup::compress_native(preimage_data)); + compressed_key = from_buffer( + crypto::pedersen_commitment::lookup::compress_native(preimage_data, hash_index)); } else { - compressed_key = crypto::pedersen_commitment::compress_native(preimage_data); + compressed_key = crypto::pedersen_commitment::compress_native(preimage_data, hash_index); } return compressed_key; } diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/verification_key/verification_key.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/verification_key/verification_key.test.cpp index b9cb01e079e..755d751ff27 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/verification_key/verification_key.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/verification_key/verification_key.test.cpp @@ -64,7 +64,7 @@ TYPED_TEST(VerificationKeyFixture, vk_data_vs_recursion_compress_native) EXPECT_EQ(vk_data.compress_native(0), RecursVk::compress_native(native_vk, 0)); // EXPECT_EQ(vk_data.compress_native(15), RecursVk::compress_native(native_vk, 15)); - // ne hash indeces still lead to ne compressions + // // ne hash indeces still lead to ne compressions // EXPECT_NE(vk_data.compress_native(0), RecursVk::compress_native(native_vk, 15)); // EXPECT_NE(vk_data.compress_native(14), RecursVk::compress_native(native_vk, 15)); } @@ -84,7 +84,7 @@ TYPED_TEST(VerificationKeyFixture, compress_vs_compress_native) EXPECT_EQ(recurs_vk->compress(0).get_value(), RecursVk::compress_native(native_vk, 0)); // EXPECT_EQ(recurs_vk->compress(15).get_value(), RecursVk::compress_native(native_vk, 15)); - // ne hash indeces still lead to ne compressions + // // ne hash indeces still lead to ne compressions // EXPECT_NE(recurs_vk->compress(0).get_value(), RecursVk::compress_native(native_vk, 15)); // EXPECT_NE(recurs_vk->compress(14).get_value(), RecursVk::compress_native(native_vk, 15)); }