Fix bundle::Action to hold cmx instead of cm

This commit is contained in:
Jack Grigg 2021-04-20 10:26:58 +12:00
parent c08d12cc52
commit b1286b4e94
3 changed files with 14 additions and 4 deletions

View File

@ -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<T> {
/// The randomized verification key for the note being spent.
rk: redpallas::VerificationKey<SpendAuth>,
/// 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.

View File

@ -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;

View File

@ -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<NoteCommitment> for ExtractedNoteCommitment {
fn from(cm: NoteCommitment) -> Self {
ExtractedNoteCommitment(extract_p(&cm.0))
}
}