Skip to content

Conversation

@defkit
Copy link
Contributor

@defkit defkit commented Feb 9, 2026

This PR introduces EcAdd constraints processing

Currently we only check that gates, created by is_on_curve check exist

Also introduced helpers for boomerang_value_detection, which might help to find the default gate results (field_t: +, *, madd, add_two, conditional_assign; and for bools) from the witnesses

return Bool<CircuitBuilder>{ result_idx, bool_ct::from_witness_index_unsafe(&builder, result_idx) };
}
}
throw std::runtime_error("No normalization gate found for bool " + std::to_string(a_idx));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't use optional, because it is way too verbose to handle every var

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can choose to throw or return after the first finding in a higher-level functions, but putting just a throw is not a very good practice. What if we decide to parallelize discovery? We'll get different exceptions each time

@defkit defkit requested a review from Rumata888 February 10, 2026 12:02
@AztecBot
Copy link
Collaborator

AztecBot commented Feb 10, 2026

Flakey Tests

🤖 says: This CI run detected 1 tests that failed, but were tolerated due to a .test_patterns.yml entry.

\033FLAKED\033 (8;;http://ci.aztec-labs.com/95c65e280679f112�95c65e280679f1128;;�): yarn-project/scripts/run_test.sh p2p/src/client/test/p2p_client.integration_message_propagation.test.ts (22s) (code: 1) group:e2e-p2p-epoch-flakes

Copy link
Contributor

@Rumata888 Rumata888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please replace throws with optional at the helper level.
You are using the same mechanism for searching the arithmetic gates in several places. It can be implemented once and then reused.
The algorithm you are using will have total complexity O(kn), where k is the number of elliptic gates and n the size of the circuit. This is bad. You should first go through the whole circuit and store a mapping (variable index -> vector (gate, witness index)). Then you'll be able to quickly retrieve the gates which contain those witnesses and only go through them.
For the constant gates it's better to parse them once and then just check against the hashmap.

return Bool<CircuitBuilder>{ result_idx, bool_ct::from_witness_index_unsafe(&builder, result_idx) };
}
}
throw std::runtime_error("No normalization gate found for bool " + std::to_string(a_idx));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can choose to throw or return after the first finding in a higher-level functions, but putting just a throw is not a very good practice. What if we decide to parallelize discovery? We'll get different exceptions each time

FF q_r = FF::zero();
for (size_t gate_idx = 0; gate_idx < builder.blocks.arithmetic.size(); gate_idx++) {
bool condition = true;
condition &= builder.blocks.arithmetic.w_l()[gate_idx] == a_idx;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The complexity for these checks is O(n). That's bad

@defkit defkit requested a review from Rumata888 February 11, 2026 08:09
Copy link
Contributor

@Rumata888 Rumata888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some descriptions, please

#include <vector>

namespace cdg {
template <typename CircuitBuilder, typename FF> class FilterFunctionBuilder {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 0 comments in the file. What is it used for?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants