mirror of
https://github.com/serai-dex/serai.git
synced 2024-12-22 19:49:22 +00:00
Mark cross_group as experimental
While all of Serai can be argued as experimental, the DLEq proof is especially so, as it's lacking any formal proofs over its theory. Also adds doc(hidden) to the generic DLEqProof, now prefixed with __.
This commit is contained in:
parent
4dbf50243b
commit
72afcf1f06
4 changed files with 11 additions and 8 deletions
|
@ -31,7 +31,7 @@ transcript = { package = "flexible-transcript", path = "../transcript", features
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
serialize = []
|
serialize = []
|
||||||
cross_group = ["multiexp"]
|
experimental_cross_group = ["multiexp"]
|
||||||
secure_capacity_difference = []
|
secure_capacity_difference = []
|
||||||
|
|
||||||
# Only applies to cross_group, yet is default to ensure security
|
# Only applies to cross_group, yet is default to ensure security
|
||||||
|
|
|
@ -47,10 +47,13 @@ pub enum DLEqError {
|
||||||
InvalidProof
|
InvalidProof
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This should never be directly instantiated and uses a u8 to represent internal values
|
||||||
|
// Any external usage is likely invalid
|
||||||
|
#[doc(hidden)]
|
||||||
// Debug would be such a dump of data this likely isn't helpful, but at least it's available to
|
// Debug would be such a dump of data this likely isn't helpful, but at least it's available to
|
||||||
// anyone who wants it
|
// anyone who wants it
|
||||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
pub struct DLEqProof<
|
pub struct __DLEqProof<
|
||||||
G0: PrimeGroup,
|
G0: PrimeGroup,
|
||||||
G1: PrimeGroup,
|
G1: PrimeGroup,
|
||||||
const SIGNATURE: u8,
|
const SIGNATURE: u8,
|
||||||
|
@ -64,7 +67,7 @@ pub struct DLEqProof<
|
||||||
|
|
||||||
macro_rules! dleq {
|
macro_rules! dleq {
|
||||||
($name: ident, $signature: expr, $remainder: literal) => {
|
($name: ident, $signature: expr, $remainder: literal) => {
|
||||||
pub type $name<G0, G1> = DLEqProof<
|
pub type $name<G0, G1> = __DLEqProof<
|
||||||
G0,
|
G0,
|
||||||
G1,
|
G1,
|
||||||
{ $signature.to_u8() },
|
{ $signature.to_u8() },
|
||||||
|
@ -105,7 +108,7 @@ impl<
|
||||||
const SIGNATURE: u8,
|
const SIGNATURE: u8,
|
||||||
const RING_LEN: usize,
|
const RING_LEN: usize,
|
||||||
const REMAINDER_RING_LEN: usize
|
const REMAINDER_RING_LEN: usize
|
||||||
> DLEqProof<G0, G1, SIGNATURE, RING_LEN, REMAINDER_RING_LEN> where
|
> __DLEqProof<G0, G1, SIGNATURE, RING_LEN, REMAINDER_RING_LEN> where
|
||||||
G0::Scalar: PrimeFieldBits, G1::Scalar: PrimeFieldBits {
|
G0::Scalar: PrimeFieldBits, G1::Scalar: PrimeFieldBits {
|
||||||
|
|
||||||
pub(crate) fn transcript<T: Transcript>(
|
pub(crate) fn transcript<T: Transcript>(
|
||||||
|
@ -232,7 +235,7 @@ impl<
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let proof = DLEqProof { bits, remainder, poks };
|
let proof = __DLEqProof { bits, remainder, poks };
|
||||||
debug_assert_eq!(
|
debug_assert_eq!(
|
||||||
proof.reconstruct_keys(),
|
proof.reconstruct_keys(),
|
||||||
(generators.0.primary * f.0, generators.1.primary * f.1)
|
(generators.0.primary * f.0, generators.1.primary * f.1)
|
||||||
|
@ -353,7 +356,7 @@ impl<
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(
|
Ok(
|
||||||
DLEqProof {
|
__DLEqProof {
|
||||||
bits,
|
bits,
|
||||||
remainder,
|
remainder,
|
||||||
poks: (SchnorrPoK::deserialize(r)?, SchnorrPoK::deserialize(r)?)
|
poks: (SchnorrPoK::deserialize(r)?, SchnorrPoK::deserialize(r)?)
|
||||||
|
|
|
@ -9,7 +9,7 @@ use group::prime::PrimeGroup;
|
||||||
#[cfg(feature = "serialize")]
|
#[cfg(feature = "serialize")]
|
||||||
use std::io::{self, ErrorKind, Error, Read, Write};
|
use std::io::{self, ErrorKind, Error, Read, Write};
|
||||||
|
|
||||||
#[cfg(feature = "cross_group")]
|
#[cfg(feature = "experimental_cross_group")]
|
||||||
pub mod cross_group;
|
pub mod cross_group;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[cfg(feature = "cross_group")]
|
#[cfg(feature = "experimental_cross_group")]
|
||||||
mod cross_group;
|
mod cross_group;
|
||||||
|
|
||||||
use hex_literal::hex;
|
use hex_literal::hex;
|
||||||
|
|
Loading…
Reference in a new issue