mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-11 13:39:25 +00:00
Misc lint
This commit is contained in:
@@ -11,10 +11,10 @@ use curve25519_dalek::{constants::ED25519_BASEPOINT_TABLE, scalar::Scalar, edwar
|
|||||||
pub(crate) mod hash_to_point;
|
pub(crate) mod hash_to_point;
|
||||||
pub use hash_to_point::{raw_hash_to_point, hash_to_point};
|
pub use hash_to_point::{raw_hash_to_point, hash_to_point};
|
||||||
|
|
||||||
/// CLSAG struct, along with signing and verifying functionality.
|
|
||||||
pub mod clsag;
|
|
||||||
/// MLSAG struct, along with verifying functionality.
|
/// MLSAG struct, along with verifying functionality.
|
||||||
pub mod mlsag;
|
pub mod mlsag;
|
||||||
|
/// CLSAG struct, along with signing and verifying functionality.
|
||||||
|
pub mod clsag;
|
||||||
/// BorromeanRange struct, along with verifying functionality.
|
/// BorromeanRange struct, along with verifying functionality.
|
||||||
pub mod borromean;
|
pub mod borromean;
|
||||||
/// Bulletproofs(+) structs, along with proving and verifying functionality.
|
/// Bulletproofs(+) structs, along with proving and verifying functionality.
|
||||||
@@ -23,7 +23,7 @@ pub mod bulletproofs;
|
|||||||
use crate::{
|
use crate::{
|
||||||
Protocol,
|
Protocol,
|
||||||
serialize::*,
|
serialize::*,
|
||||||
ringct::{clsag::Clsag, mlsag::Mlsag, bulletproofs::Bulletproofs, borromean::BorromeanRange},
|
ringct::{mlsag::Mlsag, clsag::Clsag, borromean::BorromeanRange, bulletproofs::Bulletproofs},
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Generate a key image for a given key. Defined as `x * hash_to_point(xG)`.
|
/// Generate a key image for a given key. Defined as `x * hash_to_point(xG)`.
|
||||||
@@ -60,8 +60,8 @@ impl EncryptedAmount {
|
|||||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
pub struct RctBase {
|
pub struct RctBase {
|
||||||
pub fee: u64,
|
pub fee: u64,
|
||||||
pub encrypted_amounts: Vec<EncryptedAmount>,
|
|
||||||
pub pseudo_outs: Vec<EdwardsPoint>,
|
pub pseudo_outs: Vec<EdwardsPoint>,
|
||||||
|
pub encrypted_amounts: Vec<EncryptedAmount>,
|
||||||
pub commitments: Vec<EdwardsPoint>,
|
pub commitments: Vec<EdwardsPoint>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ impl RctBase {
|
|||||||
let rct_type = read_byte(r)?;
|
let rct_type = read_byte(r)?;
|
||||||
Ok((
|
Ok((
|
||||||
if rct_type == 0 {
|
if rct_type == 0 {
|
||||||
RctBase { fee: 0, encrypted_amounts: vec![], pseudo_outs: vec![], commitments: vec![] }
|
RctBase { fee: 0, pseudo_outs: vec![], encrypted_amounts: vec![], commitments: vec![] }
|
||||||
} else {
|
} else {
|
||||||
RctBase {
|
RctBase {
|
||||||
fee: read_varint(r)?,
|
fee: read_varint(r)?,
|
||||||
|
|||||||
@@ -278,7 +278,6 @@ impl<R: RpcConnection> Rpc<R> {
|
|||||||
let res: BlockResponse =
|
let res: BlockResponse =
|
||||||
self.json_rpc_call("get_block", Some(json!({ "hash": hex::encode(hash) }))).await?;
|
self.json_rpc_call("get_block", Some(json!({ "hash": hex::encode(hash) }))).await?;
|
||||||
|
|
||||||
// TODO: Verify the TXs included are actually committed to by the header
|
|
||||||
let block =
|
let block =
|
||||||
Block::read::<&[u8]>(&mut rpc_hex(&res.blob)?.as_ref()).map_err(|_| RpcError::InvalidNode)?;
|
Block::read::<&[u8]>(&mut rpc_hex(&res.blob)?.as_ref()).map_err(|_| RpcError::InvalidNode)?;
|
||||||
if block.hash() != hash {
|
if block.hash() != hash {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use curve25519_dalek::{
|
|||||||
edwards::{EdwardsPoint, CompressedEdwardsY},
|
edwards::{EdwardsPoint, CompressedEdwardsY},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{hash, hash_to_scalar, serialize::write_varint, transaction::Input};
|
use crate::{hash, hash_to_scalar, serialize::write_varint, ringct::EncryptedAmount, transaction::Input};
|
||||||
|
|
||||||
pub mod extra;
|
pub mod extra;
|
||||||
pub(crate) use extra::{PaymentId, ExtraField, Extra};
|
pub(crate) use extra::{PaymentId, ExtraField, Extra};
|
||||||
@@ -35,7 +35,6 @@ pub use send::SignableTransactionBuilder;
|
|||||||
pub(crate) use send::InternalPayment;
|
pub(crate) use send::InternalPayment;
|
||||||
#[cfg(feature = "multisig")]
|
#[cfg(feature = "multisig")]
|
||||||
pub use send::TransactionMachine;
|
pub use send::TransactionMachine;
|
||||||
use crate::ringct::EncryptedAmount;
|
|
||||||
|
|
||||||
fn key_image_sort(x: &EdwardsPoint, y: &EdwardsPoint) -> core::cmp::Ordering {
|
fn key_image_sort(x: &EdwardsPoint, y: &EdwardsPoint) -> core::cmp::Ordering {
|
||||||
x.compress().to_bytes().cmp(&y.compress().to_bytes()).reverse()
|
x.compress().to_bytes().cmp(&y.compress().to_bytes()).reverse()
|
||||||
@@ -87,6 +86,12 @@ pub(crate) fn shared_key(
|
|||||||
(view_tag, hash_to_scalar(&shared_key), payment_id_xor)
|
(view_tag, hash_to_scalar(&shared_key), payment_id_xor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn commitment_mask(shared_key: Scalar) -> Scalar {
|
||||||
|
let mut mask = b"commitment_mask".to_vec();
|
||||||
|
mask.extend(shared_key.to_bytes());
|
||||||
|
hash_to_scalar(&mask)
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn amount_encryption(amount: u64, key: Scalar) -> [u8; 8] {
|
pub(crate) fn amount_encryption(amount: u64, key: Scalar) -> [u8; 8] {
|
||||||
let mut amount_mask = b"amount".to_vec();
|
let mut amount_mask = b"amount".to_vec();
|
||||||
amount_mask.extend(key.to_bytes());
|
amount_mask.extend(key.to_bytes());
|
||||||
@@ -126,12 +131,6 @@ fn amount_decryption(amount: &EncryptedAmount, key: Scalar) -> (Scalar, u64) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn commitment_mask(shared_key: Scalar) -> Scalar {
|
|
||||||
let mut mask = b"commitment_mask".to_vec();
|
|
||||||
mask.extend(shared_key.to_bytes());
|
|
||||||
hash_to_scalar(&mask)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The private view key and public spend key, enabling scanning transactions.
|
/// The private view key and public spend key, enabling scanning transactions.
|
||||||
#[derive(Clone, Zeroize, ZeroizeOnDrop)]
|
#[derive(Clone, Zeroize, ZeroizeOnDrop)]
|
||||||
pub struct ViewPair {
|
pub struct ViewPair {
|
||||||
|
|||||||
Reference in New Issue
Block a user