Fix typos and markdown (#2388)

* Fix typos

* Align properly

* Update core/consensus/slots/src/lib.rs

Co-Authored-By: cmichi <mich@elmueller.net>

* Update core/network/src/test/mod.rs

Co-Authored-By: cmichi <mich@elmueller.net>

* Update core/finality-grandpa/src/communication/mod.rs

Co-Authored-By: cmichi <mich@elmueller.net>

* Update core/consensus/common/src/import_queue.rs

Co-Authored-By: cmichi <mich@elmueller.net>
This commit is contained in:
Michael Müller
2019-04-26 14:09:13 +02:00
committed by Bastian Köcher
parent f0202aa425
commit a0e0d9b03d
31 changed files with 47 additions and 47 deletions
+2 -2
View File
@@ -229,8 +229,8 @@ Then build the code:
[source, shell]
----
./scripts/build.sh # Builds the WebAssembly binaries
cargo build # Builds all native code
./scripts/build.sh # Builds the WebAssembly binaries
cargo build # Builds all native code
----
You can run all the tests if you like:
+2 -2
View File
@@ -20,7 +20,7 @@ use std::path::PathBuf;
use structopt::{StructOpt, clap::{arg_enum, _clap_count_exprs, App, AppSettings, SubCommand, Arg}};
use client;
/// Auxialary macro to implement `GetLogFilter` for all types that have the `shared_params` field.
/// Auxiliary macro to implement `GetLogFilter` for all types that have the `shared_params` field.
macro_rules! impl_get_log_filter {
( $type:ident ) => {
impl $crate::GetLogFilter for $type {
@@ -564,7 +564,7 @@ pub struct ImportBlocksCmd {
impl_get_log_filter!(ImportBlocksCmd);
/// The `revert` command used revert the chain to a previos state.
/// The `revert` command used revert the chain to a previous state.
#[derive(Debug, StructOpt, Clone)]
pub struct RevertCmd {
/// Number of blocks to revert.
+3 -3
View File
@@ -436,7 +436,7 @@ impl<Block: BlockT, T: CacheItemT> Fork<Block, T> {
}
}
/// Try to append NEW block to the fork. This method willonly 'work' (return true) when block
/// Try to append NEW block to the fork. This method will only 'work' (return true) when block
/// is actually appended to the fork AND the best known block of the fork is known (i.e. some
/// block has been already appended to this fork after last restart).
pub fn try_append(&self, parent: &ComplexBlockId<Block>) -> bool {
@@ -932,7 +932,7 @@ pub mod tests {
assert!(tx.removed_entries().is_empty());
assert_eq!(*tx.updated_meta(), Some(Metadata { finalized: Some(correct_id(2)), unfinalized: vec![correct_id(3)] }));
// when inserting finalized entry AND there are no previous finalzed entries
// when inserting finalized entry AND there are no previous finalized entries
let cache = ListCache::new(DummyStorage::new(), 1024, correct_id(2));
let mut tx = DummyTransaction::new();
assert_eq!(cache.on_block_insert(&mut tx, correct_id(2), correct_id(3), Some(3), true).unwrap(),
@@ -1031,7 +1031,7 @@ pub mod tests {
// when new block is appended to unfinalized fork
cache.on_transaction_commit(CommitOperation::AppendNewBlock(0, correct_id(6)));
assert_eq!(cache.unfinalized[0].best_block, Some(correct_id(6)));
// when new entry is appnded to unfinalized fork
// when new entry is appended to unfinalized fork
cache.on_transaction_commit(CommitOperation::AppendNewEntry(0, Entry { valid_from: correct_id(7), value: Some(7) }));
assert_eq!(cache.unfinalized[0].best_block, Some(correct_id(7)));
assert_eq!(cache.unfinalized[0].head, Entry { valid_from: correct_id(7), value: Some(7) });
+1 -1
View File
@@ -764,7 +764,7 @@ impl<Block: BlockT<Hash=H256>> Backend<Block> {
Ok((*hash, number, false, true))
}
// performs forced canonicaliziation with a delay after importning a non-finalized block.
// performs forced canonicaliziation with a delay after importing a non-finalized block.
fn force_delayed_canonicalize(
&self,
transaction: &mut DBTransaction,
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
//! Light client blockchin backend. Only stores headers and justifications of recent
//! Light client blockchain backend. Only stores headers and justifications of recent
//! blocks. CHT roots are stored for headers of ancient blocks.
use std::{sync::{Weak, Arc}, collections::HashMap};
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
//! Light client call exector. Executes methods on remote full nodes, fetching
//! Light client call executor. Executes methods on remote full nodes, fetching
//! execution proof and checking it locally.
use std::{collections::HashSet, sync::Arc, panic::UnwindSafe, result, marker::PhantomData};
@@ -406,7 +406,7 @@ pub fn prove_execution<Block, S, E>(
/// Check remote contextual execution proof using given backend.
///
/// Method is executed using passed header as environment' current block.
/// Proof shoul include both environment preparation proof and method execution proof.
/// Proof should include both environment preparation proof and method execution proof.
pub fn check_execution_proof<Header, E, H>(
executor: &E,
request: &RemoteCallRequest<Header>,
@@ -589,7 +589,7 @@ pub fn import_single_block<B: BlockT, V: Verifier<B>>(
match import_error(import_handle.check_block(hash, parent))? {
BlockImportResult::ImportedUnknown { .. } => (),
r @ _ => return Ok(r), // Any other successfull result means that the block is already imported.
r => return Ok(r), // Any other successful result means that the block is already imported.
}
let (import_block, new_authorities) = verifier.verify(block_origin, header, justification, block.body)
+1 -1
View File
@@ -613,7 +613,7 @@ impl<B, P, I> BftService<B, P, I>
.map_or(true, |x| self.can_build_on_inner(header, x))
}
/// Get a reference to the underyling client.
/// Get a reference to the underlying client.
pub fn client(&self) -> &I { &*self.client }
fn can_build_on_inner(&self, header: &B::Header, live: &(B::Header, AgreementHandle)) -> bool {
+1 -1
View File
@@ -41,7 +41,7 @@ use codec::{Encode, Decode};
/// A worker that should be invoked at every new slot.
pub trait SlotWorker<B: Block> {
/// The type fo the future that will be returned when a new slot is
/// The type of the future that will be returned when a new slot is
/// triggered.
type OnSlot: IntoFuture<Item=(), Error=consensus_common::Error>;
@@ -704,7 +704,7 @@ impl<Block: BlockT, N: Network<Block>> Sink for CommitsOut<Block, N> {
let topic = global_topic::<Block>(self.set_id.0);
// the gossip validator needs to be made aware of the best commit-height we know of
// before gosipping
// before gossiping
self.gossip_validator.note_commit_finalized(
commit.target_number,
|to, neighbor| self.network.send_message(
+1 -1
View File
@@ -79,7 +79,7 @@ impl Keyring {
.expect("static values are known good; qed")
}
/// Returns an interator over all test accounts.
/// Returns an iterator over all test accounts.
pub fn iter() -> impl Iterator<Item=Keyring> {
<Self as strum::IntoEnumIterator>::iter()
}
@@ -194,7 +194,7 @@ enum ProtocolState<TMessage, TSubstream> {
},
/// We sometimes temporarily switch to this state during processing. If we are in this state
/// at the beginning of a method, that means something bad happend in the source code.
/// at the beginning of a method, that means something bad happened in the source code.
Poisoned,
}
+1 -1
View File
@@ -58,7 +58,7 @@ pub use test_client::TestClient;
pub struct PassThroughVerifier(pub bool);
#[cfg(any(test, feature = "test-helpers"))]
/// This Verifiyer accepts all data as valid
/// This `Verifier` accepts all data as valid.
impl<B: BlockT> Verifier<B> for PassThroughVerifier {
fn verify(
&self,
@@ -52,7 +52,7 @@ fn encode_with_vec_prefix<T: Encode, F: Fn(&mut Vec<u8>)>(encoder: F) -> Vec<u8>
v.resize(reserve, 0);
encoder(&mut v);
// need to prefix with the total length to ensure it's binary comptible with
// need to prefix with the total length to ensure it's binary compatible with
// Vec<u8>.
let mut length: Vec<()> = Vec::new();
length.resize(v.len() - reserve, ());
@@ -27,7 +27,7 @@ fn system_digest_item_encoding() {
assert_eq!(encoded, vec![
// type = DigestItemType::AuthoritiesChange
1,
// number of items in athorities set
// number of items in authorities set
12,
// authorities
10, 0, 0, 0,
@@ -49,7 +49,7 @@ pub enum TransactionValidity {
requires: Vec<TransactionTag>,
/// Provided tags
///
/// A list of tags this transaction provides. Successfuly importing the transaction
/// A list of tags this transaction provides. Successfully importing the transaction
/// will enable other transactions that depend on (require) those tags to be included as well.
/// Provided and requried tags allow Substrate to build a dependency graph of transactions
/// and import them in the right (linear) order.
@@ -228,7 +228,7 @@ impl<'a, RS: 'a + RootsStorage<H>, S: Storage<H>, H: Hasher> DrilldownIteratorEs
.ok_or_else(|| format!("Changes trie root for block {} is not found", block))?;
// only return extrinsics for blocks before self.max
// most of blocks will be filtered out beore pushing to `self.blocks`
// most of blocks will be filtered out before pushing to `self.blocks`
// here we just throwing away changes at digest blocks we're processing
debug_assert!(block >= self.begin, "We shall not touch digests earlier than a range' begin");
if block <= self.end.number {
@@ -33,7 +33,7 @@
//! to the set of lower-level digest blocks.
//!
//! Changes trie only contains the top level storage changes. Sub-level changes
//! are propogated through its storage root on the top level storage.
//! are propagated through its storage root on the top level storage.
mod build;
mod build_iterator;
@@ -41,9 +41,9 @@ pub fn oldest_non_pruned_trie(
}
}
/// Prune obslete changes tries. Puning happens at the same block, where highest
/// Prune obsolete changes tries. Pruning happens at the same block, where highest
/// level digest is created. Pruning guarantees to save changes tries for last
/// `min_blocks_to_keep` blocks. We only prune changes tries at `max_digest_iterval`
/// `min_blocks_to_keep` blocks. We only prune changes tries at `max_digest_interval`
/// ranges.
/// Returns MemoryDB that contains all deleted changes tries nodes.
pub fn prune<S: Storage<H>, H: Hasher, F: FnMut(H::Out)>(
@@ -43,9 +43,9 @@ use crate::ready::ReadyTransactions;
/// Successful import result.
#[derive(Debug, PartialEq, Eq)]
pub enum Imported<Hash, Ex> {
/// Transaction was successfuly imported to Ready queue.
/// Transaction was successfully imported to Ready queue.
Ready {
/// Hash of transaction that was successfuly imported.
/// Hash of transaction that was successfully imported.
hash: Hash,
/// Transactions that got promoted from the Future queue.
promoted: Vec<Hash>,
@@ -54,9 +54,9 @@ pub enum Imported<Hash, Ex> {
/// Transactions removed from the Ready pool (replaced).
removed: Vec<Arc<Transaction<Hash, Ex>>>,
},
/// Transaction was successfuly imported to Future queue.
/// Transaction was successfully imported to Future queue.
Future {
/// Hash of transaction that was successfuly imported.
/// Hash of transaction that was successfully imported.
hash: Hash,
}
}
@@ -33,7 +33,7 @@ error_chain! {
description("Runtime check for the transaction failed."),
display("Invalid Transaction. Error Code: {}", e),
}
/// The transaction is temporarily baned
/// The transaction is temporarily banned
TemporarilyBanned {
description("Transaction is temporarily banned from importing to the pool."),
display("Temporarily Banned"),
@@ -304,7 +304,7 @@ impl<B: ChainApi> Pool<B> {
let hashes = status.pruned.iter().map(|tx| tx.hash.clone()).collect::<Vec<_>>();
let results = self.submit_at(at, status.pruned.into_iter().map(|tx| tx.data.clone()))?;
// Collect the hashes of transactions that now became invalid (meaning that they are succesfuly pruned).
// Collect the hashes of transactions that now became invalid (meaning that they are succesfully pruned).
let hashes = results.into_iter().enumerate().filter_map(|(idx, r)| match r.map_err(error::IntoPoolError::into_pool_error) {
Err(Ok(err)) => match err.kind() {
error::ErrorKind::InvalidTransaction(_) => Some(hashes[idx].clone()),
@@ -333,7 +333,7 @@ impl<B: ChainApi> Pool<B> {
///
/// Stale transactions are transaction beyond their longevity period.
/// Note this function does not remove transactions that are already included in the chain.
/// See `prune_tags` ifyou want this.
/// See `prune_tags` if you want this.
pub fn clear_stale(&self, at: &BlockId<B::Block>) -> Result<(), B::Error> {
let block_number = self.api.block_id_to_number(at)?
.ok_or_else(|| error::ErrorKind::Msg(format!("Invalid block id: {:?}", at)).into())?
+1 -1
View File
@@ -22,7 +22,7 @@
use std::fmt;
use parity_codec::{Decode, Encode};
/// Error occured when interating with the tree.
/// Error occured when iterating with the tree.
#[derive(Clone, Debug, PartialEq)]
pub enum Error<E> {
/// Adding duplicate node to tree.
+3 -3
View File
@@ -255,7 +255,7 @@ pub fn refund_unused_gas<T: Trait>(
}
}
/// A little handy utility for converting a value in balance units into approximitate value in gas units
/// A little handy utility for converting a value in balance units into approximate value in gas units
/// at the given gas price.
pub fn approx_gas_for_balance<T: Trait>(gas_price: BalanceOf<T>, balance: BalanceOf<T>) -> T::Gas {
let amount_in_gas: BalanceOf<T> = balance / gas_price;
@@ -316,7 +316,7 @@ mod tests {
struct DoubleTokenMetadata {
multiplier: u64,
}
/// A simple token that charges for the given amount multipled to
/// A simple token that charges for the given amount multiplied to
/// a multiplier taken from a given metadata.
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
struct DoubleToken(u64);
@@ -324,7 +324,7 @@ mod tests {
impl Token<Test> for DoubleToken {
type Metadata = DoubleTokenMetadata;
fn calculate_amount(&self, metadata: &DoubleTokenMetadata) -> u64 {
// Probably you want to use saturating mul in producation code.
// Probably you want to use saturating mul in production code.
self.0 * metadata.multiplier
}
}
+2 -2
View File
@@ -308,7 +308,7 @@ decl_module! {
let result = ctx.call(dest, value, &mut gas_meter, &data, exec::EmptyOutputBuf::new());
if let Ok(_) = result {
// Commit all changes that made it thus far into the persistant storage.
// Commit all changes that made it thus far into the persistent storage.
DirectAccountDb.commit(ctx.overlay.into_change_set());
// Then deposit all events produced.
@@ -362,7 +362,7 @@ decl_module! {
let result = ctx.instantiate(endowment, &mut gas_meter, &code_hash, &data);
if let Ok(_) = result {
// Commit all changes that made it thus far into the persistant storage.
// Commit all changes that made it thus far into the persistent storage.
DirectAccountDb.commit(ctx.overlay.into_change_set());
// Then deposit all events produced.
@@ -167,7 +167,7 @@ macro_rules! register_func {
/// will panic if called with unexpected arguments.
///
/// It's up to the user of this macro to check signatures of wasm code to be executed
/// and reject the code if any imported function has a mismached signature.
/// and reject the code if any imported function has a mismatched signature.
macro_rules! define_env {
( $init_name:ident , < E: $ext_ty:tt > ,
$( $name:ident ( $ctx:ident $( , $names:ident : $params:ty )* )
+2 -2
View File
@@ -155,8 +155,8 @@ impl<'a, T: Trait> crate::exec::Vm<T> for WasmVm<'a, T> {
Err(err @ sandbox::Error::Execution) => to_execution_result(runtime, Some(err)),
Err(_err @ sandbox::Error::Module) => {
// `Error::Module` is returned only if instantiation or linking failed (i.e.
// wasm bianry tried to import a function that is not provided by the host).
// This shouldn't happen because validation proccess ought to reject such binaries.
// wasm binary tried to import a function that is not provided by the host).
// This shouldn't happen because validation process ought to reject such binaries.
//
// Because panics are really undesirable in the runtime code, we treat this as
// a trap for now. Eventually, we might want to revisit this.
+1 -1
View File
@@ -318,7 +318,7 @@ pub fn prepare_contract<T: Trait, C: ImportSatisfyCheck>(
(initial, Some(maximum)) => MemoryDefinition { initial, maximum },
(_, None) => {
// Maximum number of pages should be always declared.
// This isn't a hard requirement and can be treated as a maxiumum set
// This isn't a hard requirement and can be treated as a maximum set
// to configured maximum.
return Err("Maximum number of pages should be always declared.");
}
@@ -58,7 +58,7 @@ pub(crate) fn fields_access(
/// For enums:
/// variant are tested in order of definition.
/// Empty variant is always true.
/// Please use carefully, this will fully parse successfull variant twice.
/// Please use carefully, this will fully parse successful variant twice.
#[proc_macro_derive(Parse)]
pub fn derive_parse(input: TokenStream) -> TokenStream {
let item = parse_macro_input!(input as syn::Item);
@@ -71,8 +71,8 @@ pub fn generate_hidden_includes(unique_id: &str, def_crate: &str) -> TokenStream
}
}
// fn to remove white spaces arount string types
// (basically whitespaces arount tokens)
// fn to remove white spaces around string types
// (basically whitespaces around tokens)
pub fn clean_type_string(input: &str) -> String {
input
.replace(" ::", "::")
+2 -2
View File
@@ -372,7 +372,7 @@ pub fn ensure_inherent<OuterOrigin, AccountId>(o: OuterOrigin) -> Result<(), &'s
}
impl<T: Trait> Module<T> {
/// Gets the index of extrinsic that is currenty executing.
/// Gets the index of extrinsic that is currently executing.
pub fn extrinsic_index() -> Option<u32> {
storage::unhashed::get(well_known_keys::EXTRINSIC_INDEX)
}
@@ -462,7 +462,7 @@ impl<T: Trait> Module<T> {
<Number<T>>::put(n);
}
/// Sets the index of extrinsic that is currenty executing.
/// Sets the index of extrinsic that is currently executing.
#[cfg(any(feature = "std", test))]
pub fn set_extrinsic_index(extrinsic_index: u32) {
storage::unhashed::put(well_known_keys::EXTRINSIC_INDEX, &extrinsic_index)