-
Notifications
You must be signed in to change notification settings - Fork 12
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
Rename sk_r
and pk_r
to note_..
#157
Conversation
c0b5dc9
to
d432b25
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just the comment about the address.
Plus, as a reflexion, I'd prefer the variables to be called nsk
and npk
, but I understand that calling em note_sk
and note_pk
is much more readable, so it's fine to me!
src/keys/stealth.rs
Outdated
} | ||
|
||
/// Gets the underline `JubJubExtended` point of `pk_r` | ||
/// Gets the underline `JubJubExtended` point of `note_pk` | ||
pub fn address(&self) -> &JubJubExtended { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as this is returning the note_pk
, I'd call this function like this. In our context the address is the static public key. Otherwise if we refer to the stealth address, we must consider the tuple (note_pk, R)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also not entirely happy with the address
function.
We already have a method called note_pk
(formerly pk_r
) of the StealthAddress
that returns a NotePublicKey
(which is just a wrapped JubJubExtended
) so I cannot use the same function name here again.
If we want to get the internal point in NotePublicKey
we currently have two options:
// without `address` method
let jubjub_point = stealth_address.note_pk().as_ref();
// with `address` method
let jubjub_point = stealth_address.address();
I think the second one is nicer but of course only if the concept of an 'address' somewhat makes sense.
Any thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding my two cents here. I think having a StealthAddress::address
function is a bit... redundant to say the least, and confusing in the worst case. That said, I also understand the stealth_address.note_pk().as_ref()
is unsatisfactory.
Maybe we should improve the access to the underlying JubJubScalar
in NotePublicKey
in a future PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree and removed the address
method. I also agree that we need to address the as_ref()
API, this needs to be done in jubjub-schnorr
though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Added two places where the docs might be updated. Will approve and leave it up to you whether to change it or not.
Yes, that's also an option. I'll do it like this in the changes and the stack bump because if I follow the convention |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice. Approved. Added my two cents to the address
debate
src/keys/stealth.rs
Outdated
} | ||
|
||
/// Gets the underline `JubJubExtended` point of `pk_r` | ||
/// Gets the underline `JubJubExtended` point of `note_pk` | ||
pub fn address(&self) -> &JubJubExtended { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding my two cents here. I think having a StealthAddress::address
function is a bit... redundant to say the least, and confusing in the worst case. That said, I also understand the stealth_address.note_pk().as_ref()
is unsatisfactory.
Maybe we should improve the access to the underlying JubJubScalar
in NotePublicKey
in a future PR?
2994001
to
560b72e
Compare
Also remove `StealthAddress::address` method since it is a duplicate of `StealthAddress.note_pk().as_ref()`. Resolves #156
560b72e
to
e669086
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Resolves #156