fix typos

Closes #421
This commit is contained in:
Vasyl Tretiakov 2025-01-23 03:20:30 +02:00 committed by Tyler Sturos
parent a050647afb
commit b485060334
4 changed files with 9 additions and 9 deletions

View File

@ -23,11 +23,11 @@ use super::super::gmp::mpz::{mp_bitcnt_t, mp_limb_t};
use libc::{c_int, c_long, c_ulong, c_void, size_t};
// pub use c_ulong;
use std::{mem, usize};
// We use the unsafe versions to avoid unecessary allocations.
// We use the unsafe versions to avoid unnecessary allocations.
extern "C" {
fn adapted_nudupl(a: *mut Mpz, b: *mut Mpz, c: *mut Mpz, times: c_ulong);
}
// We use the unsafe versions to avoid unecessary allocations.
// We use the unsafe versions to avoid unnecessary allocations.
#[link(name = "gmp")]
extern "C" {
fn __gmpz_gcdext(gcd: *mut Mpz, s: *mut Mpz, t: *mut Mpz, a: *const Mpz, b: *const Mpz);

View File

@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#![deny(warnings)]
//! # Rust implementations of class groups and verifyable delay functions
//! # Rust implementations of class groups and verifiable delay functions
//!
//! This repo includes three crates
//!
//! * `classgroup`, which includes a class group implementation, as well as a
//! trait for class groups.
//! * `vdf`, which includes a Verifyable Delay Function (VDF) trait, as well as
//! * `vdf`, which includes a Verifiable Delay Function (VDF) trait, as well as
//! an implementation of that trait.
//! * `vdf-cli`, which includes a command-line interface to the `vdf` crate. It
//! also includes additional commands, which are deprecated and will later be
@ -155,7 +155,7 @@ pub trait VDFParams: Clone + Eq {
/// consumers of this trait **MUST NOT** expect this.
///
/// Instances of this trait are *not* expected to be `Sync`. This allows them
/// to reuse allocations (such as scratch memory) accross invocations without
/// to reuse allocations (such as scratch memory) across invocations without
/// the need for locking. However, they **MUST** be `Send` and `Clone`, so that
/// consumers can duplicate them and send them across threads.
pub trait VDF: Send + Debug {
@ -170,7 +170,7 @@ pub trait VDF: Send + Debug {
/// The challenge is an opaque byte string of arbitrary length.
/// Implementors **MUST NOT** make any assumptions about its contents,
/// and **MUST** produce distinct outputs for distinct challenges
/// (except with negiligible probability).
/// (except with negligible probability).
///
/// This can be most easily implemented by using the challenge as part of
/// the input of a cryptographic hash function. The VDFs provided in this
@ -209,7 +209,7 @@ pub trait VDF: Send + Debug {
///
/// # Rationale
///
/// It would be more ideomatic Rust to use the type system to enforce that a
/// It would be more idiomatic Rust to use the type system to enforce that a
/// difficulty has been validated before use. However, I (Demi) have not
/// yet figured out an object-safe way to do so.
fn check_difficulty(&self, difficulty: u64) -> Result<(), InvalidIterations>;

View File

@ -454,7 +454,7 @@ mod test {
assert_eq!(calculate_final_t(Iterations(100), 8), 100);
}
#[test]
fn check_assuptions_about_stdlib() {
fn check_assumptions_about_stdlib() {
assert_eq!(62 - u64::leading_zeros(1024u64), 9);
let mut q: Vec<_> = (1..4).step_by(2).collect();
assert_eq!(q[..], [1, 3]);

View File

@ -91,7 +91,7 @@ pub fn approximate_parameters(t: f64) -> (usize, u8, u64) {
fn u64_to_bytes(q: u64) -> [u8; 8] {
if false {
// This use of `std::mem::transumte` is correct, but still not justified.
// This use of `std::mem::transmute` is correct, but still not justified.
unsafe { std::mem::transmute(q.to_be()) }
} else {
[