docs(rln): comments and notes

This commit is contained in:
Oskar Thoren 2022-03-18 15:01:37 +08:00
parent 6b3be4438e
commit cb38360311
No known key found for this signature in database
GPG Key ID: B2ECCFD3BC2EF77E
2 changed files with 20 additions and 6 deletions

View File

@ -77,6 +77,11 @@ fn ark_to_bigint(n: Field) -> BigInt {
n.to_bigint().expect("conversion always succeeds for uint")
}
// XXX This is different from zk-kit API:
// const witness = RLN.genWitness(secretHash, merkleProof, epoch, signal, rlnIdentifier)
// const fullProof = await RLN.genProof(witness, wasmFilePath, finalZkeyPath)
//
/// Generates a semaphore proof
///
/// # Errors
@ -90,6 +95,15 @@ pub fn generate_proof(
) -> Result<Proof<Bn<Parameters>>, ProofError> {
let external_nullifier = hash_external_nullifier(external_nullifier);
let signal = hash_signal(signal);
// TODO Fix inputs
// Semaphore genWitness corresponds to these
// RLN different, should be:
// identity_secret
// path_elements (merkleProof.siblings))
// identity_path_index (merkleProof.pathIndices)
// x (RLN.genSignalHash(signal), assuming shouldHash is true)
// epoch
// rln_identifier
let inputs = [
("identityNullifier", vec![identity.nullifier]),
("identityTrapdoor", vec![identity.trapdoor]),

View File

@ -25,17 +25,17 @@ use num_bigint::BigInt;
use serde::Deserialize;
use serde_json;
// XXX
use bellman::pairing::ff::{Field, PrimeField, PrimeFieldRepr, ScalarEngine};
use sapling_crypto::bellman::pairing::bn256::Bn256;
// For RLN Rust version
//use bellman::pairing::ff::{Field, PrimeField, PrimeFieldRepr, ScalarEngine};
//use sapling_crypto::bellman::pairing::bn256::Bn256;
// TODO Add Engine here? i.e. <E: Engine> not <Bn254>
// NOTE Bn254 vs Bn256 mismatch! Tree is originally Bn256
// TODO Figure out Bn254 vs Bn256 mismatch
// TODO Assuming we want to use IncrementalMerkleTree, figure out type/trait conversions
// TODO Adopt to new protocol structure
pub struct RLN {
circom: CircomCircuit<Bn254>,
params: ProvingKey<Bn254>,
// TODO Replace Bn256 with Bn254 here
// RLN Rust version
//tree: IncrementalMerkleTree<Bn256>,
tree: PoseidonTree,
}