This commit is contained in:
hinto.janai 2024-09-30 21:11:27 -04:00
parent d816a0100c
commit 590e37dd3c
No known key found for this signature in database
GPG key ID: D47CE05FA175A499
2 changed files with 18 additions and 4 deletions

View file

@ -8,22 +8,28 @@ use cuprate_epee_encoding::{error, macros::bytes, EpeeValue, Marker};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
/// Generate the `HexBytes` struct for `N` lengths.
/// Generate `HexBytes` struct(s) for `N` lengths.
///
/// This is a macro because [`hex::FromHex`] does not implement for a generic `N`:
/// This is a macro instead of a `<const N: usize>` implementation
/// because [`hex::FromHex`] does not implement for a generic `N`:
/// <https://docs.rs/hex/0.4.3/src/hex/lib.rs.html#220-230>
macro_rules! generate_hex_array {
($(
$array_len:literal
),* $(,)?) => { paste::paste! {
$(
#[doc = concat!("Wrapper type that (de)serializes from/to a ", stringify!($array_len), "-byte array.")]
#[doc = concat!(
"Wrapper type for a ",
stringify!($array_len),
"-byte array that (de)serializes from/to hexadecimal strings."
)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(transparent))]
#[repr(transparent)]
pub struct [<HexBytes $array_len>](
#[cfg_attr(feature = "serde", serde(with = "hex::serde"))] pub [u8; $array_len],
#[cfg_attr(feature = "serde", serde(with = "hex::serde"))]
pub [u8; $array_len],
);
#[cfg(feature = "epee")]

View file

@ -212,22 +212,30 @@ pub enum RctSignatures {
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(untagged))]
pub enum RctSigPrunable {
/// - [`ringct::RctPrunable::AggregateMlsagBorromean`]
/// - [`ringct::RctPrunable::MlsagBorromean`]
MlsagBorromean {
rangeSigs: Vec<RangeSignature>,
MGs: Vec<Mg>,
},
/// - [`ringct::RctPrunable::MlsagBulletproofs`]
MlsagBulletproofs {
nbp: u64,
bp: Vec<Bulletproof>,
MGs: Vec<Mg>,
pseudoOuts: Vec<HexBytes32>,
},
/// - [`ringct::RctPrunable::Clsag`] with [`ringct::bulletproofs::Bulletproof::Original`]
ClsagBulletproofs {
nbp: u64,
bp: Vec<Bulletproof>,
CLSAGs: Vec<Clsag>,
pseudoOuts: Vec<HexBytes32>,
},
/// - [`ringct::RctPrunable::Clsag`] with [`ringct::bulletproofs::Bulletproof::Plus`]
ClsagBulletproofsPlus {
nbp: u64,
bpp: Vec<BulletproofPlus>,