Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
l1_to_l2_message_tree_check.test.cpp
Go to the documentation of this file.
2
3#include <gmock/gmock.h>
4#include <gtest/gtest.h>
5
9
10namespace bb::avm2::simulation {
11
12using ::testing::_;
13using ::testing::ElementsAre;
14using ::testing::Return;
15using ::testing::StrictMock;
16
18
19namespace {
20
21TEST(AvmSimulationL1ToL2MessageTree, Read)
22{
23 StrictMock<MockMerkleCheck> merkle_check;
24
27
28 std::vector<FF> sibling_path = { 1, 2, 3, 4, 5 };
29 AppendOnlyTreeSnapshot snapshot = {
30 .root = 123456,
31 .nextAvailableLeafIndex = 128,
32 };
33
34 FF msg_hash = 42;
35 uint64_t leaf_index = 30;
36
37 EXPECT_CALL(merkle_check, assert_membership(msg_hash, leaf_index, _, snapshot.root)).WillRepeatedly(Return());
38
39 EXPECT_TRUE(l1_to_l2_message_tree_check.exists(msg_hash, msg_hash, leaf_index, sibling_path, snapshot));
40 EXPECT_FALSE(l1_to_l2_message_tree_check.exists(27, msg_hash, leaf_index, sibling_path, snapshot));
41 EXPECT_THAT(event_emitter.dump_events(),
42 ElementsAre(
44 .msg_hash = msg_hash,
45 .leaf_value = msg_hash,
46 .leaf_index = leaf_index,
47 .snapshot = snapshot,
48 },
50 .msg_hash = 27,
51 .leaf_value = msg_hash,
52 .leaf_index = leaf_index,
53 .snapshot = snapshot,
54 }));
55}
56
57} // namespace
58
59} // namespace bb::avm2::simulation
EventEmitter< DataCopyEvent > event_emitter
TEST(EmitUnencryptedLogTest, Basic)
AvmFlavorSettings::FF FF
Definition field.hpp:10