From 3e2c77aa218607898057133e3a0de56223cc9043 Mon Sep 17 00:00:00 2001 From: kaichao Date: Tue, 2 Jul 2019 01:33:38 +0800 Subject: [PATCH] typo fix in core (#2987) --- substrate/core/client/src/blockchain.rs | 2 +- substrate/core/client/src/light/backend.rs | 2 +- substrate/core/consensus/babe/src/digest.rs | 2 +- substrate/core/consensus/babe/src/lib.rs | 2 +- substrate/core/executor/src/sandbox.rs | 10 +++++----- substrate/core/inherents/src/lib.rs | 8 ++++---- substrate/core/peerset/src/lib.rs | 2 +- substrate/core/sr-primitives/src/lib.rs | 2 +- substrate/core/sr-sandbox/src/lib.rs | 3 +-- substrate/core/sr-sandbox/without_std.rs | 2 +- substrate/core/state-machine/src/changes_trie/build.rs | 2 +- .../state-machine/src/changes_trie/build_iterator.rs | 2 +- .../state-machine/src/changes_trie/changes_iterator.rs | 2 +- substrate/core/state-machine/src/changes_trie/prune.rs | 2 +- substrate/core/state-machine/src/ext.rs | 2 +- substrate/core/state-machine/src/lib.rs | 2 +- substrate/core/transaction-pool/graph/src/ready.rs | 2 +- 17 files changed, 24 insertions(+), 25 deletions(-) diff --git a/substrate/core/client/src/blockchain.rs b/substrate/core/client/src/blockchain.rs index b07e26396e..77c2051138 100644 --- a/substrate/core/client/src/blockchain.rs +++ b/substrate/core/client/src/blockchain.rs @@ -85,7 +85,7 @@ pub trait Backend: HeaderBackend { /// Returns hashes of all blocks that are leaves of the block tree. /// in other words, that have no children, are chain heads. - /// Results must be ordered best (longest, heighest) chain first. + /// Results must be ordered best (longest, highest) chain first. fn leaves(&self) -> Result>; /// Return hashes of all blocks that are children of the block with `parent_hash`. diff --git a/substrate/core/client/src/light/backend.rs b/substrate/core/client/src/light/backend.rs index f71366808e..1104518811 100644 --- a/substrate/core/client/src/light/backend.rs +++ b/substrate/core/client/src/light/backend.rs @@ -38,7 +38,7 @@ use hash_db::Hasher; use trie::MemoryDB; use consensus::well_known_cache_keys; -const IN_MEMORY_EXPECT_PROOF: &str = "InMemory state backend has Void error type and always suceeds; qed"; +const IN_MEMORY_EXPECT_PROOF: &str = "InMemory state backend has Void error type and always succeeds; qed"; /// Light client backend. pub struct Backend { diff --git a/substrate/core/consensus/babe/src/digest.rs b/substrate/core/consensus/babe/src/digest.rs index 7356001cf7..9b934bce6f 100644 --- a/substrate/core/consensus/babe/src/digest.rs +++ b/substrate/core/consensus/babe/src/digest.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -//! Private mplementation details of BABE digests. +//! Private implementation details of BABE digests. use primitives::sr25519::{Public, Signature}; use babe_primitives::BABE_ENGINE_ID; diff --git a/substrate/core/consensus/babe/src/lib.rs b/substrate/core/consensus/babe/src/lib.rs index 0bab790c99..b9ba11c55f 100644 --- a/substrate/core/consensus/babe/src/lib.rs +++ b/substrate/core/consensus/babe/src/lib.rs @@ -97,7 +97,7 @@ impl Config { /// state. pub fn get_or_compute(client: &C) -> CResult where - C: AuxStore, C: ProvideRuntimeApi, C::Api: BabeApi, + C: AuxStore + ProvideRuntimeApi, C::Api: BabeApi, { trace!(target: "babe", "Getting slot duration"); match slots::SlotDuration::get_or_compute(client, |a, b| a.startup_data(b)).map(Self) { diff --git a/substrate/core/executor/src/sandbox.rs b/substrate/core/executor/src/sandbox.rs index ceb5f44a26..6919c9476d 100644 --- a/substrate/core/executor/src/sandbox.rs +++ b/substrate/core/executor/src/sandbox.rs @@ -341,11 +341,11 @@ impl SandboxInstance { } } -/// Error occured during instantiation of a sandboxed module. +/// Error occurred during instantiation of a sandboxed module. pub enum InstantiationError { /// Something wrong with the environment definition. It either can't /// be decoded, have a reference to a non-existent or torn down memory instance. - EnvironmentDefintionCorrupted, + EnvironmentDefinitionCorrupted, /// Provided module isn't recognized as a valid webassembly binary. ModuleDecoding, /// Module is a well-formed webassembly binary but could not be instantiated. This could @@ -361,7 +361,7 @@ fn decode_environment_definition( memories: &[Option], ) -> std::result::Result<(Imports, GuestToSupervisorFunctionMapping), InstantiationError> { let env_def = sandbox_primitives::EnvironmentDefinition::decode(&mut &raw_env_def[..]) - .ok_or_else(|| InstantiationError::EnvironmentDefintionCorrupted)?; + .ok_or_else(|| InstantiationError::EnvironmentDefinitionCorrupted)?; let mut func_map = HashMap::new(); let mut memories_map = HashMap::new(); @@ -381,8 +381,8 @@ fn decode_environment_definition( let memory_ref = memories .get(memory_idx as usize) .cloned() - .ok_or_else(|| InstantiationError::EnvironmentDefintionCorrupted)? - .ok_or_else(|| InstantiationError::EnvironmentDefintionCorrupted)?; + .ok_or_else(|| InstantiationError::EnvironmentDefinitionCorrupted)? + .ok_or_else(|| InstantiationError::EnvironmentDefinitionCorrupted)?; memories_map.insert((module, field), memory_ref); } } diff --git a/substrate/core/inherents/src/lib.rs b/substrate/core/inherents/src/lib.rs index 7b99c7ba52..040f289957 100644 --- a/substrate/core/inherents/src/lib.rs +++ b/substrate/core/inherents/src/lib.rs @@ -16,8 +16,8 @@ //! Provides types and traits for creating and checking inherents. //! -//! Each inherent is added to a produced block. Each runtime decides on which inherents its -//! want to attach to its blocks. All data that is required for the runtime to create the inherents +//! Each inherent is added to a produced block. Each runtime decides on which inherents it +//! wants to attach to its blocks. All data that is required for the runtime to create the inherents //! is stored in the `InherentData`. This `InherentData` is constructed by the node and given to //! the runtime. //! @@ -124,8 +124,8 @@ impl InherentData { /// /// It either returns okay for all checks, stores all occurred errors or just one fatal error. /// -/// When a fatal error occurres, all other errors are removed and the implementation needs to -/// abbort checking inherents. +/// When a fatal error occurs, all other errors are removed and the implementation needs to +/// abort checking inherents. #[derive(Encode, Decode, Clone)] pub struct CheckInherentsResult { /// Did the check succeed? diff --git a/substrate/core/peerset/src/lib.rs b/substrate/core/peerset/src/lib.rs index aa3ce02076..d95a098093 100644 --- a/substrate/core/peerset/src/lib.rs +++ b/substrate/core/peerset/src/lib.rs @@ -353,7 +353,7 @@ impl Peerset { /// a corresponding `Accept` or `Reject`, except if we were already connected to this peer. /// /// Note that this mechanism is orthogonal to `Connect`/`Drop`. Accepting an incoming - /// connection implicitely means `Connect`, but incoming connections aren't cancelled by + /// connection implicitly means `Connect`, but incoming connections aren't cancelled by /// `dropped`. /// // Implementation note: because of concurrency issues, it is possible that we push a `Connect` diff --git a/substrate/core/sr-primitives/src/lib.rs b/substrate/core/sr-primitives/src/lib.rs index 3874a87d2b..25788a15e0 100644 --- a/substrate/core/sr-primitives/src/lib.rs +++ b/substrate/core/sr-primitives/src/lib.rs @@ -111,7 +111,7 @@ pub trait BuildStorage: Sized { ) -> Result<(), String>; } -/// Somethig that can build the genesis storage of a module. +/// Something that can build the genesis storage of a module. #[cfg(feature = "std")] pub trait BuildModuleGenesisStorage: Sized { /// Create the module genesis storage into the given `storage` and `child_storage`. diff --git a/substrate/core/sr-sandbox/src/lib.rs b/substrate/core/sr-sandbox/src/lib.rs index 1e8b2b3f1d..9cb39236b0 100755 --- a/substrate/core/sr-sandbox/src/lib.rs +++ b/substrate/core/sr-sandbox/src/lib.rs @@ -96,7 +96,7 @@ impl Memory { /// /// The memory allocated with initial number of pages specified by `initial`. /// Minimal possible value for `initial` is 0 and maximum possible is `65536`. - /// (Since maximum addressible memory is 232 = 4GiB = 65536 * 64KiB). + /// (Since maximum addressable memory is 232 = 4GiB = 65536 * 64KiB). /// /// It is possible to limit maximum number of pages this memory instance can have by specifying /// `maximum`. If not specified, this memory instance would be able to allocate up to 4GiB. @@ -168,7 +168,6 @@ impl EnvironmentDefinitionBuilder { /// This instance can be used for invoking exported functions. pub struct Instance { inner: imp::Instance, - } impl Instance { diff --git a/substrate/core/sr-sandbox/without_std.rs b/substrate/core/sr-sandbox/without_std.rs index 894ba43eb0..9fb255a523 100755 --- a/substrate/core/sr-sandbox/without_std.rs +++ b/substrate/core/sr-sandbox/without_std.rs @@ -33,7 +33,7 @@ mod ffi { /// # Safety /// /// This function should be only called with a `HostFuncIndex` that was previously registered - /// in the environment defintion. Typically this should only + /// in the environment definition. Typically this should only /// be called with an argument received in `dispatch_thunk`. pub unsafe fn coerce_host_index_to_func(idx: HostFuncIndex) -> HostFuncType { // We need to ensure that sizes of a callable function pointer and host function index is diff --git a/substrate/core/state-machine/src/changes_trie/build.rs b/substrate/core/state-machine/src/changes_trie/build.rs index 487fde2e35..96d2278cc2 100644 --- a/substrate/core/state-machine/src/changes_trie/build.rs +++ b/substrate/core/state-machine/src/changes_trie/build.rs @@ -29,7 +29,7 @@ use crate::changes_trie::{AnchorBlockId, Configuration, Storage, BlockNumber}; /// Prepare input pairs for building a changes trie of given block. /// -/// Returns Err if storage error has occured OR if storage haven't returned +/// Returns Err if storage error has occurred OR if storage haven't returned /// required data. /// Returns Ok(None) data required to prepare input pairs is not collected /// or storage is not provided. diff --git a/substrate/core/state-machine/src/changes_trie/build_iterator.rs b/substrate/core/state-machine/src/changes_trie/build_iterator.rs index 5d8a8318ab..b0c7180d26 100644 --- a/substrate/core/state-machine/src/changes_trie/build_iterator.rs +++ b/substrate/core/state-machine/src/changes_trie/build_iterator.rs @@ -15,7 +15,7 @@ // along with Substrate. If not, see . //! Structures and functions to return blocks whose changes are to be included -//! in given block' changes trie. +//! in given block's changes trie. use crate::changes_trie::{Configuration, BlockNumber}; diff --git a/substrate/core/state-machine/src/changes_trie/changes_iterator.rs b/substrate/core/state-machine/src/changes_trie/changes_iterator.rs index 0e4716ccab..ee4b9cc19b 100644 --- a/substrate/core/state-machine/src/changes_trie/changes_iterator.rs +++ b/substrate/core/state-machine/src/changes_trie/changes_iterator.rs @@ -98,7 +98,7 @@ pub fn key_changes_proof, H: Hasher, Number: BlockNumber>( Ok(iter.extract_proof()) } -/// Check key changes proog and return changes of the key at given blocks range. +/// Check key changes proof and return changes of the key at given blocks range. /// `max` is the number of best known block. /// Changes are returned in descending order (i.e. last block comes first). pub fn key_changes_proof_check, H: Hasher, Number: BlockNumber>( diff --git a/substrate/core/state-machine/src/changes_trie/prune.rs b/substrate/core/state-machine/src/changes_trie/prune.rs index 3aedf66f75..08e7c02b8c 100644 --- a/substrate/core/state-machine/src/changes_trie/prune.rs +++ b/substrate/core/state-machine/src/changes_trie/prune.rs @@ -145,7 +145,7 @@ fn pruning_range( /// blocks. So we can only prune blocks that are earlier than B - max_digest_interval. /// The pruning_delay stands for number of max_digest_interval-s that we want to keep: /// 0 or 1: means that only last changes trie is guaranteed to exists; -/// 2: the last chnages trie + previous changes trie +/// 2: the last changes trie + previous changes trie /// ... fn max_digest_intervals_to_keep( min_blocks_to_keep: Number, diff --git a/substrate/core/state-machine/src/ext.rs b/substrate/core/state-machine/src/ext.rs index dcc63cb196..d8619d1506 100644 --- a/substrate/core/state-machine/src/ext.rs +++ b/substrate/core/state-machine/src/ext.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -//! Conrete externalities implementation. +//! Concrete externalities implementation. use std::{error, fmt, cmp::Ord}; use log::warn; diff --git a/substrate/core/state-machine/src/lib.rs b/substrate/core/state-machine/src/lib.rs index 954ff38979..59d3239ff9 100644 --- a/substrate/core/state-machine/src/lib.rs +++ b/substrate/core/state-machine/src/lib.rs @@ -62,7 +62,7 @@ pub use trie_backend::TrieBackend; /// A wrapper around a child storage key. /// -/// This wrapper ensures that the child storage key is correct and properly used. It is +/// This wrapper ensures that the child storage key is correct and properly used. It is /// impossible to create an instance of this struct without providing a correct `storage_key`. pub struct ChildStorageKey<'a, H: Hasher> { storage_key: Cow<'a, [u8]>, diff --git a/substrate/core/transaction-pool/graph/src/ready.rs b/substrate/core/transaction-pool/graph/src/ready.rs index 3497c1bc4b..85bb4dd783 100644 --- a/substrate/core/transaction-pool/graph/src/ready.rs +++ b/substrate/core/transaction-pool/graph/src/ready.rs @@ -350,7 +350,7 @@ impl ReadyTransactions { /// we are about to replace is lower than the priority of the replacement transaction. /// We remove/replace old transactions in case they have lower priority. /// - /// In case replacement is succesful returns a list of removed transactions. + /// In case replacement is successful returns a list of removed transactions. fn replace_previous(&mut self, tx: &Transaction) -> error::Result>>> { let mut to_remove = { // check if we are replacing a transaction