Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
class_id_derivation_trace.test.cpp
Go to the documentation of this file.
1#include <gmock/gmock.h>
2#include <gtest/gtest.h>
3
4#include <cstdint>
5
11
12namespace bb::avm2::tracegen {
13namespace {
14
15using testing::ElementsAre;
16using testing::Field;
17
19
20TEST(ClassIdDerivationTraceGenTest, TraceGeneration)
21{
22 TestTraceContainer trace;
23 ClassIdDerivationTraceBuilder builder;
24
25 ContractClassId class_id = FF(0xdeadbeef);
26 ContractClass klass{
27 .artifact_hash = FF(12),
28 .private_function_root = FF(23),
29 .public_bytecode_commitment = FF(45),
30 .packed_bytecode = {},
31 };
32 builder.process({ { .class_id = class_id, .klass = klass } }, trace);
33
34 EXPECT_THAT(trace.as_rows(),
35 ElementsAre(
36 // Only one row.
37 AllOf(ROW_FIELD_EQ(class_id_derivation_sel, 1),
38 ROW_FIELD_EQ(class_id_derivation_class_id, FF(0xdeadbeef)),
39 ROW_FIELD_EQ(class_id_derivation_artifact_hash, FF(12)),
40 ROW_FIELD_EQ(class_id_derivation_private_function_root, FF(23)),
41 ROW_FIELD_EQ(class_id_derivation_public_bytecode_commitment, FF(45)))));
42}
43
44} // namespace
45} // namespace bb::avm2::tracegen
void process(const simulation::EventEmitterInterface< simulation::AluEvent >::Container &events, TraceContainer &trace)
std::vector< AvmFullRowConstRef > as_rows() const
AluTraceBuilder builder
Definition alu.test.cpp:123
TestTraceContainer trace
#define ROW_FIELD_EQ(field_name, expression)
Definition macros.hpp:15
TEST(EmitUnencryptedLogTest, Basic)
FF ContractClassId
AvmFlavorSettings::FF FF
Definition field.hpp:10