mimblewimble / rust-secp256k1-zkp

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

Message in range proof - rewind to recover value and message #8

Closed antiochp closed 6 years ago

antiochp commented 6 years ago

The PR does the following -

1) exposes msg as a param to range_proof 1) uses the secret_key as the nonce in range_proof 1) allows the same secret key to be passed in as the nonce in rewind_range_proof 1) introduces a new MessageProof struct so we can conveniently interact with the msg itself 1) also fixes running the tests in travis (cargo command was broken from earlier)

This lets us rewind a range_proof to recover both the original value and original message from the proof.

If someone with more knowledge of the underlying secp lib could confirm (2) is safe to do that would be much appreciated.

This resolves issue #7.

Note: this is a breaking change to the secp api and will break Grin (the msg param is new). The corresponding PR on the grin side is here - ignopeverell/grin#155.

What's the process here - do we get away with merging these 2 related PRs together - or do we want to manage backward compatibility across these 2 repos somehow? One option may be to tag rust-secp256k1-zkp and specify the tag in Cargo.toml in Grin prior to merging this?

ignopeverell commented 6 years ago

For now I can just merge both at the same time. When we have a release out, we can start worrying about backward compatibility and versioning. Is this ready for review?

antiochp commented 6 years ago

Yeah - these should both be ready to go. I've tested grin locally pointing at my forked version of rust-secp256k1-zkp and everything looks good. But there's always a chance I missed something with the dependencies.