Skip to content

chore: ecc group audit 1- remove dead code, documentation and test#20886

Merged
kashbrti merged 17 commits intomerge-train/barretenbergfrom
kb/group_audit
Mar 3, 2026
Merged

chore: ecc group audit 1- remove dead code, documentation and test#20886
kashbrti merged 17 commits intomerge-train/barretenbergfrom
kb/group_audit

Conversation

@kashbrti
Copy link
Contributor

@kashbrti kashbrti commented Feb 26, 2026

there's lots of code that is never used in ecc/group module, especially in WNAF implementation.
This PR removes most of the unused code.
We also:

  • add documentation for WNAF
  • add edge case testing for WNAF

iakovenkos and others added 11 commits February 2, 2026 21:37
added md explaining the flow + a bit of renaming
Primary changes:
- Replace methods of the form `get_*_gate_connected_component` with
`GatePattern` structs that specify the conditions under which each wire
is constrained for each gate type
- Test correctness of `GatePattern`'s by perturbing relation inputs to
empirically check which wires are constrained (`gate_patterns.test.cpp`)
- Resolves a few bugs/errors identified by the aforementioned tests (see
PR comments)
- Use `update_used_witnesses` in `fix_witness` to avoid need for ad-hoc
handling in the tooling

Cleanup:
- Replace use of `block_idx` with reference to `block` in several places
for improved clarity

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
@kashbrti kashbrti changed the title Kb/group audit chore:(ecc/group audit) remove dead code Feb 26, 2026
@kashbrti kashbrti marked this pull request as ready for review March 2, 2026 10:03

#ifndef DISABLE_ASM

#include "barretenberg/ecc/groups/group.hpp"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was only used in self_mixed_add_or_sub which was never used. our scalar multiplication function already does the conditional negation

Copy link
Contributor

Choose a reason for hiding this comment

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

Delete the file altogether?

// }

template <typename Fq, typename Fr, typename Params>
inline void group<Fq, Fr, Params>::conditional_negate_affine(const affine_element* src,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

same explanation

@kashbrti kashbrti changed the title chore:(ecc/group audit) remove dead code chore: ecc group audit remove dead code Mar 2, 2026
@kashbrti kashbrti requested a review from ledwards2225 March 2, 2026 10:32
@kashbrti kashbrti changed the title chore: ecc group audit remove dead code chore: ecc group audit 1- remove dead code, documentation and test Mar 2, 2026
@ledwards2225 ledwards2225 requested a review from suyash67 March 2, 2026 18:03
uint256_t compressed = P.compress();
uint256_t compressed = uint256_t(P.x);
if (uint256_t(P.y).get_bit(0)) {
compressed.data[3] |= 0x8000000000000000ULL;
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe declare 0x8000000000000000ULL as a static constant somewhere, especially if its being used in multiple places.

}

/**
* Current flow...
Copy link
Contributor

Choose a reason for hiding this comment

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

So glad we're getting rid of unused stuff here!

Copy link
Contributor

@suyash67 suyash67 left a comment

Choose a reason for hiding this comment

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

Good stuff, thanks for doing this!

@kashbrti kashbrti enabled auto-merge (squash) March 3, 2026 15:28
@kashbrti kashbrti merged commit 2799c35 into merge-train/barretenberg Mar 3, 2026
10 checks passed
@kashbrti kashbrti deleted the kb/group_audit branch March 3, 2026 15:39
github-merge-queue bot pushed a commit that referenced this pull request Mar 3, 2026
BEGIN_COMMIT_OVERRIDE
chore: ecc group audit 1- remove dead code, documentation and test
(#20886)
chore: chonk proof compression poc (#20645)
feat: reduce CRS and polynomial memory for non-ZK proofs (#20731)
END_COMMIT_OVERRIDE
johnathan79717 pushed a commit that referenced this pull request Mar 4, 2026
…20886)

there's lots of code that is never used in ecc/group module, especially
in WNAF implementation.
This PR removes most of the unused code. 
We also: 
- add documentation for WNAF 
- add edge case testing for WNAF

---------

Co-authored-by: sergei iakovenko <105737703+iakovenkos@users.noreply.github.com>
Co-authored-by: ledwards2225 <98505400+ledwards2225@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: AztecBot <tech@aztecprotocol.com>
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.

4 participants