3#include "gmock/gmock.h"
5#include <gtest/gtest.h>
24using ::testing::AllOf;
25using ::testing::ElementsAre;
26using ::testing::Field;
27using ::testing::Return;
28using ::testing::SizeIs;
29using ::testing::StrictMock;
35class BytecodeHashingTest :
public ::testing::Test {
46TEST_F(BytecodeHashingTest, SimpleHash)
49 FF hash =
FF(
"0x09348974e76c3602893d7a4b4bb52c2ec746f1ade5004ac471d0fbb4587a81a6");
51 std::vector<FF> bytecode_fields = {};
52 for (uint32_t i = 1; i < 100; i++) {
53 bytecode_fields.push_back(
FF(i));
57 for (
auto bytecode_field : bytecode_fields) {
65 EXPECT_CALL(
poseidon2, hash(bytecode_fields)).WillOnce(Return(hash));
76TEST_F(BytecodeHashingTest, Hash)
81 prepended_bytecode_fields.reserve(1 + bytecode_fields.size());
82 prepended_bytecode_fields.insert(prepended_bytecode_fields.end(), bytecode_fields.begin(), bytecode_fields.end());
85 EXPECT_CALL(
poseidon2, hash(prepended_bytecode_fields)).WillOnce(Return(hash));
std::shared_ptr< Napi::ThreadSafeFunction > bytecode
BytecodeHasher bytecode_hasher
EventEmitter< BytecodeHashingEvent > hashing_events
void assert_public_bytecode_commitment(const BytecodeId &bytecode_id, const std::vector< uint8_t > &bytecode, const FF &public_bytecode_commitment) override
static FF hash(const std::vector< FF > &input)
Hashes a vector of field elements.
AVM range check gadget for witness generation.
std::vector< FF > encode_bytecode(std::span< const uint8_t > bytecode)
FF compute_public_bytecode_first_field(size_t bytecode_size)
std::vector< uint8_t > random_bytes(size_t n)
TEST_F(IPATest, ChallengesAreZero)
std::vector< uint8_t > to_buffer(T const &value)
std::vector< FF > bytecode_fields