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::{ use crate::{
circuit::Proof, circuit::Proof,
note::{EncryptedNote, NoteCommitment, Nullifier}, note::{EncryptedNote, ExtractedNoteCommitment, Nullifier},
primitives::redpallas::{self, Binding, SpendAuth}, primitives::redpallas::{self, Binding, SpendAuth},
tree::Anchor, tree::Anchor,
value::{ValueCommitment, ValueSum}, value::{ValueCommitment, ValueSum},
@ -25,7 +25,7 @@ pub struct Action<T> {
/// The randomized verification key for the note being spent. /// The randomized verification key for the note being spent.
rk: redpallas::VerificationKey<SpendAuth>, rk: redpallas::VerificationKey<SpendAuth>,
/// A commitment to the new note being created. /// A commitment to the new note being created.
cm_new: NoteCommitment, cm_new: ExtractedNoteCommitment,
/// The encrypted output note. /// The encrypted output note.
encrypted_note: EncryptedNote, encrypted_note: EncryptedNote,
/// A commitment to the net value created or consumed by this action. /// A commitment to the net value created or consumed by this action.

View File

@ -9,7 +9,7 @@ use crate::{
}; };
mod commitment; mod commitment;
pub use self::commitment::NoteCommitment; pub use self::commitment::{ExtractedNoteCommitment, NoteCommitment};
mod nullifier; mod nullifier;
pub use self::nullifier::Nullifier; pub use self::nullifier::Nullifier;

View File

@ -8,7 +8,7 @@ use subtle::CtOption;
use crate::{ use crate::{
constants::L_ORCHARD_BASE, constants::L_ORCHARD_BASE,
primitives::sinsemilla, primitives::sinsemilla,
spec::{prf_expand, to_scalar}, spec::{extract_p, prf_expand, to_scalar},
value::NoteValue, value::NoteValue,
}; };
@ -54,3 +54,13 @@ impl NoteCommitment {
.map(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))
}
}