mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-11 21:49:26 +00:00
Error if missing documentation
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||||
#![doc = include_str!("../README.md")]
|
#![doc = include_str!("../README.md")]
|
||||||
|
#![deny(missing_docs)]
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
|
|
||||||
use std_shims::{sync::OnceLock, vec::Vec};
|
use std_shims::{sync::OnceLock, vec::Vec};
|
||||||
@@ -59,7 +60,9 @@ pub const LOG_COMMITMENT_BITS: usize = 6; // 2 ** 6 == N
|
|||||||
/// Container struct for Bulletproofs(+) generators.
|
/// Container struct for Bulletproofs(+) generators.
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub struct Generators {
|
pub struct Generators {
|
||||||
|
/// The G (bold) vector of generators.
|
||||||
pub G: Vec<EdwardsPoint>,
|
pub G: Vec<EdwardsPoint>,
|
||||||
|
/// The H (bold) vector of generators.
|
||||||
pub H: Vec<EdwardsPoint>,
|
pub H: Vec<EdwardsPoint>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||||
#![doc = include_str!("../README.md")]
|
#![doc = include_str!("../README.md")]
|
||||||
|
#![deny(missing_docs)]
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
|
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||||
#![doc = include_str!("../README.md")]
|
#![doc = include_str!("../README.md")]
|
||||||
|
#![deny(missing_docs)]
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
|
|
||||||
use std_shims::vec::Vec;
|
use std_shims::vec::Vec;
|
||||||
@@ -21,31 +22,32 @@ use monero_generators::H;
|
|||||||
// On std, we cache some variables in statics.
|
// On std, we cache some variables in statics.
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
static INV_EIGHT_CELL: OnceLock<Scalar> = OnceLock::new();
|
static INV_EIGHT_CELL: OnceLock<Scalar> = OnceLock::new();
|
||||||
|
/// The inverse of 8 over l.
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
/// The inverse of 8 over l.
|
|
||||||
pub fn INV_EIGHT() -> Scalar {
|
pub fn INV_EIGHT() -> Scalar {
|
||||||
*INV_EIGHT_CELL.get_or_init(|| Scalar::from(8u8).invert())
|
*INV_EIGHT_CELL.get_or_init(|| Scalar::from(8u8).invert())
|
||||||
}
|
}
|
||||||
// In no-std environments, we prefer the reduced memory use and calculate it ad-hoc.
|
// In no-std environments, we prefer the reduced memory use and calculate it ad-hoc.
|
||||||
|
/// The inverse of 8 over l.
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(not(feature = "std"))]
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
/// The inverse of 8 over l.
|
|
||||||
pub fn INV_EIGHT() -> Scalar {
|
pub fn INV_EIGHT() -> Scalar {
|
||||||
Scalar::from(8u8).invert()
|
Scalar::from(8u8).invert()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
static BASEPOINT_PRECOMP_CELL: OnceLock<VartimeEdwardsPrecomputation> = OnceLock::new();
|
static G_PRECOMP_CELL: OnceLock<VartimeEdwardsPrecomputation> = OnceLock::new();
|
||||||
|
/// A cached (if std) pre-computation of the Ed25519 generator, G.
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn BASEPOINT_PRECOMP() -> &'static VartimeEdwardsPrecomputation {
|
pub fn G_PRECOMP() -> &'static VartimeEdwardsPrecomputation {
|
||||||
BASEPOINT_PRECOMP_CELL
|
G_PRECOMP_CELL.get_or_init(|| VartimeEdwardsPrecomputation::new([ED25519_BASEPOINT_POINT]))
|
||||||
.get_or_init(|| VartimeEdwardsPrecomputation::new([ED25519_BASEPOINT_POINT]))
|
|
||||||
}
|
}
|
||||||
|
/// A cached (if std) pre-computation of the Ed25519 generator, G.
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(not(feature = "std"))]
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn BASEPOINT_PRECOMP() -> VartimeEdwardsPrecomputation {
|
pub fn G_PRECOMP() -> VartimeEdwardsPrecomputation {
|
||||||
VartimeEdwardsPrecomputation::new([ED25519_BASEPOINT_POINT])
|
VartimeEdwardsPrecomputation::new([ED25519_BASEPOINT_POINT])
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +73,9 @@ pub fn keccak256_to_scalar(data: impl AsRef<[u8]>) -> Scalar {
|
|||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
#[derive(Clone, PartialEq, Eq, Zeroize, ZeroizeOnDrop)]
|
#[derive(Clone, PartialEq, Eq, Zeroize, ZeroizeOnDrop)]
|
||||||
pub struct Commitment {
|
pub struct Commitment {
|
||||||
|
/// The mask for this commitment.
|
||||||
pub mask: Scalar,
|
pub mask: Scalar,
|
||||||
|
/// The amount committed to by this commitment.
|
||||||
pub amount: u64,
|
pub amount: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,12 +151,12 @@ impl Decoys {
|
|||||||
self.signer_index
|
self.signer_index
|
||||||
}
|
}
|
||||||
|
|
||||||
// The ring.
|
/// The ring.
|
||||||
pub fn ring(&self) -> &[[EdwardsPoint; 2]] {
|
pub fn ring(&self) -> &[[EdwardsPoint; 2]] {
|
||||||
&self.ring
|
&self.ring
|
||||||
}
|
}
|
||||||
|
|
||||||
// The [key, commitment] pair of the signer.
|
/// The [key, commitment] pair of the signer.
|
||||||
pub fn signer_ring_members(&self) -> [EdwardsPoint; 2] {
|
pub fn signer_ring_members(&self) -> [EdwardsPoint; 2] {
|
||||||
self.ring[usize::from(self.signer_index)]
|
self.ring[usize::from(self.signer_index)]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||||
#![doc = include_str!("../README.md")]
|
#![doc = include_str!("../README.md")]
|
||||||
|
#![deny(missing_docs)]
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
#![allow(non_snake_case)]
|
#![allow(non_snake_case)]
|
||||||
|
|
||||||
@@ -53,7 +54,9 @@ pub enum BulletproofError {
|
|||||||
#[allow(clippy::large_enum_variant)]
|
#[allow(clippy::large_enum_variant)]
|
||||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
pub enum Bulletproof {
|
pub enum Bulletproof {
|
||||||
|
/// A Bulletproof.
|
||||||
Original(OriginalStruct),
|
Original(OriginalStruct),
|
||||||
|
/// A Bulletproof+.
|
||||||
Plus(AggregateRangeProof),
|
Plus(AggregateRangeProof),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||||
#![doc = include_str!("../README.md")]
|
#![doc = include_str!("../README.md")]
|
||||||
|
#![deny(missing_docs)]
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
#![allow(non_snake_case)]
|
#![allow(non_snake_case)]
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ use curve25519_dalek::{
|
|||||||
|
|
||||||
use monero_io::*;
|
use monero_io::*;
|
||||||
use monero_generators::hash_to_point;
|
use monero_generators::hash_to_point;
|
||||||
use monero_primitives::{INV_EIGHT, BASEPOINT_PRECOMP, Commitment, Decoys, keccak256_to_scalar};
|
use monero_primitives::{INV_EIGHT, G_PRECOMP, Commitment, Decoys, keccak256_to_scalar};
|
||||||
|
|
||||||
#[cfg(feature = "multisig")]
|
#[cfg(feature = "multisig")]
|
||||||
mod multisig;
|
mod multisig;
|
||||||
@@ -189,7 +190,7 @@ fn core(
|
|||||||
EdwardsPoint::multiscalar_mul([s[i], c_p, c_c], [ED25519_BASEPOINT_POINT, P[i], C[i]])
|
EdwardsPoint::multiscalar_mul([s[i], c_p, c_c], [ED25519_BASEPOINT_POINT, P[i], C[i]])
|
||||||
}
|
}
|
||||||
Mode::Verify(..) => {
|
Mode::Verify(..) => {
|
||||||
BASEPOINT_PRECOMP().vartime_mixed_multiscalar_mul([s[i]], [c_p, c_c], [P[i], C[i]])
|
G_PRECOMP().vartime_mixed_multiscalar_mul([s[i]], [c_p, c_c], [P[i], C[i]])
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user