mirror of
https://github.com/logos-blockchain/logos-blockchain-pocs.git
synced 2026-05-03 08:03:08 +00:00
cl: doc zero commitment; drop Ptx::balance_delta, rm InputProof
This commit is contained in:
parent
05fbbdfe81
commit
61388121fb
@ -19,6 +19,10 @@ pub struct BalanceWitness(pub Scalar);
|
||||
impl Balance {
|
||||
/// A commitment to zero, blinded by the provided balance witness
|
||||
pub fn zero(blinding: BalanceWitness) -> Self {
|
||||
// Since, balance commitments are `value * UnitPoint + blinding * H`, when value=0, the commmitment is unitless.
|
||||
// So we use the generator point as a stand in for the unit point.
|
||||
//
|
||||
// TAI: we can optimize this further from `0*G + r*H` to just `r*H` to save a point scalar mult + point addition.
|
||||
Self(balance(
|
||||
0,
|
||||
curve25519_dalek::constants::RISTRETTO_BASEPOINT_POINT,
|
||||
|
||||
@ -54,13 +54,6 @@ impl PartialTxWitness {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn balance_delta(&self) -> i128 {
|
||||
let in_sum: i128 = self.inputs.iter().map(|i| i.note.value as i128).sum();
|
||||
let out_sum: i128 = self.outputs.iter().map(|o| o.note.value as i128).sum();
|
||||
|
||||
out_sum - in_sum
|
||||
}
|
||||
|
||||
pub fn balance_blinding(&self) -> BalanceWitness {
|
||||
let in_sum: Scalar = self.inputs.iter().map(|i| i.balance_blinding.0).sum();
|
||||
let out_sum: Scalar = self.outputs.iter().map(|o| o.balance_blinding.0).sum();
|
||||
|
||||
@ -77,11 +77,6 @@ impl ProvedInput {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct InputProof {}
|
||||
|
||||
impl InputProof {}
|
||||
|
||||
fn note_commitment_leaves(note_commitments: &[cl::NoteCommitment]) -> [[u8; 32]; MAX_NOTE_COMMS] {
|
||||
let note_comm_bytes = Vec::from_iter(note_commitments.iter().map(|c| c.as_bytes().to_vec()));
|
||||
let cm_leaves = cl::merkle::padded_leaves::<MAX_NOTE_COMMS>(¬e_comm_bytes);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user