diff --git a/src/bundle.rs b/src/bundle.rs index bf15b0b2..3b6fc933 100644 --- a/src/bundle.rs +++ b/src/bundle.rs @@ -4,7 +4,7 @@ use nonempty::NonEmpty; use crate::{ circuit::Proof, - note::{EncryptedNote, NoteCommitment, Nullifier}, + note::{EncryptedNote, ExtractedNoteCommitment, Nullifier}, primitives::redpallas::{self, Binding, SpendAuth}, tree::Anchor, value::{ValueCommitment, ValueSum}, @@ -25,7 +25,7 @@ pub struct Action { /// The randomized verification key for the note being spent. rk: redpallas::VerificationKey, /// A commitment to the new note being created. - cm_new: NoteCommitment, + cm_new: ExtractedNoteCommitment, /// The encrypted output note. encrypted_note: EncryptedNote, /// A commitment to the net value created or consumed by this action. diff --git a/src/note.rs b/src/note.rs index 37785dea..110a50ec 100644 --- a/src/note.rs +++ b/src/note.rs @@ -9,7 +9,7 @@ use crate::{ }; mod commitment; -pub use self::commitment::NoteCommitment; +pub use self::commitment::{ExtractedNoteCommitment, NoteCommitment}; mod nullifier; pub use self::nullifier::Nullifier; diff --git a/src/note/commitment.rs b/src/note/commitment.rs index 226564a2..212b2980 100644 --- a/src/note/commitment.rs +++ b/src/note/commitment.rs @@ -8,7 +8,7 @@ use subtle::CtOption; use crate::{ constants::L_ORCHARD_BASE, primitives::sinsemilla, - spec::{prf_expand, to_scalar}, + spec::{extract_p, prf_expand, to_scalar}, value::NoteValue, }; @@ -54,3 +54,13 @@ impl NoteCommitment { .map(NoteCommitment) } } + +/// The x-coordinate of the commitment to a note. +#[derive(Debug)] +pub struct ExtractedNoteCommitment(pub(super) pallas::Base); + +impl From for ExtractedNoteCommitment { + fn from(cm: NoteCommitment) -> Self { + ExtractedNoteCommitment(extract_p(&cm.0)) + } +}