Skip to content

[Zellic Audit] 3.12 Incomplete handling of G1 point addition#379

Merged
Hakkush-07 merged 5 commits intoBitVM:mainfrom
chainwayxyz:hinted_check_add
Nov 11, 2025
Merged

[Zellic Audit] 3.12 Incomplete handling of G1 point addition#379
Hakkush-07 merged 5 commits intoBitVM:mainfrom
chainwayxyz:hinted_check_add

Conversation

@Hakkush-07
Copy link
Copy Markdown
Collaborator

@Hakkush-07 Hakkush-07 commented Sep 11, 2025

I created a different version of G1Affine::hinted_check_add.

  • G1Affine::hinted_check_add_prevent_degenerate() is the old G1Affine::hinted_check_add, additionally some asserts that ensure the given points do not satisfy t==q or t==-q. The caller must use this function if they are sure of this.
  • G1Affine::hinted_check_add() is a more general version. It handles the excluded cases above. However, this results in substantially larger script size since it includes both the addition and doubling parts together. (618763 >> 275192)

To achieve this, I added Fq::equal_keep_elements() function that simply checks equality without consuming the elements.

We continue to use the version that excludes these cases, because they do not occur currently.

Edit: Newly added function is optimized from 618763 to 481633 bytes. It now merges the same operations for doubling and adding. And a TODO is added to hints in this function so that later we must add hint validity checks.

closes #302

@Hakkush-07 Hakkush-07 changed the title 3.12 Incomplete handling of G1 point addition [Zellic Audit] 3.12 Incomplete handling of G1 point addition Sep 11, 2025
@just-erray just-erray deleted the hinted_check_add branch September 12, 2025 11:50
@Hakkush-07 Hakkush-07 restored the hinted_check_add branch September 12, 2025 13:14
@Hakkush-07 Hakkush-07 merged commit a977a21 into BitVM:main Nov 11, 2025
5 checks passed
@Hakkush-07 Hakkush-07 deleted the hinted_check_add branch November 11, 2025 09:35
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.

[Zellic Audit] G1Affine::hinted_check_add has a soundness issue (Mohit 2 11.06)

2 participants