Skip to content

Return ref from enc ciphertext#3

Merged
dmidem merged 9 commits intozsa1from
return-ref-from-enc-ciphertext
Aug 19, 2024
Merged

Return ref from enc ciphertext#3
dmidem merged 9 commits intozsa1from
return-ref-from-enc-ciphertext

Conversation

@dmidem
Copy link

@dmidem dmidem commented Aug 8, 2024

This PR updates the ShieldedOutput implementation and OutputDescription struct to align with the recent changes in the zcash_note_encryption crate. Specifically, the enc_ciphertext method now returns a reference instead of a copy. Also, it changed enc_ciphertext storage in OutputDescription to NoteBytesData.

This change was discussed and suggested in PR zcash/zcash_note_encryption#2 review.

@dmidem dmidem requested a review from PaulLaux August 13, 2024 13:44
Copy link

@PaulLaux PaulLaux left a comment

Choose a reason for hiding this comment

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

added comments to simplify

src/bundle.rs Outdated

/// Returns the encrypted note ciphertext.
pub fn enc_ciphertext(&self) -> &[u8; ENC_CIPHERTEXT_SIZE] {
pub fn enc_ciphertext(&self) -> &<SaplingDomain as Domain>::NoteCiphertextBytes {

Choose a reason for hiding this comment

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

let's stick to simply

 /// Returns the encrypted note ciphertext.
    pub fn enc_ciphertext(&self) -> &NoteBytesData<{ ENC_CIPHERTEXT_SIZE }> {
        &self.enc_ciphertext
    }

Copy link
Author

Choose a reason for hiding this comment

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

Done.

src/bundle.rs Outdated

fn enc_ciphertext(&self) -> Option<<SaplingDomain as Domain>::NoteCiphertextBytes> {
Some(NoteBytesData(self.enc_ciphertext))
fn enc_ciphertext(&self) -> Option<&<SaplingDomain as Domain>::NoteCiphertextBytes> {

Choose a reason for hiding this comment

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

fn enc_ciphertext(&self) -> Option<&NoteBytesData<{ ENC_CIPHERTEXT_SIZE }>> {

Choose a reason for hiding this comment

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

same for row 442:
fn enc_ciphertext_compact(&self) -> NoteBytesData<{ COMPACT_NOTE_SIZE }> {

Copy link
Author

Choose a reason for hiding this comment

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

Done.

}

fn enc_ciphertext(&self) -> Option<<SaplingDomain as Domain>::NoteCiphertextBytes> {
fn enc_ciphertext(&self) -> Option<&<SaplingDomain as Domain>::NoteCiphertextBytes> {

Choose a reason for hiding this comment

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

same

Copy link
Author

Choose a reason for hiding this comment

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

Done.

Copy link

@PaulLaux PaulLaux left a comment

Choose a reason for hiding this comment

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

Please make sure we have the librustzcash required changes as well

@dmidem dmidem merged commit 99ad0a5 into zsa1 Aug 19, 2024
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