From 0b44afa4f6b3a4e294d4300a010f21f5c440553c Mon Sep 17 00:00:00 2001 From: Sergio Chouhy Date: Fri, 17 Oct 2025 15:29:09 -0300 Subject: [PATCH] remove unused code --- common/src/transaction.rs | 109 +------------------------------------- 1 file changed, 1 insertion(+), 108 deletions(-) diff --git a/common/src/transaction.rs b/common/src/transaction.rs index 3a2bda1..4820300 100644 --- a/common/src/transaction.rs +++ b/common/src/transaction.rs @@ -1,15 +1,10 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use k256::ecdsa::{Signature, SigningKey, VerifyingKey}; use log::info; use serde::{Deserialize, Serialize}; use sha2::{Digest, digest::FixedOutput}; -use elliptic_curve::{ - consts::{B0, B1}, - generic_array::GenericArray, -}; -use sha2::digest::typenum::{UInt, UTerm}; +pub type TreeHashType = [u8; 32]; #[derive(Debug, Clone, PartialEq, Eq)] pub enum NSSATransaction { @@ -29,12 +24,6 @@ impl From for NSSATransaction { } } -use crate::TreeHashType; - -pub type CipherText = Vec; -pub type Nonce = GenericArray, B1>, B0>, B0>>; -pub type Tag = u8; - #[derive( Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, BorshSerialize, BorshDeserialize, )] @@ -81,99 +70,6 @@ impl TryFrom<&EncodedTransaction> for NSSATransaction { } } -#[derive(Debug, Serialize, Deserialize)] -pub struct MintMoneyPublicTx { - pub acc: [u8; 32], - pub amount: u128, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct SendMoneyShieldedTx { - pub acc_sender: [u8; 32], - pub amount: u128, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct SendMoneyDeshieldedTx { - pub receiver_data: Vec<(u128, [u8; 32])>, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct OwnedUTXO { - pub hash: [u8; 32], - pub owner: [u8; 32], - pub amount: u128, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct OwnedUTXOForPublication { - pub hash: String, - pub owner: String, - pub amount: u128, -} - -impl From for OwnedUTXOForPublication { - fn from(value: OwnedUTXO) -> Self { - Self { - hash: hex::encode(value.hash), - owner: hex::encode(value.owner), - amount: value.amount, - } - } -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct UTXOPublication { - pub utxos: Vec, -} - -#[derive(Debug, Serialize, Deserialize)] -pub enum ActionData { - MintMoneyPublicTx(MintMoneyPublicTx), - SendMoneyShieldedTx(SendMoneyShieldedTx), - SendMoneyDeshieldedTx(SendMoneyDeshieldedTx), - UTXOPublication(UTXOPublication), -} - -impl ActionData { - pub fn into_hexed_print(self) -> String { - match self { - ActionData::MintMoneyPublicTx(action) => { - format!( - "Account {:?} minted {:?} balance", - hex::encode(action.acc), - action.amount - ) - } - ActionData::SendMoneyDeshieldedTx(action) => { - format!( - "Receivers receipt {:?}", - action - .receiver_data - .into_iter() - .map(|(amount, rec)| (amount, hex::encode(rec))) - .collect::>() - ) - } - ActionData::SendMoneyShieldedTx(action) => { - format!( - "Shielded send from {:?} for {:?} balance", - hex::encode(action.acc_sender), - action.amount - ) - } - ActionData::UTXOPublication(action) => { - let pub_own_utxo: Vec = action - .utxos - .into_iter() - .map(|owned_utxo| owned_utxo.into()) - .collect(); - format!("Published utxos {pub_own_utxo:?}") - } - } - } -} - impl EncodedTransaction { /// Computes and returns the SHA-256 hash of the JSON-serialized representation of `self`. pub fn hash(&self) -> TreeHashType { @@ -189,9 +85,6 @@ impl EncodedTransaction { } } -pub type TransactionSignature = Signature; -pub type SignaturePublicKey = VerifyingKey; -pub type SignaturePrivateKey = SigningKey; #[cfg(test)] mod tests {