Add skeleton for RedPallas

This commit is contained in:
Jack Grigg 2021-01-20 20:35:54 +00:00
parent 1b9f6450cb
commit ae252f57a8
4 changed files with 57 additions and 3 deletions

View File

@ -5,6 +5,7 @@ use std::marker::PhantomData;
use crate::{
circuit::Proof,
note::{EncryptedNote, NoteCommitment, Nullifier},
primitives::redpallas::{self, Binding, SpendAuth},
tree::Anchor,
value::{ValueCommitment, ValueSum},
Chain,
@ -23,7 +24,7 @@ pub struct Action {
/// The nullifier of the note being spent.
nf_old: Nullifier,
/// The randomized verification key for the note being spent.
rk: (),
rk: redpallas::VerificationKey<SpendAuth>,
/// A commitment to the new note being created.
cm_new: NoteCommitment,
/// The encrypted output note.
@ -56,8 +57,8 @@ impl<C: Chain> Bundle<C> {
#[derive(Debug)]
pub struct SignedBundle<C: Chain> {
bundle: Bundle<C>,
action_signatures: Vec<()>,
binding_signature: (),
action_signatures: Vec<redpallas::Signature<SpendAuth>>,
binding_signature: redpallas::Signature<Binding>,
}
impl<C: Chain> SignedBundle<C> {

View File

@ -12,6 +12,7 @@ pub mod bundle;
mod circuit;
pub mod keys;
mod note;
pub mod primitives;
mod tree;
pub mod value;

7
src/primitives.rs Normal file
View File

@ -0,0 +1,7 @@
//! Primitives used in the Orchard protocol.
// TODO:
// - DH stuff
// - EphemeralPublicKey
// - EphemeralSecretKey
pub mod redpallas;

View File

@ -0,0 +1,45 @@
//! TODO
use std::fmt;
use std::marker::PhantomData;
/// A RedPallas signature type.
pub trait SigType: private::Sealed + fmt::Debug {}
/// A type variable corresponding to an Orchard spend authorization signature.
#[derive(Debug)]
pub enum SpendAuth {}
impl SigType for SpendAuth {}
/// A type variable corresponding to an Orchard binding signature.
#[derive(Debug)]
pub enum Binding {}
impl SigType for Binding {}
/// A RedPallas signing key.
#[derive(Debug)]
pub struct SigningKey<T: SigType> {
_t: PhantomData<T>,
}
/// A RedPallas verification key.
#[derive(Debug)]
pub struct VerificationKey<T: SigType> {
_t: PhantomData<T>,
}
/// A RedPallas signature.
#[derive(Debug)]
pub struct Signature<T: SigType> {
_t: PhantomData<T>,
}
pub(crate) mod private {
use super::{Binding, SpendAuth};
pub trait Sealed {}
impl Sealed for SpendAuth {}
impl Sealed for Binding {}
}