mimblewimble / rust-secp256k1-zkp

ZKP fork for rust-secp256k1, adds wrappers for range proofs, pedersen commitments, etc
Creative Commons Zero v1.0 Universal
57 stars 51 forks source link

Tests for range proof on multi-party commitment #31

Closed garyyu closed 6 years ago

garyyu commented 6 years ago

After adding this feature, we don't have any tests.

    pub fn bullet_proof(
        &self,
        value: u64,
        blind: SecretKey,
        nonce: SecretKey,
        extra_data: Option<Vec<u8>>,
        message: Option<ProofMessage>,
    ) -> RangeProof {
        ...
        // TODO: expose multi-party support
        let tau_x = ptr::null_mut();
        let t_one = ptr::null_mut();
        let t_two = ptr::null_mut();
        let commits = ptr::null_mut();
        let private_nonce = ptr::null();

@jaspervdm Could you please give me some examples to use this new feature? so as me to add some tests for it.

jaspervdm commented 6 years ago

The library includes tests for the multi-party proof, see here Edit: for reference, I previously made this explanation how to generate the proof: https://i.imgur.com/s7exNSf.png

garyyu commented 6 years ago

@jaspervdm more test cases has been added: https://github.com/mimblewimble/rust-secp256k1-zkp/pull/37

And one problem found: rewind_bullet_proof() will fail on this new range proof. Any idea on rewinding?

        // 5. Rewind message with same blinding factor
        let commit = secp
            .commit_sum(vec![partial_commit_a, partial_commit_b], vec![])
            .unwrap();
        let proof_info = secp.rewind_bullet_proof(
            commit,
            common_nonce.clone(),
            Some(extra_data.to_vec()),
            bullet_proof,
        );
        println!("proof_info after rewind: {:#?}", proof_info);
garyyu commented 6 years ago

rewind_bullet_proof() will not support at the moment. Refer to detail info in: https://github.com/mimblewimble/grin/issues/1601

garyyu commented 6 years ago

Closed by #37