[zk-token-sdk] clean-up range-proof docs (#33803)

* add/fix docs for range proof

* remove pre-compute generators todo

* remove double check generators todo
This commit is contained in:
samkim-crypto 2023-10-24 07:53:48 -07:00 committed by GitHub
parent 8e0acf481c
commit c3d588b3f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 14 deletions

View File

@ -6,10 +6,7 @@ use {
sha3::{Sha3XofReader, Shake256},
};
/// Generators for Pedersen vector commitments.
///
/// The code is copied from https://github.com/dalek-cryptography/bulletproofs for now...
/// Generators for Pedersen vector commitments that are used for inner-product proofs.
struct GeneratorsChain {
reader: Sha3XofReader,
}
@ -80,14 +77,6 @@ impl BulletproofGens {
gens
}
// pub fn new_aggregate(gens_capacities: Vec<usize>) -> Vec<BulletproofGens> {
// let mut gens_vector = Vec::new();
// for (capacity, i) in gens_capacities.iter().enumerate() {
// gens_vector.push(BulletproofGens::new(capacity, &i.to_le_bytes()));
// }
// gens_vector
// }
/// Increases the generators' capacity to the amount specified.
/// If less than or equal to the current capacity, does nothing.
pub fn increase_capacity(&mut self, new_capacity: usize) {

View File

@ -1,3 +1,15 @@
//! The Bulletproofs range-proof implementation over Curve25519 Ristretto points.
//!
//! The implementation is based on the dalek-cryptography bulletproofs
//! [implementation](https://github.com/dalek-cryptography/bulletproofs). Compared to the original
//! implementation by dalek-cryptography:
//! - This implementation focuses on the range proof implementation, while the dalek-cryptography
//! crate additionally implements the general bulletproofs implementation for languages that can be
//! represented by arithmetic circuits as well as MPC.
//! - This implementation implements a non-interactive range proof aggregation that is specified in
//! the original Bulletproofs [paper](https://eprint.iacr.org/2017/1066) (Section 4.3).
//!
#[cfg(not(target_os = "solana"))]
use {
crate::encryption::pedersen::{Pedersen, PedersenCommitment, PedersenOpening},
@ -69,8 +81,6 @@ impl RangeProof {
let nm: usize = bit_lengths.iter().sum();
assert!(nm.is_power_of_two());
// TODO: precompute generators
// TODO: double check Pedersen generators and range proof generators does not interfere
let bp_gens = BulletproofGens::new(nm);
// bit-decompose values and generate their Pedersen vector commitment