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

Enable `spellcheck` CI stage (#822)

* Enable `spellcheck` CI job

* Fix spellchecking mistakes

* Implement review suggestion

* Reword `>= 2`
parent e1486563
Pipeline #142848 passed with stages
in 29 minutes and 17 seconds
60 80
WebAssembly WebAssembly
Wasm Wasm
Wasm32
validator validator
ERC ERC
fuzzer fuzzer
...@@ -29,13 +30,26 @@ getter ...@@ -29,13 +30,26 @@ getter
bitvector bitvector
dereferencing dereferencing
recurse recurse
kb kB
scalability scalability
scalable scalable
adjunctive adjunctive
invariants invariants
deserializes deserializes
DApp DApp
RPC
AST
untyped
variadic
evaluable
multisig
Gnosis
stdin
stdout
interoperate
cryptographic
Polkadot
bitwise
hasher/S hasher/S
hashmap/S hashmap/S
...@@ -50,3 +64,8 @@ layout/JG ...@@ -50,3 +64,8 @@ layout/JG
endian/P endian/P
accessor/S accessor/S
NFT/S NFT/S
encoding/S
blockchain/S
backend/S
namespace/S
runtime/S
...@@ -152,9 +152,6 @@ docs: ...@@ -152,9 +152,6 @@ docs:
spellcheck: spellcheck:
stage: workspace stage: workspace
<<: *docker-env <<: *docker-env
rules:
- if: $CI_PIPELINE_SOURCE == "pipeline"
when: never
script: script:
- cargo spellcheck check --cfg=.config/cargo_spellcheck.toml --checkers hunspell --code 1 - cargo spellcheck check --cfg=.config/cargo_spellcheck.toml --checkers hunspell --code 1
- for example in examples/*/; do - for example in examples/*/; do
......
...@@ -50,7 +50,7 @@ Following these will ensure that your pull request is going to be accepted. ...@@ -50,7 +50,7 @@ Following these will ensure that your pull request is going to be accepted.
Please try to fix them by yourself and resolve all remaining to-do items. Please try to fix them by yourself and resolve all remaining to-do items.
If that is not possible then write an issue for each of them and link to the source line and commit with a proper description. For more information go [here](#Issues-&-pull-requests). If that is not possible then write an issue for each of them and link to the source line and commit with a proper description. For more information go [here](#Issues-&-pull-requests).
1. Document everything properly that you have written, refactored or touched. Especially keeping documentation up-to-date is very important. For larger portions please try to also update the ink! wiki or write a new entry there. 1. Document everything properly that you have written, refactored or touched. Especially keeping documentation up-to-date is very important. For larger portions please try to also update the ink! wiki or write a new entry there.
1. Write tests for your code. If your code is hard to test, try to find a design that allows for testability. 1. Write tests for your code. If your code is hard to test, try to find a design that allows for testing.
1. If needed also update the [`README`](README.md). 1. If needed also update the [`README`](README.md).
1. For performance critical parts we also want additional performance tests. 1. For performance critical parts we also want additional performance tests.
1. If you implement a fix for a reported bug also include a regression test alongside the fix if possible. 1. If you implement a fix for a reported bug also include a regression test alongside the fix if possible.
......
...@@ -243,7 +243,7 @@ pub struct Spreaded { ...@@ -243,7 +243,7 @@ pub struct Spreaded {
### Packing Storage ### Packing Storage
We can alter this behaviour by using the `ink_storage::Pack` abstraction: We can alter this behavior by using the `ink_storage::Pack` abstraction:
```rust ```rust
pub struct Spreaded { pub struct Spreaded {
...@@ -972,7 +972,7 @@ caller of a function or amount of value sent), but these will be added back in t ...@@ -972,7 +972,7 @@ caller of a function or amount of value sent), but these will be added back in t
## ink!-less Implementations ## ink!-less Implementations
It is also possible to annotate an entire impl blocks with: It is also possible to annotate an entire `impl` blocks with:
```rust ```rust
#[ink(impl)] #[ink(impl)]
...@@ -983,6 +983,6 @@ impl Contract { ...@@ -983,6 +983,6 @@ impl Contract {
}. }.
``` ```
This is useful if the `impl` block itself doesn't contain any ink! constructors or messages, but you This is useful if the `impl` block itself does not contain any ink! constructors or messages, but you
still need to access some of the "magic" provided by ink!. In the example above, you would not have still need to access some of the "magic" provided by ink!. In the example above, you would not have
access to `emit_event` without `#[ink(impl)]`. access to `emit_event` without `#[ink(impl)]`.
...@@ -421,7 +421,7 @@ impl Engine { ...@@ -421,7 +421,7 @@ impl Engine {
/// Copies the `slice` into `output`. /// Copies the `slice` into `output`.
/// ///
/// Panics if the slice is too large and doesn't fit. /// Panics if the slice is too large and does not fit.
fn set_output(output: &mut &mut [u8], slice: &[u8]) { fn set_output(output: &mut &mut [u8], slice: &[u8]) {
if slice.len() > output.len() { if slice.len() > output.len() {
panic!( panic!(
......
...@@ -177,11 +177,11 @@ where ...@@ -177,11 +177,11 @@ where
/// ///
/// # Parameters /// # Parameters
/// ///
/// - `at_refcount`: The refcount assumed for the returned `custom_refcount_*` fields. /// - `at_refcount`: The `refcount` assumed for the returned `custom_refcount_*` fields.
/// If `None` is supplied the `custom_refcount_*` fields will also be `None`. /// If `None` is supplied the `custom_refcount_*` fields will also be `None`.
/// ///
/// The `current_*` fields of `RentStatus` do **not** consider changes to the code's /// The `current_*` fields of `RentStatus` do **not** consider changes to the code's
/// refcount made during the currently running call. /// `refcount` made during the currently running call.
/// ///
/// # Errors /// # Errors
/// ///
...@@ -415,7 +415,7 @@ where ...@@ -415,7 +415,7 @@ where
/// in the restorer contract to not influence the hash calculations. /// in the restorer contract to not influence the hash calculations.
/// - Does *not* perform restoration right away but defers it to the end of /// - Does *not* perform restoration right away but defers it to the end of
/// the contract execution. /// the contract execution.
/// - Restoration is cancelled if there is no tombstone in the destination /// - Restoration is canceled if there is no tombstone in the destination
/// address or if the hashes don't match. No changes are made in this case. /// address or if the hashes don't match. No changes are made in this case.
pub fn restore_contract<T>( pub fn restore_contract<T>(
account_id: T::AccountId, account_id: T::AccountId,
...@@ -467,7 +467,7 @@ where ...@@ -467,7 +467,7 @@ where
/// ///
/// # Errors /// # Errors
/// ///
/// - If the contract doesn't have sufficient funds. /// - If the contract does not have sufficient funds.
/// - If the transfer had brought the sender's total balance below the /// - If the transfer had brought the sender's total balance below the
/// subsistence threshold. /// subsistence threshold.
pub fn transfer<T>(destination: T::AccountId, value: T::Balance) -> Result<()> pub fn transfer<T>(destination: T::AccountId, value: T::Balance) -> Result<()>
......
...@@ -49,7 +49,7 @@ use ink_primitives::Key; ...@@ -49,7 +49,7 @@ use ink_primitives::Key;
/// The capacity of the static buffer. /// The capacity of the static buffer.
/// This is the same size as the ink! on-chain environment. We chose to use the same size /// This is the same size as the ink! on-chain environment. We chose to use the same size
/// to be as close to the on-chain behavior as possible. /// to be as close to the on-chain behavior as possible.
const BUFFER_SIZE: usize = 1 << 14; // 16kB const BUFFER_SIZE: usize = 1 << 14; // 16 kB
impl CryptoHash for Blake2x128 { impl CryptoHash for Blake2x128 {
fn hash(input: &[u8], output: &mut <Self as HashOutput>::Type) { fn hash(input: &[u8], output: &mut <Self as HashOutput>::Type) {
......
...@@ -140,7 +140,7 @@ pub fn recorded_debug_messages() -> RecordedDebugMessages { ...@@ -140,7 +140,7 @@ pub fn recorded_debug_messages() -> RecordedDebugMessages {
/// ///
/// # Note /// # Note
/// ///
/// Useful for benchmarking because it ensures the initialized storage is maintained across runs, /// Useful for benchmarks because it ensures the initialized storage is maintained across runs,
/// because lazy storage structures automatically clear their associated cells when they are dropped. /// because lazy storage structures automatically clear their associated cells when they are dropped.
pub fn set_clear_storage_disabled(_disable: bool) { pub fn set_clear_storage_disabled(_disable: bool) {
unimplemented!( unimplemented!(
...@@ -233,7 +233,7 @@ where ...@@ -233,7 +233,7 @@ where
}) })
} }
/// Runs the given closure test function with the default configuartion /// Runs the given closure test function with the default configuration
/// for the off-chain environment. /// for the off-chain environment.
pub fn run_test<T, F>(f: F) -> Result<()> pub fn run_test<T, F>(f: F) -> Result<()>
where where
......
...@@ -89,12 +89,12 @@ impl Block { ...@@ -89,12 +89,12 @@ impl Block {
/// # Note /// # Note
/// ///
/// - This is the off-chain environment implementation of /// - This is the off-chain environment implementation of
/// [`random`][`crate::random`]. It provides the same behaviour in that it /// [`random`][`crate::random`]. It provides the same behavior in that it
/// will likely yield the same hash for the same subjects within the same /// will likely yield the same hash for the same subjects within the same
/// block (or execution context). /// block (or execution context).
/// ///
/// - Returned hashes on the surface might appear random, however for /// - Returned hashes on the surface might appear random, however for
/// testability purposes the actual implementation is quite simple and /// testing purposes the actual implementation is quite simple and
/// computes those "random" hashes by wrapping XOR of the internal entry hash /// computes those "random" hashes by wrapping XOR of the internal entry hash
/// with the eventually repeated sequence of the subject buffer. /// with the eventually repeated sequence of the subject buffer.
pub fn random<T>(&self, subject: &[u8]) -> Result<T::Hash> pub fn random<T>(&self, subject: &[u8]) -> Result<T::Hash>
......
...@@ -198,7 +198,7 @@ impl EnvInstance { ...@@ -198,7 +198,7 @@ impl EnvInstance {
); );
// Initialize the execution context for the first contract execution. // Initialize the execution context for the first contract execution.
use crate::call::Selector; use crate::call::Selector;
// The below selector bytes are incorrect but since calling doesn't work // The below selector bytes are incorrect but since calling does not work
// yet we do not have to fix this now. // yet we do not have to fix this now.
let selector_bytes_for_call = [0x00; 4]; let selector_bytes_for_call = [0x00; 4];
self.exec_context.push( self.exec_context.push(
......
...@@ -206,7 +206,7 @@ where ...@@ -206,7 +206,7 @@ where
.map_err(Into::into) .map_err(Into::into)
} }
/// Update the [ChainSpec](`crate::test::ChainSpec`) for the test environment /// Update the [`ChainSpec`](`crate::test::ChainSpec`) for the test environment
pub fn update_chain_spec<F>(f: F) -> Result<()> pub fn update_chain_spec<F>(f: F) -> Result<()>
where where
F: FnOnce(&mut ChainSpec), F: FnOnce(&mut ChainSpec),
...@@ -261,7 +261,7 @@ where ...@@ -261,7 +261,7 @@ where
/// ///
/// # Note /// # Note
/// ///
/// Useful for benchmarking because it ensures the initialized storage is maintained across runs, /// Useful for benchmarks because it ensures the initialized storage is maintained across runs,
/// because lazy storage structures automatically clear their associated cells when they are dropped. /// because lazy storage structures automatically clear their associated cells when they are dropped.
pub fn set_clear_storage_disabled(disable: bool) { pub fn set_clear_storage_disabled(disable: bool) {
<EnvInstance as OnInstance>::on_instance(|instance| { <EnvInstance as OnInstance>::on_instance(|instance| {
...@@ -321,7 +321,7 @@ where ...@@ -321,7 +321,7 @@ where
}) })
} }
/// Runs the given closure test function with the default configuartion /// Runs the given closure test function with the default configuration
/// for the off-chain environment. /// for the off-chain environment.
pub fn run_test<T, F>(f: F) -> Result<()> pub fn run_test<T, F>(f: F) -> Result<()>
where where
......
...@@ -41,14 +41,14 @@ pub struct TypedEncoded<T> { ...@@ -41,14 +41,14 @@ pub struct TypedEncoded<T> {
/// - If this is `None` it means that the instance is currently untyped /// - If this is `None` it means that the instance is currently untyped
/// and will take over any given type upon the first typed interaction. /// and will take over any given type upon the first typed interaction.
/// - This is needed since instances of `TypedEncoded` are going to be used /// - This is needed since instances of `TypedEncoded` are going to be used
/// in static memory where it isn't possible to decide about the used types /// in static memory where it is not possible to decide about the used types
/// given by `Environment` at initialization. /// given by `Environment` at initialization.
type_id: Option<TypeId>, type_id: Option<TypeId>,
/// Classification marker. /// Classification marker.
/// ///
/// # Note /// # Note
/// ///
/// - This shouldn't be the typed that is actually stored as encoded /// - This should not be the typed that is actually stored as encoded
/// representation in `self.encoded` but should primarily be an /// representation in `self.encoded` but should primarily be an
/// abstract marker type that may be used for classification. /// abstract marker type that may be used for classification.
/// - The idea behind the marker is to say that whenever two instances /// - The idea behind the marker is to say that whenever two instances
...@@ -245,7 +245,7 @@ impl<M> TypedEncoded<M> { ...@@ -245,7 +245,7 @@ impl<M> TypedEncoded<M> {
Ok(()) Ok(())
} }
/// Evaluates the given clousure on the given typed encoded instances. /// Evaluates the given closure on the given typed encoded instances.
pub fn eval<T, F, R>(&self, other: &Self, f: F) -> Result<R> pub fn eval<T, F, R>(&self, other: &Self, f: F) -> Result<R>
where where
T: scale::Decode + 'static, T: scale::Decode + 'static,
...@@ -257,7 +257,7 @@ impl<M> TypedEncoded<M> { ...@@ -257,7 +257,7 @@ impl<M> TypedEncoded<M> {
Ok(f(&decoded_self, &decoded_other)) Ok(f(&decoded_self, &decoded_other))
} }
/// Evaluates the given clousure on the given typed decoded instances /// Evaluates the given closure on the given typed decoded instances
/// and writes back the result into the typed encoded instance. /// and writes back the result into the typed encoded instance.
pub fn eval_mut<T, F, R>(&mut self, other: &Self, f: F) -> Result<R> pub fn eval_mut<T, F, R>(&mut self, other: &Self, f: F) -> Result<R>
where where
......
...@@ -12,15 +12,15 @@ ...@@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
/// A static buffer with 16kB of capacity. /// A static buffer with 16 kB of capacity.
pub struct StaticBuffer { pub struct StaticBuffer {
/// The static buffer with a total capacity of 16kB. /// The static buffer with a total capacity of 16 kB.
buffer: [u8; Self::CAPACITY], buffer: [u8; Self::CAPACITY],
} }
impl StaticBuffer { impl StaticBuffer {
/// The capacity of the static buffer. /// The capacity of the static buffer.
const CAPACITY: usize = 1 << 14; // 16kB const CAPACITY: usize = 1 << 14; // 16 kB
/// Creates a new static buffer. /// Creates a new static buffer.
pub const fn new() -> Self { pub const fn new() -> Self {
...@@ -105,7 +105,7 @@ impl<'a> scale::Output for EncodeScope<'a> { ...@@ -105,7 +105,7 @@ impl<'a> scale::Output for EncodeScope<'a> {
/// ///
/// # Note /// # Note
/// ///
/// This is used to efficiently chunk up ink!'s internal static 16kB buffer /// This is used to efficiently chunk up ink!'s internal static 16 kB buffer
/// into smaller sub buffers for processing different parts of computations. /// into smaller sub buffers for processing different parts of computations.
#[derive(Debug)] #[derive(Debug)]
pub struct ScopedBuffer<'a> { pub struct ScopedBuffer<'a> {
...@@ -122,7 +122,7 @@ impl<'a> From<&'a mut [u8]> for ScopedBuffer<'a> { ...@@ -122,7 +122,7 @@ impl<'a> From<&'a mut [u8]> for ScopedBuffer<'a> {
impl<'a> ScopedBuffer<'a> { impl<'a> ScopedBuffer<'a> {
/// Splits the scoped buffer into yet another piece to operate on it temporarily. /// Splits the scoped buffer into yet another piece to operate on it temporarily.
/// ///
/// The splitted buffer will have an offset of 0 but be offset by `self`'s offset. /// The split buffer will have an offset of 0 but be offset by `self`'s offset.
pub fn split(&mut self) -> ScopedBuffer { pub fn split(&mut self) -> ScopedBuffer {
ScopedBuffer { ScopedBuffer {
offset: 0, offset: 0,
......
...@@ -652,9 +652,9 @@ pub fn random(subject: &[u8], output: &mut &mut [u8]) { ...@@ -652,9 +652,9 @@ pub fn random(subject: &[u8], output: &mut &mut [u8]) {
#[cfg(feature = "ink-debug")] #[cfg(feature = "ink-debug")]
/// Call `seal_debug_message` with the supplied UTF-8 encoded message. /// Call `seal_debug_message` with the supplied UTF-8 encoded message.
/// ///
/// If debug message recording is disabled in the contracts pallet, the first call to will /// If debug message recording is disabled in the contracts pallet, the first call will
/// return LoggingDisabled error, and further calls will be a no-op to avoid the cost of calling /// return a `LoggingDisabled` error, and further calls will be a no-op to avoid the cost
/// into the supervisor. /// of calling into the supervisor.
/// ///
/// # Note /// # Note
/// ///
......
...@@ -170,7 +170,7 @@ where ...@@ -170,7 +170,7 @@ where
} }
impl EnvInstance { impl EnvInstance {
/// Returns a new scoped buffer for the entire scope of the static 16kB buffer. /// Returns a new scoped buffer for the entire scope of the static 16 kB buffer.
fn scoped_buffer(&mut self) -> ScopedBuffer { fn scoped_buffer(&mut self) -> ScopedBuffer {
ScopedBuffer::from(&mut self.buffer[..]) ScopedBuffer::from(&mut self.buffer[..])
} }
......
...@@ -27,11 +27,11 @@ use super::OnInstance; ...@@ -27,11 +27,11 @@ use super::OnInstance;
/// The on-chain environment. /// The on-chain environment.
pub struct EnvInstance { pub struct EnvInstance {
/// Encode & decode buffer with static size of 16kB. /// Encode & decode buffer with static size of 16 kB.
/// ///
/// If operations require more than that they will fail. /// If operations require more than that they will fail.
/// This limit was chosen after benchmarking Substrate storage /// This limit was found to be a sweet spot after running benchmarks
/// storage and load performance and was found to be a sweet spot. /// on Substrate's storage and load performance.
/// ///
/// Please note that this is still an implementation detail and /// Please note that this is still an implementation detail and
/// might change. Users should generally avoid storing too big values /// might change. Users should generally avoid storing too big values
......
...@@ -294,7 +294,7 @@ pub struct RentParams<T: Environment> { ...@@ -294,7 +294,7 @@ pub struct RentParams<T: Environment> {
/// The fraction of the deposit costs that should be used as rent per block. /// The fraction of the deposit costs that should be used as rent per block.
/// ///
/// When a contract doesn't have enough balance deposited to stay alive indefinitely /// When a contract does not have enough balance deposited to stay alive indefinitely
/// it needs to pay per block for the storage it consumes that is not covered by the /// it needs to pay per block for the storage it consumes that is not covered by the
/// deposit. This determines how high this rent payment is per block as a fraction /// deposit. This determines how high this rent payment is per block as a fraction
/// of the deposit costs. /// of the deposit costs.
...@@ -322,18 +322,18 @@ pub struct RentParams<T: Environment> { ...@@ -322,18 +322,18 @@ pub struct RentParams<T: Environment> {
/// ///
/// # Note /// # Note
/// ///
/// The `current_*` fields do **not** consider changes to the code's refcount made during /// The `current_*` fields do **not** consider changes to the code's `refcount`
/// the currently running call. /// made during the currently running call.
#[derive(scale::Decode)] #[derive(scale::Decode)]
#[cfg_attr(test, derive(Debug, PartialEq))] #[cfg_attr(test, derive(Debug, PartialEq))]
pub struct RentStatus<T: Environment> { pub struct RentStatus<T: Environment> {
/// Required deposit assuming that this contract is the only user of its code. /// Required deposit assuming that this contract is the only user of its code.
pub max_deposit: T::Balance, pub max_deposit: T::Balance,
/// Required deposit assuming the code's current refcount. /// Required deposit assuming the code's current `refcount`.
pub current_deposit: T::Balance, pub current_deposit: T::Balance,
/// Required deposit assuming the specified refcount (`None` if `0` is supplied). /// Required deposit assuming the specified `refcount` (`None` if `0` is supplied).
pub custom_refcount_deposit: Option<T::Balance>, pub custom_refcount_deposit: Option<T::Balance>,
/// Rent that is paid assuming that the contract is the only user of its code. /// Rent that is paid assuming that the contract is the only user of its code.
......
...@@ -194,7 +194,7 @@ impl Dispatch<'_> { ...@@ -194,7 +194,7 @@ impl Dispatch<'_> {
} }
} }
/// Generates code for the dispatch trait impls for a generic ink! callable. /// Generates code for the dispatch trait implementations for a generic ink! callable.
fn generate_trait_impls_for_callable<C>( fn generate_trait_impls_for_callable<C>(
&self, &self,
cws: ir::CallableWithSelector<'_, C>, cws: ir::CallableWithSelector<'_, C>,
...@@ -247,7 +247,7 @@ impl Dispatch<'_> { ...@@ -247,7 +247,7 @@ impl Dispatch<'_> {
/// Returns a tuple of: /// Returns a tuple of:
/// ///
/// - Vector over the generated identifier bindings (`__ink_binding_N`) for all inputs. /// - Vector over the generated identifier bindings (`__ink_binding_N`) for all inputs.
/// - `TokenStream` representing the binding identifiers as tuple (for >=2 inputs), /// - `TokenStream` representing the binding identifiers as tuple (for equal to two or more inputs),
/// as single identifier (for exactly one input) or as wildcard (`_`) if there are /// as single identifier (for exactly one input) or as wildcard (`_`) if there are
/// no input bindings. /// no input bindings.
/// ///
...@@ -271,7 +271,7 @@ impl Dispatch<'_> { ...@@ -271,7 +271,7 @@ impl Dispatch<'_> {
/// # ; /// # ;
/// ``` /// ```
/// ///
/// **Multiple (>=2) inputs:** /// **Multiple (equal to two or more) inputs:**
/// ``` /// ```
/// # use quote::quote; /// # use quote::quote;
/// # let __ink_binding_0 = (); /// # let __ink_binding_0 = ();
......
...@@ -374,7 +374,7 @@ mod tests { ...@@ -374,7 +374,7 @@ mod tests {
/// line /// line
), ),
syn::parse_quote!( syn::parse_quote!(
/// commments /// comments
), ),
]) ])
.collect::<Vec<_>>(), .collect::<Vec<_>>(),
...@@ -382,7 +382,7 @@ mod tests { ...@@ -382,7 +382,7 @@ mod tests {
" multiple".to_string(), " multiple".to_string(),
" single".to_string(), " single".to_string(),
" line".to_string(), " line".to_string(),
" commments".to_string(), " comments".to_string(),
], ],
); );
assert_eq!( assert_eq!(
......
...@@ -25,7 +25,7 @@ use quote::{ ...@@ -25,7 +25,7 @@ use quote::{
}; };
use syn::spanned::Spanned as _; use syn::spanned::Spanned as _;
/// Generator to create the ink! storage struct and important trait impls. /// Generator to create the ink! storage struct and important trait implementations.
#[derive(From)] #[derive(From)]
pub struct Storage<'a> { pub struct Storage<'a> {
contract: &'a ir::Contract, contract: &'a ir::Contract,
......