Unverified Commit a9ab40db authored by Michael Müller's avatar Michael Müller Committed by GitHub
Browse files

Add automated spell-checking (#718)



* Add `.config`

* Fix hunspell complaints

* Run spellcheck in CI

* Improve hunspell config

* Fix 'pre' prefix

* Remove `|` from dictionary

* Add missing words to dictionary

* Add missing words to dictionary

* Add missing words to dictionary

* Fix `n`-th → nth

* Fix indentation

* Remove comment

* Fix number

* Fix spacing

* Remove regex

* Apply suggestions from code review
Co-authored-by: default avatarBernhard Schuster <bernhard@ahoi.io>

* Fix dictionary

* Fix dictionary

* Implement review comments

* Replace SRML with FRAME

* Replace occurrences of 'spreaded'

* Tuning text regarding 'spreaded'

* Update crates/storage/src/lazy/entry.rs
Co-authored-by: default avatarHero Bird <robin.freyler@gmail.com>
Co-authored-by: default avatarBernhard Schuster <bernhard@ahoi.io>
Co-authored-by: default avatarHero Bird <robin.freyler@gmail.com>
parent f329a928
Pipeline #129415 failed with stages
in 7 minutes and 28 seconds
......@@ -91,7 +91,7 @@ pub struct ChainExtensionMethod {
///
/// The default for this flag is `true`.
handle_status: bool,
/// If `false` the proc. macro no longer tries to enforce that the returned type encoded
/// If `false` the procedural macro no longer tries to enforce that the returned type encoded
/// into the output buffer of the chain extension method call is of type `Result<T, E>`.
/// Also `E` is no longer required to implement `From<Self::ErrorCode>` in case `handle_status`
/// flag does not exist.
......@@ -336,7 +336,7 @@ impl ChainExtension {
/// # Note
///
/// The input Rust trait item is going to be replaced with a concrete chain extension type definition
/// as a result of this proc. macro invocation.
/// as a result of this procedural macro invocation.
fn analyse_items(
item_trait: &syn::ItemTrait,
) -> Result<(syn::TraitItemType, Vec<ChainExtensionMethod>)> {
......
......@@ -653,7 +653,7 @@ pub fn test(attr: TokenStream, item: TokenStream) -> TokenStream {
///
/// # Usage
///
/// Usually the chain extension definition using this proc. macro is provided
/// Usually the chain extension definition using this procedural macro is provided
/// by the author of the chain extension in a separate crate.
/// ink! smart contracts using this chain extension simply depend on this crate
/// and use its associated environment definition in order to make use of
......
......@@ -18,7 +18,7 @@
///
/// # Note
///
/// This trait is automatically implemented when using `#[ink::chain_extension]` proc. macro.
/// This trait is automatically implemented when using `#[ink::chain_extension]` procedural macro.
pub trait ChainExtensionInstance {
/// The type of the chain extension instance.
type Instance;
......@@ -38,7 +38,7 @@ pub trait ChainExtension {
/// Only implemented for `Result<T, E>`.
///
/// Used to check at compile time if the return type of a chain extension method
/// Used to check at compile time if the chain extension method return type
/// is a `Result` type using the type system instead of the syntactic structure.
#[doc(hidden)]
pub trait IsResultType: private::Sealed {
......@@ -55,6 +55,6 @@ impl<T, E> IsResultType for Result<T, E> {
}
mod private {
/// Seals the `IsResultType` trait so that it cannot be implemented outside of this module.
/// Seals the `IsResultType` trait so that it cannot be implemented outside this module.
pub trait Sealed {}
}
......@@ -33,7 +33,7 @@ pub enum DispatchError {
}
impl DispatchError {
/// Converts `self` into an associated `u32` that SRML contracts can handle.
/// Converts `self` into an associated `u32` that FRAME contracts can handle.
#[inline]
pub fn to_u32(self) -> u32 {
DispatchRetCode::from(self).to_u32()
......@@ -56,7 +56,7 @@ impl DispatchRetCode {
///
/// # Note
///
/// This is useful to communicate back to SRML contracts.
/// This is useful to communicate back to FRAME contracts.
#[inline]
pub fn to_u32(self) -> u32 {
self.0
......
......@@ -15,9 +15,9 @@
/// Implemented by contracts in order to override `env().emit_event(..)`
/// syntax for emitting of ink! contract events.
///
/// # Dev Note
/// # Developer Note
///
/// Normally we'd try to define traits like these in the compagnion
/// Normally we'd try to define traits like these in the companion
/// `ink_lang` crate, however, due to Rust's orphan rules we must
/// define this trait here.
pub trait EmitEvent<C>
......
......@@ -27,7 +27,7 @@ use ink_env::{
use ink_storage::traits::SpreadLayout;
/// Trait used to indicate that an ink! trait definition has been checked
/// by the `#[ink::trait_definition]` proc. macro.
/// by the `#[ink::trait_definition]` procedural macro.
#[doc(hidden)]
pub unsafe trait CheckedInkTrait<T> {}
......
......@@ -330,7 +330,7 @@ pub enum CryptoHasher {
pub struct ArrayLayout<F: Form = MetaForm> {
/// The offset key of the array layout.
///
/// This is the same key as the 0-th element of the array layout.
/// This is the same key as the element at index 0 of the array layout.
offset: LayoutKey,
/// The number of elements in the array layout.
len: u32,
......@@ -363,7 +363,7 @@ where
{
/// Returns the offset key of the array layout.
///
/// This is the same key as the 0-th element of the array layout.
/// This is the same key as the element at index 0 of the array layout.
pub fn offset(&self) -> &LayoutKey {
&self.offset
}
......
......@@ -226,9 +226,9 @@ pub struct ConstructorSpec<F: Form = MetaForm> {
pub name: Vec<F::String>,
/// The selector hash of the message.
pub selector: Selector,
/// The parameters of the deploy handler.
/// The parameters of the deployment handler.
pub args: Vec<MessageParamSpec<F>>,
/// The deploy handler documentation.
/// The deployment handler documentation.
pub docs: Vec<F::String>,
}
......@@ -265,12 +265,12 @@ where
&self.selector
}
/// Returns the parameters of the deploy handler.
/// Returns the parameters of the deployment handler.
pub fn args(&self) -> &[MessageParamSpec<F>] {
&self.args
}
/// Returns the deploy handler documentation.
/// Returns the deployment handler documentation.
pub fn docs(&self) -> &[F::String] {
&self.docs
}
......@@ -278,11 +278,11 @@ where
/// A builder for constructors.
///
/// # Dev
/// # Developer Note
///
/// Some of the fields are guarded by a type-state pattern to
/// fail at compile-time instead of at run-time. This is useful
/// to better debug code-gen macros.
/// Some fields are guarded by a type-state pattern to fail at
/// compile-time instead of at run-time. This is useful to better
/// debug code-gen macros.
pub struct ConstructorSpecBuilder<Selector> {
spec: ConstructorSpec,
marker: PhantomData<fn() -> Selector>,
......@@ -405,7 +405,7 @@ mod state {
pub struct Mutates;
/// Type state for telling if the message is payable.
pub struct IsPayable;
/// Type state for the return type of a message.
/// Type state for the message return type.
pub struct Returns;
}
......@@ -504,11 +504,11 @@ where
/// A builder for messages.
///
/// # Dev
/// # Developer Note
///
/// Some of the fields are guarded by a type-state pattern to
/// fail at compile-time instead of at run-time. This is useful
/// to better debug code-gen macros.
/// Some fields are guarded by a type-state pattern to fail at
/// compile-time instead of at run-time. This is useful to better
/// debug code-gen macros.
#[allow(clippy::type_complexity)]
pub struct MessageSpecBuilder<Selector, Mutates, IsPayable, Returns> {
spec: MessageSpec,
......@@ -770,7 +770,7 @@ impl Selector {
/// however, it will miss the potentially important information that it
/// is being used through a type alias named `Foo`.
///
/// In ink! we current experience this problem with environmental types
/// In ink! we currently experience this problem with environmental types
/// such as the `Balance` type that is just a type alias to `u128` in the
/// default setup. Even though it would be useful for third party tools
/// such as the Polkadot UI to know that we are handling with `Balance`
......@@ -791,7 +791,7 @@ pub type DisplayName<F> = scale_info::Path<F>;
/// fn is_sorted(input: &[i32], pred: Predicate) -> bool;
/// ```
/// In this above example `input` would have no displayable name,
/// `pred`'s display name is `Predicate` and the display name of
/// `pred`s display name is `Predicate` and the display name of
/// the return type is simply `bool`. Note that `Predicate` could
/// simply be a type alias to `fn(i32, i32) -> Ordering`.
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
......@@ -1003,7 +1003,7 @@ impl EventParamSpecBuilder {
}
}
/// Describes the return type of a contract message.
/// Describes the contract message return type.
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(transparent)]
#[serde(bound(
......
......@@ -16,7 +16,7 @@ use crate::Key;
/// A key pointer.
///
/// This wraps a base key and provides an interface to mimic pointer arithmetics.
/// This wraps a base key and provides an interface to mimic pointer arithmetic.
/// Mainly used to coordinate keys through static storage structures.
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub struct KeyPtr {
......
......@@ -23,7 +23,7 @@ use crate::{
/// The dynamic allocator.
///
/// Manages dynamic storage allocations in a very efficient and economic way.
/// Manages dynamic storage allocations in a very efficient and economical way.
#[derive(Debug, Default, PartialEq, Eq)]
pub struct DynamicAllocator {
allocations: BitStash,
......
......@@ -32,7 +32,7 @@ use ink_primitives::Key;
///
/// Users can use this in order to make certain `SpreadLayout` storage entities
/// used in contexts that require a `PackedLayout` storage entity by simply
/// packing the storage entity witihn a `storage::Box`.
/// packing the storage entity within a `storage::Box`.
///
/// Dynamic allocations caused by the creation of `storage::Box` instances do
/// have some limited overhead:
......
......@@ -34,12 +34,12 @@ const DYNAMIC_ALLOCATOR_KEY_OFFSET: [u8; 32] = [0xFE; 32];
pub enum ContractPhase {
/// Initializes the global dynamic storage allocator from scratch.
///
/// Upon initialization it will be created from scratch as if the
/// Upon initialization, it will be created from scratch as if the
/// contract has been deployed for the first time.
Deploy,
/// Initializes the global dynamic storage allocator from storage.
///
/// Upon initialization the dynamic storage allocator will be pulled
/// Upon initialization, the dynamic storage allocator will be pulled
/// from the contract storage with the assumption that a former
/// contract deployment has already taken place in the past.
Call,
......@@ -51,12 +51,12 @@ pub enum ContractPhase {
enum DynamicAllocatorState {
/// The global instance has not yet been initialized.
///
/// Upon initialization it will be created from scratch as if the
/// Upon initialization, it will be created from scratch as if the
/// contract has been deployed for the first time.
UninitDeploy,
/// The global instance has not yet been initialized.
///
/// Upon initialization it will be pulled from the contract storage
/// Upon initialization, it will be pulled from the contract storage
/// with the assumption that a former contract deployment has already
/// taken place in the past.
UninitCall,
......
......@@ -22,24 +22,24 @@
//!
//! # Simplification
//!
//! The contracts pallet is using 256 bit keys for identifying storage cells.
//! This implies a storage space of 2^256 cells which is big enough to say that
//! The contracts pallet is using 256-bit keys for identifying storage cells.
//! This implies a storage space of `2^256` cells which is big enough to say that
//! there are probably never going to happen collisions anywhere at any time
//! if keys are chosen randomly. Using the built-in crypto hashers on unique
//! input we can be sure that there are never going to be collisions in this
//! space of 2^256 cells.
//! space of `2^256` cells.
//!
//! This way we can reduce the problem of finding another region in our storage
//! that fits certain requirements (e.g. a minimum size) to the problem of
//! finding another uniform slot. Since we are on 32-bit WebAssembly we have
//! memory limitations that make it impractical to have more than 2^32 dynamic
//! allocated entities and so we can create another limitation for having a
//! total of 2^32 dynamic allocations at any point in time.
//! memory limitations that make it impractical to have more than `2^32` dynamic
//! allocated entities, so we can create another limitation for having a total of
//! `2^32` dynamic allocations at any point in time.
//! This enables us to have 32-bit keys instead of 256-bit keys.
//!
//! We can convert such 32-bit keys (represented by e.g. a `u32`) into 256-bit
//! keys by using one of the built-in crypto hashes that has a 256-bit output,
//! e.g. KECCAK, SHA2 or BLAKE2. For technical reasons we should prepend the
//! e.g. KECCAK, SHA-2 or BLAKE-2. For technical reasons we should prepend the
//! bytes of the 32-bit key by some unique byte sequence, e.g.:
//! ```no_compile
//! let key256 = blake2x256(b"DYNAMICALLY ALLOCATED", bytes(key32));
......@@ -47,7 +47,7 @@
//!
//! # Internals
//!
//! As described in [# Simplification] there are 2^32 possible uniform dynamic
//! As described in [# Simplification] there are `2^32` possible uniform dynamic
//! allocations available. For each such slot the dynamic allocator stores via
//! a single bit in a bitvector if that slot is free or occupied.
//! This bitvector is called the `free` list.
......@@ -108,7 +108,7 @@ pub fn free(allocation: DynamicAllocation) {
/// in contract instantiations and calls.
/// - This has to be issued before the first interaction with the global allocator.
/// - The actual instantiation will happen only upon the first interaction with
/// the global allocator, e.g. using its `alloc` or `free` calls. Until then
/// the global allocator, e.g. using the `alloc` or `free` calls. Until then,
/// it remains uninitialized.
///
/// If this function is not called before the first global allocator interaction
......
......@@ -50,7 +50,7 @@ pub(super) enum ChildPosition {
/// contain one element (the root element).
pub(super) const CHILDREN_PER_NODE: u32 = 2;
/// Returns the index of the `Children` object in which the `n`-th element of
/// Returns the index of the `Children` object in which the nth element of
/// the heap is stored.
pub(super) fn get_children_storage_index(n: u32) -> u32 {
if n == 0 {
......@@ -63,7 +63,7 @@ pub(super) fn get_children_storage_index(n: u32) -> u32 {
(n + padding) / CHILDREN_PER_NODE
}
/// Returns the `ChildPosition` of the `n`-th heap element.
/// Returns the `ChildPosition` of the nth heap element.
///
/// For example, the element `3` is found at the child position `0`
/// (within the `Children` object at storage index `2`).
......
......@@ -14,7 +14,7 @@
//! Provides an interface around the vector used to store elements of the
//! [`BinaryHeap`](`super::BinaryHeap`) in storage. This is necessary since
//! we don't just store each element in it's own storage cell, but rather
//! we don't just store each element in its own storage cell, but rather
//! optimize storage access by putting children together in one storage cell.
use super::{
......@@ -35,7 +35,7 @@ use crate::{
///
/// Elements of the heap are stored in a vector of `Children` objects, whereby
/// each `Children` object contains two elements. When operating on indices of
/// the `BinaryHeap` this interface transposes heap indices to the child inside
/// the `BinaryHeap`, this interface transposes heap indices to the child inside
/// the `Children` object, in which the element is stored.
#[derive(Default, PartialEq, Eq, Debug)]
pub struct ChildrenVec<T>
......@@ -73,7 +73,7 @@ pub(super) struct ChildInfoMut<'a, T> {
/// This property exists only in `ChildInfoMut`, but not in `ChildInfo`.
/// The reason is that in the case of pop-ping a child from a `Children`
/// object we need to check if the child count of that object is `0` after
/// the pop operation. In that case no children are left in the object
/// the pop operation. In that case no children are left in the object,
/// and it can be removed altogether from the heap.
pub child_count: usize,
}
......@@ -98,7 +98,7 @@ where
}
}
/// Returns the number of elements in the heap, also referred to as its 'length'.
/// Returns the number of elements in the heap, also referred to as its length.
#[inline]
pub fn len(&self) -> u32 {
*self.len
......
......@@ -41,8 +41,8 @@ pub use reverse::Reverse;
///
/// The heap is a *max-heap* by default, i.e. the first element is the largest.
/// Either [`Reverse`] or a custom `Ord` implementation can be used to
/// make `BinaryHeap` a *min-heap*. This makes `heap.pop()` return the smallest
/// value instead of the largest one.
/// make `BinaryHeap` a *min-heap*. This then makes `heap.pop()` return the
/// smallest value instead of the largest one.
#[derive(Default, PartialEq, Eq, Debug)]
pub struct BinaryHeap<T>
where
......@@ -63,7 +63,7 @@ where
}
}
/// Returns the number of elements in the heap, also referred to as its 'length'.
/// Returns the number of elements in the heap, also referred to as its length.
pub fn len(&self) -> u32 {
self.elements.len()
}
......@@ -211,8 +211,8 @@ where
/// If `true`, on `drop()` will sift the peeked value down the tree if after mutation it is no
/// longer the largest value, in order to keep the heap in a consistent state.
///
/// If the peeked value is consumed via `PeekMut::pop()` then this is set to false to prevent
/// a redundant reorg which would already have happened via `BinaryHeap::pop()`.
/// If the peeked value is consumed via `PeekMut::pop()` then this is set to false in order
/// to prevent a redundant reorg which would already have happened via `BinaryHeap::pop()`.
sift: bool,
}
......
......@@ -20,7 +20,7 @@ use super::BitStash;
///
/// For each odd `x` in `xs` a number of put operations are executed.
/// For each even `x` it is asserted that the previously inserted elements
/// are in the stash and they are taken out subsequently.
/// are in the stash, and they are taken out subsequently.
///
/// The reasoning behind this even/odd sequence is to introduce some
/// randomness into when elements are inserted/removed.
......
......@@ -50,7 +50,7 @@ pub struct BitStash {
/// represent 256 different states but since we consider 0 we need an extra
/// 9th bit. This 9th bit tells for every 256-bit chunk if it is full.
///
/// In theory it is possible to search up to 8192 storage cells for free
/// In theory, it is possible to search up to 8192 storage cells for free
/// slots with a single contract storage look-up. By iterating over the 32
/// `CountFree` instances of a single instance.
counts: StorageVec<CountFree>,
......
......@@ -24,7 +24,7 @@ use super::{
pub struct BitRefMut<'a> {
/// The queried pack of 256 bits.
bits: &'a mut Bits256,
/// The bit position witihn the queried bit pack.
/// The bit position within the queried bit pack.
at: u8,
}
......@@ -37,7 +37,7 @@ impl<'a> PartialEq for BitRefMut<'a> {
impl<'a> Eq for BitRefMut<'a> {}
impl<'a> BitRefMut<'a> {
/// Creates a new bit access for the indexed bit within the 256-bit pack.
/// Creates access to the indexed bit within the 256-bit pack.
pub(super) fn new(bits: &'a mut Bits256, at: Index256) -> Self {
Self { bits, at }
}
......
......@@ -124,7 +124,7 @@ impl<'a> IterMut<'a> {
self.end - self.start
}
/// Returns a bit access for the given index with extended but valid lifetimes.
/// Returns access for the given bit index with extended but valid lifetimes.
fn get<'b>(&'b mut self, index: u8) -> BitRefMut<'a> {
unsafe { BitRefMut::new(extend_lifetime(&mut self.bits), index) }
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment