Skip to content

Conversation

@Hakkush-07
Copy link
Collaborator

@Hakkush-07 Hakkush-07 commented Nov 29, 2024

This PR fixes the issue with affine infinity as the inputs of affine_add and affine_double functions. Also, T+(2^w-1)T logic is changed to w times doubling in G1 scalar multiplication. Slightly (around %6) increases the script size. This error occurs mainly for small public inputs so some tests covering this are added. Closes #137


type_acc = update;

for _ in (i_step / 3)..(2 * i_step / 3) {
Copy link
Contributor

Choose a reason for hiding this comment

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

could there be a case where depth > (i_step/3) but less than (2* i_step / 3) ? in that case it seems like execution of this loop will not be necessary.
for i_step = 12, it will not be the case, as the final loop has depth = 2 (=254 - 12n) so control won't flow to this branch so is not a problem.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes you are right. I knew it will not be problem for i_step=12 as you indicated but better include all possible cases properly. done.

@lucidLuckylee
Copy link
Contributor

Thank you for looking into the issue!

@lucidLuckylee lucidLuckylee merged commit 9332a09 into BitVM:main Dec 2, 2024
@Hakkush-07 Hakkush-07 deleted the affine-infinity-fix branch December 4, 2024 11:07
@wz14 wz14 mentioned this pull request Dec 7, 2024
wz14 pushed a commit to bitlayer-org/BitVM that referenced this pull request Dec 16, 2024
* add unsuccessful tests with small scalars

* add affine infinity if checks to native groth16 and change doubling method

* add affine infinity if checks to hinted groth16 and change doubling method

* add affine infinity if checks to chunked groth16 and change doubling method

* move if infinity checks in scalar mul to check_add and check_double functions

* fix G1:affine is_zero_keep_element

* fix the segment if-checks comparing depth and i_step in chunked scalar mul and refactor

---------

Co-authored-by: sevkett12 <[email protected]>
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.

Proofs with Bad Scalar format in MSM

4 participants