Bulletproofs+ (#70)

* Initial stab at Bulletproofs+

Does move around the existing Bulletproofs code, does still work as 
expected.

* Make the Clsag RCTPrunable type work with BP and BP+

* Initial set of BP+ bug fixes

* Further bug fixes

* Remove RING_LEN as a constant

* Monero v16 TX support

Doesn't implement view tags, nor going back to v14, nor the updated BP 
clawback logic.

* Support v14 and v16 at the same time
This commit is contained in:
Luke Parker
2022-07-27 04:05:43 -05:00
committed by GitHub
parent 37b8e3c025
commit 023afaf7ce
15 changed files with 384 additions and 132 deletions

View File

@@ -25,6 +25,32 @@ pub mod wallet;
#[cfg(test)]
mod tests;
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[allow(non_camel_case_types)]
pub enum Protocol {
Unsupported,
v14,
v16,
}
impl Protocol {
pub(crate) fn ring_len(&self) -> usize {
match self {
Protocol::Unsupported => panic!("Unsupported protocol version"),
Protocol::v14 => 11,
Protocol::v16 => 16,
}
}
pub(crate) fn bp_plus(&self) -> bool {
match self {
Protocol::Unsupported => panic!("Unsupported protocol version"),
Protocol::v14 => false,
Protocol::v16 => true,
}
}
}
lazy_static! {
static ref H: EdwardsPoint =
CompressedEdwardsY(hash(&ED25519_BASEPOINT_POINT.compress().to_bytes()))