cl: add missing cl patches

This commit is contained in:
David Rusu 2024-06-27 13:19:33 +00:00
parent ac6f7279a6
commit 89c70ea0e2
4 changed files with 8 additions and 8 deletions

View File

@ -20,7 +20,7 @@ pub struct Input {
pub balance: Balance,
}
#[derive(Debug, PartialEq, Eq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub struct InputWitness {
pub note: NoteWitness,
pub nf_sk: NullifierSecret,
@ -105,7 +105,7 @@ impl Input {
&& death_constraint_is_satisfied
}
pub(crate) fn to_bytes(&self) -> [u8; 96] {
pub fn to_bytes(&self) -> [u8; 96] {
let mut bytes = [0u8; 96];
bytes[..32].copy_from_slice(self.note_comm.as_bytes());
bytes[32..64].copy_from_slice(self.nullifier.as_bytes());

View File

@ -10,19 +10,19 @@ use rand_core::RngCore;
use serde::{Deserialize, Serialize};
// Maintained privately by note holder
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub struct NullifierSecret([u8; 16]);
// Nullifier commitment is public information that
// can be provided to anyone wishing to transfer
// you a note
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub struct NullifierCommitment([u8; 32]);
// To allow users to maintain fewer nullifier secrets, we
// provide a nonce to differentiate notes controlled by the same
// secret. Each note is assigned a unique nullifier nonce.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub struct NullifierNonce([u8; 16]);
// The nullifier attached to input notes to prove an input has not

View File

@ -14,7 +14,7 @@ pub struct Output {
pub balance: Balance,
}
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct OutputWitness {
pub note: NoteWitness,
pub nf_pk: NullifierCommitment,
@ -61,7 +61,7 @@ impl Output {
&& self.balance == witness.note.balance()
}
pub(crate) fn to_bytes(&self) -> [u8; 64] {
pub fn to_bytes(&self) -> [u8; 64] {
let mut bytes = [0u8; 64];
bytes[..32].copy_from_slice(self.note_comm.as_bytes());
bytes[32..64].copy_from_slice(&self.balance.to_bytes());

View File

@ -16,7 +16,7 @@ const MAX_OUTPUTS: usize = 32;
/// The partial transaction commitment couples an input to a partial transaction.
/// Prevents partial tx unbundling.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub struct PtxRoot([u8; 32]);
pub struct PtxRoot(pub [u8; 32]);
impl PtxRoot {
pub fn random(mut rng: impl RngCore) -> Self {