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

Avoid recomputing Ge normalized from Gej in Nonce process #168

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sanket1729
Copy link
Member

@sanket1729 sanket1729 commented Feb 18, 2022

In secp256k1_musig_nonce_process(), we already have aggnonce in
normalized form. We don't need to recompute them again in
secp256k1_musig_nonce_process_internal().

Moved the adaptor logic to the internal function.

  • When the adaptor is NULL, there is no need to convert between gej and ge.
  • When the adaptor is not NULL, we only convert the required aggnonce[0]

@@ -450,7 +447,7 @@ int secp256k1_musig_nonce_process(const secp256k1_context* ctx, secp256k1_musig_
}
secp256k1_gej_add_ge_var(&aggnonce_ptj[0], &aggnonce_ptj[0], &adaptorp, NULL);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the PR! I think you need to take this line into account. The [0] aggnonce may have changed, so we need to convert the changed nonce back to ge. (I don't think the same is necessary for [1])

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved the adaptor logic to the internal function.

  1. When the adaptor is NULL, there is no need to convert between gej and ge.
  2. When the adaptor is not NULL, we only convert the required aggnonce[0]

@sanket1729 sanket1729 force-pushed the nonce_agg_patch branch 2 times, most recently from 1b971c0 to 9ce21fa Compare April 17, 2022 00:57
In secp256k1_musig_nonce_process(), we already have aggnonce in
normalized form. We don't need to recompute them again in
secp256k1_musig_nonce_process_internal().
Copy link
Collaborator

@real-or-random real-or-random left a comment

Choose a reason for hiding this comment

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

Concept ACK

}
if (!secp256k1_musig_nonce_process_internal(&session_i.fin_nonce_parity, fin_nonce, &session_i.noncecoef, aggnonce_ptj, agg_pk32, msg32)) {

if (!secp256k1_musig_nonce_process_internal(ctx, &session_i.fin_nonce_parity, fin_nonce, &session_i.noncecoef, aggnonce_ptj, aggnonce_pt, agg_pk32, msg32, adaptor)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wouldn't it be clearer to pass only the ges to secp256k1_musig_nonce_process_internal and compute the gejs only there?

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.

2 participants