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

Improved performance for ecdsa. #4985

Merged
merged 1 commit into from
Feb 4, 2024
Merged

Conversation

orizi
Copy link
Collaborator

@orizi orizi commented Feb 4, 2024

This change is Reviewable

This was referenced Feb 4, 2024
@orizi orizi force-pushed the pr/orizi/cairo-performance/b55c2287 branch 2 times, most recently from 87040db to e28ccf6 Compare February 4, 2024 08:55
Copy link
Contributor

@gilbens-starkware gilbens-starkware left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 6 files at r1, all commit messages.
Reviewable status: 1 of 6 files reviewed, 2 unresolved discussions (waiting on @ilyalesokhin-starkware and @orizi)


corelib/src/ec.cairo line 92 at r1 (raw file):

        ec_state_add(ref self, :p);
    }
    /// Adds a point to the computation.

Subs

Code quote:

Adds

corelib/src/ec.cairo line 129 at r1 (raw file):

        Option::Some(EcPointTrait::new_nz(:x, :y)?.into())
    }
    /// Creates a new EC point from its (x, y) coordinates.

Same below.

Suggestion:

new NonZero EC

Copy link
Contributor

@gilbens-starkware gilbens-starkware left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 6 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @ilyalesokhin-starkware and @orizi)

Copy link
Collaborator Author

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @gilbens-starkware and @ilyalesokhin-starkware)


corelib/src/ec.cairo line 92 at r1 (raw file):

Previously, gilbens-starkware (Gil Ben-Shachar) wrote…

Subs

Done.


corelib/src/ec.cairo line 129 at r1 (raw file):

Previously, gilbens-starkware (Gil Ben-Shachar) wrote…

Same below.

Done.

@orizi orizi force-pushed the pr/orizi/cairo-performance/7c826776 branch from 11c9566 to 935d069 Compare February 4, 2024 09:14
@orizi orizi force-pushed the pr/orizi/cairo-performance/b55c2287 branch from e28ccf6 to 8a7e76f Compare February 4, 2024 09:14
Copy link
Contributor

@gilbens-starkware gilbens-starkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @ilyalesokhin-starkware)

@orizi orizi force-pushed the pr/orizi/cairo-performance/7c826776 branch from 935d069 to 19d49d5 Compare February 4, 2024 09:22
@orizi orizi force-pushed the pr/orizi/cairo-performance/b55c2287 branch from 8a7e76f to ce2ace2 Compare February 4, 2024 09:22
Copy link
Contributor

@gilbens-starkware gilbens-starkware left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ilyalesokhin-starkware)

@orizi orizi changed the base branch from pr/orizi/cairo-performance/7c826776 to main February 4, 2024 09:36
@orizi orizi force-pushed the pr/orizi/cairo-performance/b55c2287 branch from ce2ace2 to 58700f5 Compare February 4, 2024 09:36
@ilyalesokhin-starkware
Copy link
Contributor

corelib/src/ecdsa.cairo line 82 at r3 (raw file):

    // Calculate a state with `z * G`.
    let mut zG_state = init_ec.clone();

why clone instead of creating a new one?

Code quote:

let mut zG_state = init_ec.clone();

@ilyalesokhin-starkware
Copy link
Contributor

corelib/src/ecdsa.cairo line 95 at r3 (raw file):

    // Check the `(zG + rQ).x = sR.x` case.
    let mut zG_plus_eQ_state = zG_state.clone();

why clone?

Code quote:

let mut zG_plus_eQ_state = zG_state.clone();

Copy link
Collaborator Author

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ilyalesokhin-starkware)


corelib/src/ecdsa.cairo line 82 at r3 (raw file):

Previously, ilyalesokhin-starkware wrote…

why clone instead of creating a new one?

much cheaper - it is copyable - but would not like to let people use without noting the differences.

@ilyalesokhin-starkware
Copy link
Contributor

corelib/src/ecdsa.cairo line 95 at r3 (raw file):

Previously, ilyalesokhin-starkware wrote…

why clone?

nvm I see that you are using it twice.

@ilyalesokhin-starkware
Copy link
Contributor

corelib/src/ecdsa.cairo line 108 at r3 (raw file):

    // Check the `(zG - rQ).x = sR.x` case.
    let mut zG_minus_eQ_state = zG_state.clone();

Do you need to clone here? isn't this the last use?

Code quote:

zG_state.clone();

Copy link
Collaborator Author

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @ilyalesokhin-starkware)


corelib/src/ecdsa.cairo line 108 at r3 (raw file):

Previously, ilyalesokhin-starkware wrote…

Do you need to clone here? isn't this the last use?

Done.

@orizi orizi force-pushed the pr/orizi/cairo-performance/b55c2287 branch from 58700f5 to 7627e89 Compare February 4, 2024 14:15
@orizi orizi enabled auto-merge February 4, 2024 14:16
@orizi orizi added this pull request to the merge queue Feb 4, 2024
Merged via the queue into main with commit 04f1a46 Feb 4, 2024
82 of 83 checks passed
@orizi orizi deleted the pr/orizi/cairo-performance/b55c2287 branch February 14, 2024 11:54
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