From e1ea76be2a6001a069b95f1a7fbfcf09f4052460 Mon Sep 17 00:00:00 2001 From: Aaron Feickert <66188213+AaronFeickert@users.noreply.github.com> Date: Thu, 17 Aug 2023 08:13:06 -0500 Subject: [PATCH] Remove unused rewindable range proof code --- src/lib.rs | 2 - src/rewindable_range_proof.rs | 100 ---------------------------------- 2 files changed, 102 deletions(-) delete mode 100644 src/rewindable_range_proof.rs diff --git a/src/lib.rs b/src/lib.rs index 7f524aa7..2bf69a41 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,8 +21,6 @@ pub mod hashing; pub mod keys; #[cfg(feature = "bulletproofs_plus")] pub mod range_proof; -#[cfg(feature = "bulletproofs_plus")] -pub mod rewindable_range_proof; pub mod signatures; // Implementations diff --git a/src/rewindable_range_proof.rs b/src/rewindable_range_proof.rs deleted file mode 100644 index 65c3160d..00000000 --- a/src/rewindable_range_proof.rs +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2019. The Tari Project -// SPDX-License-Identifier: BSD-3-Clause - -//! Rewindable Range Proofs - -use crate::{ - commitment::HomomorphicCommitment, - errors::RangeProofError, - keys::{PublicKey, SecretKey}, -}; - -/// The length of the user message included in a range proof -pub const REWIND_USER_MESSAGE_LENGTH: usize = 21; - -/// A rewindable range proof service -pub trait RewindableRangeProofService { - /// The type of the proof - type Proof: Sized; - /// The type of the secret key - type K: SecretKey; - /// The type of the public key - type PK: PublicKey; - - /// Construct a range proof with the ability to rewind it. Requires two rewind keys and a 19-byte message to be - /// included in the range proof. The proof can contain 23 bytes but 4 bytes are used to confirm that a rewind - /// was performed correctly - fn construct_proof_with_rewind_key( - &self, - key: &Self::K, - value: u64, - rewind_key: &Self::K, - rewind_blinding_key: &Self::K, - proof_message: &[u8; REWIND_USER_MESSAGE_LENGTH], - ) -> Result; - - /// Rewind a rewindable range proof to reveal the committed value and the 19 byte proof message. - fn rewind_proof_value_only( - &self, - proof: &Self::Proof, - commitment: &HomomorphicCommitment, - rewind_public_key: &Self::PK, - rewind_blinding_public_key: &Self::PK, - ) -> Result; - - /// Fully rewind a rewindable range proof to reveal the committed value, blinding factor and the 19 byte proof - /// message. - fn rewind_proof_commitment_data( - &self, - proof: &Self::Proof, - commitment: &HomomorphicCommitment, - rewind_key: &Self::K, - rewind_blinding_key: &Self::K, - ) -> Result, RangeProofError>; -} - -/// Rewind data extracted from a range proof containing the committed value and the 19 byte proof message. -#[derive(Debug, PartialEq, Eq)] -pub struct RewindResult { - /// The committed value - pub committed_value: u64, - /// The 19 byte proof message - pub proof_message: [u8; REWIND_USER_MESSAGE_LENGTH], -} - -impl RewindResult { - /// Creates a new `RewindResult` - pub fn new(committed_value: u64, proof_message: [u8; REWIND_USER_MESSAGE_LENGTH]) -> Self { - Self { - committed_value, - proof_message, - } - } -} - -/// Rewind data extracted from a rangeproof containing the committed value, a 19 byte proof message and the blinding -/// factor. -#[derive(Debug, PartialEq, Eq)] -pub struct FullRewindResult -where K: SecretKey -{ - /// The committed value - pub committed_value: u64, - /// The 19 byte proof message - pub proof_message: [u8; REWIND_USER_MESSAGE_LENGTH], - /// The blinding factor - pub blinding_factor: K, -} - -impl FullRewindResult -where K: SecretKey -{ - /// Creates a new `FullRewindResult` - pub fn new(committed_value: u64, proof_message: [u8; REWIND_USER_MESSAGE_LENGTH], blinding_factor: K) -> Self { - Self { - committed_value, - proof_message, - blinding_factor, - } - } -}