Skip to content
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

refac: upstream latest plonky2 #7

Merged
merged 4 commits into from
Sep 6, 2024
Merged

Conversation

Insun35
Copy link

@Insun35 Insun35 commented Sep 3, 2024

This PR includes changes to make it compatible with latest Plonky2.

  • Add a condition for when the limb length are different that checks if all extra limbs are zero.
  • Update plonky2-ecdsa dependency with patched version.

Copy link

@silathdiir silathdiir left a comment

Choose a reason for hiding this comment

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

LGTM!

Cargo.toml Outdated
@@ -13,7 +13,7 @@ ark-std = "0.4.0"
num-bigint = "0.4.3"
num-traits = "0.2"
rand = "0.8.5"
plonky2_ecdsa = { git = "https://github.com/Lagrange-Labs/plonky2-ecdsa", features = [
plonky2_ecdsa = { git = "https://github.com/Lagrange-Labs/plonky2-ecdsa", rev = "5dd47af", features = [

Choose a reason for hiding this comment

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

May need to update after merging PR Lagrange-Labs/plonky2-ecdsa#3.

Copy link
Author

Choose a reason for hiding this comment

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

Updated in commit c37edcd. Thanks!

Copy link
Collaborator

@nikkolasg nikkolasg left a comment

Choose a reason for hiding this comment

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

Approve for sake of time but left a comment, doesn't seem necessary to me this new function but maybe i'm missing something.
And Lagrange-Labs/plonky2-ecdsa#3 have been merged so you can update deps 🙏

}
}

fn compare_same_length(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry I fail to see why the two functions are different - if you give same length inputs to the compare_different_lengths then it should be returning the same no ?
I think the only change required is to move if lhs.len() < rhs.len() to if lhs.len() <= rhs.len().
In case it's equal for &limb in longer.iter().skip(shorter.len()) { will never run so it'll give the same results no ?

TLDR do we really need this new function ?

Copy link
Author

Choose a reason for hiding this comment

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

Makes sense, it could be simplified as you said. Fixed in commit 698cc66, thanks!

@silathdiir silathdiir merged commit edb7761 into update-plonky2 Sep 6, 2024
1 check passed
@silathdiir silathdiir deleted the lsc-plonky2-patch branch September 6, 2024 11:34
silathdiir added a commit that referenced this pull request Sep 6, 2024
* Update `plonky2`.

* Delete the useless patch `plonky2_field`.

* refac: upstream latest plonky2 (#7)

* fix: add fq comparison logic with different limb length

* build: fix plonky2_ecdsa rev

* build: remove rev from plonky2_ecdsa deps

* refac: simplify conditions without using helper functions

---------

Co-authored-by: Merlyn <[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.

3 participants