Mostly lint Monero

This commit is contained in:
Luke Parker
2023-07-08 00:56:43 -04:00
parent dd5fb0df47
commit f93106af6b
35 changed files with 553 additions and 459 deletions

View File

@@ -8,8 +8,10 @@ use dalek_ff_group::FieldElement;
use crate::hash;
/// Monero's hash to point function, as named `ge_fromfe_frombytes_vartime`.
#[allow(clippy::many_single_char_names)]
#[must_use]
pub fn hash_to_point(bytes: [u8; 32]) -> EdwardsPoint {
#[allow(non_snake_case)]
#[allow(non_snake_case, clippy::unreadable_literal)]
let A = FieldElement::from(486662u64);
let v = FieldElement::from_square(hash(&bytes)).double();

View File

@@ -61,6 +61,7 @@ pub struct Generators {
}
/// Generate generators as needed for Bulletproofs(+), as Monero does.
#[must_use]
pub fn bulletproofs_generators(dst: &'static [u8]) -> Generators {
let mut res =
Generators { G: [EdwardsPoint::identity(); MAX_MN], H: [EdwardsPoint::identity(); MAX_MN] };

View File

@@ -1,6 +1,8 @@
use std_shims::io::{self, Write};
const VARINT_CONTINUATION_MASK: u8 = 0b1000_0000;
#[allow(clippy::trivially_copy_pass_by_ref)] // &u64 is needed for API consistency
pub(crate) fn write_varint<W: Write>(varint: &u64, w: &mut W) -> io::Result<()> {
let mut varint = *varint;
while {