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

Upstream diff #4

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,28 @@ and this library adheres to Rust's notion of
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed
- **Breaking change:** removed the constants `COMPACT_NOTE_SIZE`,
`NOTE_PLAINTEXT_SIZE`, and `ENC_CIPHERTEXT_SIZE` as they are now
implementation spesific (located in `orchard` and `sapling-crypto` crates).
- Generalized the note plaintext size to support variable sizes by adding the
abstract types `NotePlaintextBytes`, `NoteCiphertextBytes`,
`CompactNotePlaintextBytes`, and `CompactNoteCiphertextBytes` to the `Domain`
trait.
- Removed the separate `NotePlaintextBytes` type definition (as it is now an
associated type).
- Added new `parse_note_plaintext_bytes`, `parse_note_ciphertext_bytes`, and
`parse_compact_note_plaintext_bytes` methods to the `Domain` trait.
- Updated the `note_plaintext_bytes` method of the `Domain` trait to return the
`NotePlaintextBytes` associated type.
- Updated the `encrypt_note_plaintext` method of `NoteEncryption` to return the
`NoteCiphertextBytes` associated type of the `Domain` instead of the explicit
array.
- Updated the `enc_ciphertext` method of the `ShieldedOutput` trait to return an
`Option` of a reference instead of a copy.
- Added a new `note_bytes` module with helper trait and struct to deal with note
bytes data with abstracted underlying array size.

## [0.4.0] - 2023-06-06
### Changed
- The `esk` and `ephemeral_key` arguments have been removed from
Expand Down
8 changes: 4 additions & 4 deletions src/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use alloc::vec::Vec; // module is alloc only

use crate::{
try_compact_note_decryption_inner, try_note_decryption_inner, BatchDomain, EphemeralKeyBytes,
ShieldedOutput, COMPACT_NOTE_SIZE, ENC_CIPHERTEXT_SIZE,
ShieldedOutput,
};

/// Trial decryption of a batch of notes with a set of recipients.
Expand All @@ -16,7 +16,7 @@ use crate::{
/// provided, along with the index in the `ivks` slice associated with
/// the IVK that successfully decrypted the output.
#[allow(clippy::type_complexity)]
pub fn try_note_decryption<D: BatchDomain, Output: ShieldedOutput<D, ENC_CIPHERTEXT_SIZE>>(
pub fn try_note_decryption<D: BatchDomain, Output: ShieldedOutput<D>>(
ivks: &[D::IncomingViewingKey],
outputs: &[(D, Output)],
) -> Vec<Option<((D::Note, D::Recipient, D::Memo), usize)>> {
Expand All @@ -32,14 +32,14 @@ pub fn try_note_decryption<D: BatchDomain, Output: ShieldedOutput<D, ENC_CIPHERT
/// provided, along with the index in the `ivks` slice associated with
/// the IVK that successfully decrypted the output.
#[allow(clippy::type_complexity)]
pub fn try_compact_note_decryption<D: BatchDomain, Output: ShieldedOutput<D, COMPACT_NOTE_SIZE>>(
pub fn try_compact_note_decryption<D: BatchDomain, Output: ShieldedOutput<D>>(
ivks: &[D::IncomingViewingKey],
outputs: &[(D, Output)],
) -> Vec<Option<((D::Note, D::Recipient), usize)>> {
batch_note_decryption(ivks, outputs, try_compact_note_decryption_inner)
}

fn batch_note_decryption<D: BatchDomain, Output: ShieldedOutput<D, CS>, F, FR, const CS: usize>(
fn batch_note_decryption<D: BatchDomain, Output: ShieldedOutput<D>, F, FR>(
ivks: &[D::IncomingViewingKey],
outputs: &[(D, Output)],
decrypt_inner: F,
Expand Down
Loading