-
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
feat: add extended range proofs #102
feat: add extended range proofs #102
Conversation
Ok(proof.to_bytes()) | ||
} | ||
|
||
fn verify_batch_and_recover_masks( |
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.
A user is either verifying or recovering. Verifying is implicit in the action, so it's not needed in the name. Adding it in the name makes it seem like verifying
is the main action here, when it is actually recovering
fn verify_batch_and_recover_masks( | |
fn batch_recover_masks( |
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.
Batch recovery of masks is more expensive than linear mask recovery for the same amount of proofs, so that is not promoted. The primary action here is batch verification (logarithmic), with the additional benefit to recover masks at a linear cost. I will update the documentation to reflect this.
proof: &Self::Proof, | ||
statement: &RistrettoExtendedStatement, | ||
) -> Result<Option<RistrettoExtendedMask>, RangeProofError> { | ||
return match RistrettoRangeProof::from_bytes(proof) |
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.
Can't you just call verify_batch_and_recover(vec![proof], vec![statement])
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.
See above comment: Batch recovery of masks is more expensive than linear mask recovery for the same amount of proofs... Also, as a proof + commitment owner, we do not always want to verify the proof, in which case we can just call recover_mask
followed by verify_mask
, both really cheap operations.
}; | ||
} | ||
|
||
fn verify_mask( |
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.
Perhaps the commitment factory is a better place for this?
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.
The extended commitment factory can verify an extended commitment's opening, but is agnostic to mask verification, which is the primary action here.
I have added a specific test after mask recovery to also verify that the extended commitment factory can open the commitment.
410c776
to
23a0b34
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.
I'm not moving on the minimum_value_promise: Option<u64>
. If you change that to minimum_value_promise: u64
, it can be mergedd
Added extended range proofs