-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(barretenberg): Graph methods for circuit analysis (part 2) #12130
base: master
Are you sure you want to change the base?
Conversation
6a67e67
to
86f9a35
Compare
|
||
/** | ||
all these tests check graph description for sha256 circuits. All circuits have to consist from 1 connected component | ||
all these tests check graph description for sha256 circuits. All circuits have to consist of 1 connected component | ||
*/ | ||
|
||
TEST(boomerang_stdlib_sha256, test_graph_for_sha256_55_bytes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to add separate descriptions to each test. If I go to the last one, I don't know that there is a description here.
EXPECT_EQ(variables_in_one_gate.size(), 0); | ||
if (variables_in_one_gate.size() > 0) { | ||
for (const auto& elem : variables_in_one_gate) { | ||
info("elem == ", elem); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to remove info from tests in the general case, but here it's not an issue since the branch is not being taken
auto variables_in_one_gate = graph.show_variables_in_one_gate(circuit_constructor); | ||
bool result = num_connected_components == 256; | ||
EXPECT_EQ(result, true); | ||
[[maybe_unused]] auto variables_in_one_gate = graph.show_variables_in_one_gate(circuit_constructor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this unused?
auto connected_components = graph.find_connected_components(); | ||
EXPECT_EQ(connected_components.size(), 1); | ||
auto variables_in_one_gate = graph.show_variables_in_one_gate(builder); | ||
EXPECT_EQ(variables_in_one_gate.size(), 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are there 2?
fq_ct b(witness_ct(&builder, fr(uint256_t(inputs[1]).slice(0, fq_ct::NUM_LIMB_BITS * 2))), | ||
witness_ct(&builder, fr(uint256_t(inputs[1]).slice(fq_ct::NUM_LIMB_BITS * 2, fq_ct::NUM_LIMB_BITS * 4)))); | ||
fq_ct c = a * b; | ||
for (size_t i = 0; i < num_repetitions; ++i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to repeat these operations
{ | ||
auto builder = Builder(); | ||
size_t num_repetitions = 4; | ||
for (size_t i = 0; i < num_repetitions; ++i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to repeat these operations
{ | ||
auto builder = Builder(); | ||
size_t num_repetitions = 10; | ||
for (size_t i = 0; i < num_repetitions; ++i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and basically everywhere further there is no need to repeat operations
This PR continues Graph Description for Ultra Circuit Builder.
There were added functions for processing:
There were tested primitives like Poseidon2s hash function, Dynamic Array and Bigfield. Poseidon and Dynamic Array have been fully tested. Bigfield has been tested halfway.
There has been completed function for arithmetic block. (q_arith == 3 case), and it processes fix_witness another way.
There was added new filtering mechanism for finalize_circuit() function using tau and range tags, filtering mechanism for RAM/ROM gate and filtering mechanism for variables that were fixed.
Also there was added new data structure for containing information about gates for every variable. It can be helpful in further filtering mechanisms or debugging process.
No vulnerabilities were found by static analyzer.