Skip to content

Commit c8a2339

Browse files
committed
comments updated
1 parent e9d0d5a commit c8a2339

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

barretenberg/cpp/src/barretenberg/stdlib/primitives/databus/databus.test.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ TEST(Databus, CallDataAndReturnData)
7878
EXPECT_TRUE(CircuitChecker::check(builder));
7979
}
8080

81+
/**
82+
* @brief An expository test demonstrating the functionality of the databus in a small use case when the entries are
83+
* constant witnesses
84+
*/
8185
TEST(Databus, ConstantEntryAccess)
8286
{
8387

@@ -99,6 +103,10 @@ TEST(Databus, ConstantEntryAccess)
99103
EXPECT_TRUE(CircuitChecker::check(builder));
100104
}
101105

106+
/**
107+
* @brief An expository test demonstrating the functionality of the databus in a small use case when the entries of the
108+
* bus_vector are not normalized
109+
*/
102110
TEST(Databus, UnnormalizedEntryAccess)
103111
{
104112

@@ -114,7 +122,7 @@ TEST(Databus, UnnormalizedEntryAccess)
114122
std::vector<field_ct> returndata_entries;
115123
for (fr entry : raw_returndata_entries) {
116124
field_ct entry_witness = witness_ct(&builder, entry);
117-
// add the value to itself to make it unnormalized
125+
// add the value to itself to make it unnormalized (the multiplicative constant will be 2)
118126
returndata_entries.emplace_back(entry_witness + entry_witness);
119127
}
120128
databus.calldata.set_values(calldata_entries);
@@ -128,21 +136,24 @@ TEST(Databus, UnnormalizedEntryAccess)
128136
EXPECT_TRUE(CircuitChecker::check(builder));
129137
}
130138

139+
/**
140+
* @brief An expository test demonstrating the functionality of the databus in a small use case where the indices are
141+
* constant and/or unnormalized
142+
*/
131143
TEST(Databus, ConstantAndUnnormalizedIndices)
132144
{
133145
Builder builder;
134146
databus_ct databus;
135147
std::array<fr, 3> raw_calldata_values = { 54, 32, 30 };
136148
std::array<fr, 3> raw_returndata_values = { 54, 32, 116 };
137-
// make the two first elements constants and the second two elements non-normalized
138149
// Populate the calldata in the databus
139150
std::vector<field_ct> calldata_values;
140151
for (auto& value : raw_calldata_values) {
141152
calldata_values.emplace_back(witness_ct(&builder, value));
142153
}
143154
databus.calldata.set_values(calldata_values);
144155

145-
// Populate the return data in the databus std::vector<field_ct> return_data_values;
156+
// Populate the return data in the databus
146157
std::vector<field_ct> returndata_values;
147158
for (auto& value : raw_returndata_values) {
148159
returndata_values.emplace_back(witness_ct(&builder, value));

0 commit comments

Comments
 (0)