-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate bulletproof rewinding #25
Conversation
Getting this error on Windows:
|
that doesn't look like an issue related to the PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look good. A few maintainability and readability nits.
src/ristretto/dalek_range_proof.rs
Outdated
fn construct_proof_with_rewind_key(&self, key: &RistrettoSecretKey, value: u64, rewind_key: &RistrettoSecretKey, rewind_blinding_key: &RistrettoSecretKey, proof_message: &[u8; 19]) -> Result<Vec<u8>, RangeProofError> { | ||
let mut pt = Transcript::new(b"tari"); | ||
let mut full_proof_message = [0u8; 23]; | ||
full_proof_message[0..4].clone_from_slice(b"tari"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract message as a const
; And I'd highly recommend making it 2 bytes to give a precious extra 2 bytes to the message. 1 byte is a bit short 1:256 chance of getting a false positive, 2 bytes is 1:65k.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do, was just following the precedent set by the transcript but I agree.
The selection of how many bytes to use felt tricky. Happy to make it 2 for a 1 out of 65k chance of a false positive. Is that truly big enough? Maybe split the difference for a 3 byte check?
03237dd
to
f2fbfa9
Compare
It works perfectly with |
@CjS77 Shall we update the version in the repo? |
Could we perhaps run |
I was keen to but lets do it as a separate PR else it will confuse what this PR was updating. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
f2fbfa9
to
7b02b1b
Compare
Had to update the branch of our fork of the Bulletproofs crate which was moved from main to development to reflect the branch naming of Daleks crate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment below, and I think we should find a toolchain that also compiles on Windows.
Can you suggest a toolchain that works for windows and allows for the WASM issue? |
7b02b1b
to
9dac756
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see suggested code change below.
Toolchain nightly-2020-09-16 looks promising for Windows builds; maybe for wasm_builder as well. (Note: nightly-2020-09-15 is broken for Windows.)
9dac756
to
c232fbc
Compare
@CjS77 I can't actually successfully run |
c232fbc
to
6253992
Compare
Ok we tested |
@philipr-za Were you getting this issue on the 2020-09-15 build? rust-lang/rust#76698 Not sure why it worked when I was troubleshooting this before -- maybe the LLVM dylib was cached on the system or something. |
Confirmed: nightly-2020-11-24 nightly-2020-09-11 seems to work for wasm and all-features on Mac. |
Yes that was the exact issue I was having. |
6253992
to
19619f1
Compare
Toolchain
However, the demo only works on Windows:
All toolchains tested with Ubuntu 18.04 LTS and
Update: Working with the latest version of Node.js ( |
Update: This could probably be added to |
19619f1
to
dded0fa
Compare
This PR integrates the rewinding of the dalek bulletproofs into tari_crypto. A method is provided that construct the rewindable range proof and two methods are provided to rewind the bullet proof to two levels, the first reveals the committed value and the proof message and the second will fully rewind the bullet proof to also reveal the blinding factor. While the underlying bulletproof implementation can accept a 23 byte proof message we use the first 4 bytes for a canonical message that lets us determine if the rewinding was successful or produced a garbage output. The remaining 19 bytes are provided for the client to use as they will
dded0fa
to
4f87194
Compare
This PR integrates the rewinding of the dalek bulletproofs, currently implemented in the Tari fork of the bulletproofs crate, into tari_crypto. A method is provided that construct the rewindable range proof and two methods are provided to rewind the bulletproof to two levels, the first reveals the committed value and the proof message and the second will fully rewinds the bullet proof to also reveal the blinding factor.
While the underlying bulletproof implementation can accept a 23 byte proof message we use the first 4 bytes for a canonical message that lets us determine if the rewinding was successful or produced a garbage output. The remaining 19 bytes are provided for the client to use as they will