Skip to content

Commit

Permalink
Add missing hash_index while compressing vk. (AztecProtocol/barrete…
Browse files Browse the repository at this point in the history
…nberg#457)

* Add missing `hash_index` while compressing vk.

* comment back vk tests with hash index > 0.
  • Loading branch information
suyash67 authored May 18, 2023
1 parent 219c307 commit c14430d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,8 @@ template <typename Curve> struct verification_key {
return compressed_key;
}

static barretenberg::fr compress_native(const std::shared_ptr<plonk::verification_key>& key, const size_t = 0)
static barretenberg::fr compress_native(const std::shared_ptr<plonk::verification_key>& key,
const size_t hash_index = 0)
{
std::vector<uint8_t> preimage_data;

Expand All @@ -365,10 +366,10 @@ template <typename Curve> struct verification_key {

barretenberg::fr compressed_key;
if constexpr (Composer::type == ComposerType::PLOOKUP) {
compressed_key =
from_buffer<barretenberg::fr>(crypto::pedersen_commitment::lookup::compress_native(preimage_data));
compressed_key = from_buffer<barretenberg::fr>(
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand All @@ -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));
}

0 comments on commit c14430d

Please sign in to comment.