Skip to content

Commit

Permalink
Fix typos in pallet-contracts (paritytech#13629)
Browse files Browse the repository at this point in the history
* Fix typos in pallet-contracts
  • Loading branch information
pgherveou authored and breathx committed Apr 22, 2023
1 parent 9d3a373 commit eef043b
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 37 deletions.
4 changes: 2 additions & 2 deletions client/state-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ impl<BlockHash: Hash, Key: Hash, D: MetaDb> StateDb<BlockHash, Key, D> {
}

/// Prevents pruning of specified block and its descendants.
/// `hint` used for futher checking if the given block exists
/// `hint` used for further checking if the given block exists
pub fn pin<F>(&self, hash: &BlockHash, number: u64, hint: F) -> Result<(), PinError>
where
F: Fn() -> bool,
Expand Down Expand Up @@ -665,7 +665,7 @@ pub enum IsPruned {
Pruned,
/// Definitely not pruned
NotPruned,
/// May or may not pruned, need futher checking
/// May or may not pruned, need further checking
MaybePruned,
}

Expand Down
2 changes: 1 addition & 1 deletion frame/contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ When setting up the `Schedule` for your runtime make sure to set `InstructionWei
to a non zero value. The default is `0` and prevents the upload of any non deterministic code.

An indeterministic code can be deployed on-chain by passing `Determinism::AllowIndeterministic`
to `upload_code`. A determinstic contract can then delegate call into it if and only if it
to `upload_code`. A deterministic contract can then delegate call into it if and only if it
is ran by using `bare_call` and passing `Determinism::AllowIndeterministic` to it. **Never use
this argument when the contract is called from an on-chain transaction.**

Expand Down
4 changes: 2 additions & 2 deletions frame/contracts/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ pub struct InstantiateReturnValue<AccountId> {
pub account_id: AccountId,
}

/// The result of succesfully uploading a contract.
/// The result of successfully uploading a contract.
#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo)]
pub struct CodeUploadReturnValue<CodeHash, Balance> {
/// The key under which the new code is stored.
Expand Down Expand Up @@ -239,7 +239,7 @@ where
}
}

/// If the amount of deposit (this type) is constrained by a `limit` this calcuates how
/// If the amount of deposit (this type) is constrained by a `limit` this calculates how
/// much balance (if any) is still available from this limit.
///
/// # Note
Expand Down
6 changes: 3 additions & 3 deletions frame/contracts/proc-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//! Procedural macroses used in the contracts module.
//! Procedural macros used in the contracts module.
//!
//! Most likely you should use the [`#[define_env]`][`macro@define_env`] attribute macro which hides
//! boilerplate of defining external environment for a wasm module.
Expand Down Expand Up @@ -527,7 +527,7 @@ fn expand_docs(def: &EnvDef) -> TokenStream2 {
}
}

/// Expands environment definiton.
/// Expands environment definition.
/// Should generate source code for:
/// - implementations of the host functions to be added to the wasm runtime environment (see
/// `expand_impls()`).
Expand Down Expand Up @@ -778,7 +778,7 @@ fn expand_functions(def: &EnvDef, expand_blocks: bool, host_state: TokenStream2)
#[proc_macro_attribute]
pub fn define_env(attr: TokenStream, item: TokenStream) -> TokenStream {
if !attr.is_empty() && !(attr.to_string() == "doc".to_string()) {
let msg = r#"Invalid `define_env` attribute macro: expected either no attributes or a single `doc` attibute:
let msg = r#"Invalid `define_env` attribute macro: expected either no attributes or a single `doc` attribute:
- `#[define_env]`
- `#[define_env(doc)]`"#;
let span = TokenStream2::from(attr).span();
Expand Down
2 changes: 1 addition & 1 deletion frame/contracts/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use sp_runtime::traits::{Hash, TrailingZeroInput};
pub trait AddressGenerator<T: Config> {
/// The address of a contract based on the given instantiate parameters.
///
/// Changing the formular for an already deployed chain is fine as long as no collisons
/// Changing the formular for an already deployed chain is fine as long as no collisions
/// with the old formular. Changes only affect existing contracts.
fn contract_address(
deploying_address: &T::AccountId,
Expand Down
2 changes: 1 addition & 1 deletion frame/contracts/src/benchmarking/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use wasm_instrument::{
},
};

/// The location where to put the genrated code.
/// The location where to put the generated code.
pub enum Location {
/// Generate all code into the `call` exported function.
Call,
Expand Down
8 changes: 4 additions & 4 deletions frame/contracts/src/benchmarking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ benchmarks! {
}: _(origin, callee, value, Weight::MAX, None, data)
verify {
let deposit = T::Currency::free_balance(&deposit_account);
// value and value transfered via call should be removed from the caller
// value and value transferred via call should be removed from the caller
assert_eq!(
T::Currency::free_balance(&instance.caller),
caller_funding::<T>() - instance.value - value - deposit - Pallet::<T>::min_balance(),
Expand Down Expand Up @@ -2224,7 +2224,7 @@ benchmarks! {
// the same amount of time. We follow that `t.load` and `drop` both have the weight
// of this benchmark / 2. We need to make this assumption because there is no way
// to measure them on their own using a valid wasm module. We need their individual
// values to derive the weight of individual instructions (by substraction) from
// values to derive the weight of individual instructions (by subtraction) from
// benchmarks that include those for parameter pushing and return type dropping.
// We call the weight of `t.load` and `drop`: `w_param`.
// The weight that would result from the respective benchmark we call: `w_bench`.
Expand Down Expand Up @@ -3003,9 +3003,9 @@ benchmarks! {
sbox.invoke();
}

// This is no benchmark. It merely exist to have an easy way to pretty print the curently
// This is no benchmark. It merely exist to have an easy way to pretty print the currently
// configured `Schedule` during benchmark development.
// It can be outputed using the following command:
// It can be outputted using the following command:
// cargo run --manifest-path=bin/node/cli/Cargo.toml \
// --features runtime-benchmarks -- benchmark pallet --extra --dev --execution=native \
// -p pallet_contracts -e print_schedule --no-median-slopes --no-min-squares
Expand Down
2 changes: 1 addition & 1 deletion frame/contracts/src/chain_extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ pub trait ChainExtension<C: Config> {
///
/// # Note
///
/// Currently, we support tuples of up to ten registred chain extensions. If more chain extensions
/// Currently, we support tuples of up to ten registered chain extensions. If more chain extensions
/// are needed consider opening an issue.
pub trait RegisteredChainExtension<C: Config>: ChainExtension<C> {
/// The extensions globally unique identifier.
Expand Down
10 changes: 5 additions & 5 deletions frame/contracts/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ where
pub enum ErrorOrigin {
/// Caller error origin.
///
/// The error happened in the current exeuction context rather than in the one
/// The error happened in the current execution context rather than in the one
/// of the contract that is called into.
Caller,
/// The error happened during execution of the called contract.
Callee,
}

/// Error returned by contract exection.
/// Error returned by contract execution.
#[cfg_attr(test, derive(Debug, PartialEq))]
pub struct ExecError {
/// The reason why the execution failed.
Expand Down Expand Up @@ -2455,7 +2455,7 @@ mod tests {
#[test]
fn in_memory_changes_not_discarded() {
// Call stack: BOB -> CHARLIE (trap) -> BOB' (success)
// This tests verfies some edge case of the contract info cache:
// This tests verifies some edge case of the contract info cache:
// We change some value in our contract info before calling into a contract
// that calls into ourself. This triggers a case where BOBs contract info
// is written to storage and invalidated by the successful execution of BOB'.
Expand Down Expand Up @@ -3405,7 +3405,7 @@ mod tests {
let code_hash = MockLoader::insert(Call, move |ctx, _| {
// It is set to one when this contract was instantiated by `place_contract`
assert_eq!(ctx.ext.nonce(), 1);
// Should not change without any instantation in-between
// Should not change without any instantiation in-between
assert_eq!(ctx.ext.nonce(), 1);
// Should not change with a failed instantiation
assert_err!(
Expand All @@ -3416,7 +3416,7 @@ mod tests {
}
);
assert_eq!(ctx.ext.nonce(), 1);
// Successful instantation increments
// Successful instantiation increments
ctx.ext.instantiate(Weight::zero(), success_code, 0, vec![], &[]).unwrap();
assert_eq!(ctx.ext.nonce(), 2);
exec_success()
Expand Down
6 changes: 3 additions & 3 deletions frame/contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ pub mod pallet {
T::MaxCodeLen::get(),
);

// Debug buffer should at least be large enough to accomodate a simple error message
// Debug buffer should at least be large enough to accommodate a simple error message
const MIN_DEBUG_BUF_SIZE: u32 = 256;
assert!(
T::MaxDebugBufferLen::get() > MIN_DEBUG_BUF_SIZE,
Expand Down Expand Up @@ -891,7 +891,7 @@ pub mod pallet {
/// The contract's code was found to be invalid during validation or instrumentation.
///
/// The most likely cause of this is that an API was used which is not supported by the
/// node. This hapens if an older node is used with a new version of ink!. Try updating
/// node. This happens if an older node is used with a new version of ink!. Try updating
/// your node to the newest available version.
///
/// A more detailed error can be found on the node console if debug messages are enabled
Expand Down Expand Up @@ -987,7 +987,7 @@ struct InternalOutput<T: Config, O> {
result: Result<O, ExecError>,
}

/// Helper trait to wrap contract execution entry points into a signle function
/// Helper trait to wrap contract execution entry points into a single function
/// [`Invokable::run_guarded`].
trait Invokable<T: Config> {
/// What is returned as a result of a successful invocation.
Expand Down
2 changes: 1 addition & 1 deletion frame/contracts/src/storage/meter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ impl<T: Config> Ext<T> for ReservingExt {
// we make sure to leave at least the ed in the free balance.
//
// The sender always has enough balance because we track it in the `ContractInfo` and
// never send more back than we have. Noone has access to the deposit account. Hence no
// never send more back than we have. No one has access to the deposit account. Hence no
// other interaction with this account takes place.
Deposit::Refund(amount) => {
if terminated {
Expand Down
4 changes: 2 additions & 2 deletions frame/contracts/src/wasm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ impl<T: Config> PrefabWasmModule<T> {
code_cache::try_remove::<T>(origin, code_hash)
}

/// Returns whether there is a deposit to be payed for this module.
/// Returns whether there is a deposit to be paid for this module.
///
/// Returns `0` if the module is already in storage and hence no deposit will
/// be charged when storing it.
Expand Down Expand Up @@ -689,7 +689,7 @@ mod tests {
executable.execute(ext.borrow_mut(), entry_point, input_data)
}

/// Execute the suppplied code.
/// Execute the supplied code.
fn execute<E: BorrowMut<MockExt>>(wat: &str, input_data: Vec<u8>, ext: E) -> ExecResult {
execute_internal(wat, input_data, ext, &ExportedFunction::Call, true, false)
}
Expand Down
6 changes: 3 additions & 3 deletions frame/contracts/src/wasm/prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub enum TryInstantiate {
Instantiate,
/// Skip the instantiation during preparation.
///
/// This makes sense when the preparation takes place as part of an instantation. Then
/// This makes sense when the preparation takes place as part of an instantiation. Then
/// this instantiation would fail the whole transaction and an extra check is not
/// necessary.
Skip,
Expand Down Expand Up @@ -376,7 +376,7 @@ fn get_memory_limits<T: Config>(
},
}
} else {
// If none memory imported then just crate an empty placeholder.
// If none memory imported then just create an empty placeholder.
// Any access to it will lead to out of bounds trap.
Ok((0, 0))
}
Expand Down Expand Up @@ -412,7 +412,7 @@ where
extended_const: false,
component_model: false,
// This is not our only defense: We check for float types later in the preparation
// process. Additionally, all instructions explictily need to have weights assigned
// process. Additionally, all instructions explicitly need to have weights assigned
// or the deployment will fail. We have none assigned for float instructions.
deterministic_only: matches!(determinism, Determinism::Deterministic),
mutable_global: false,
Expand Down
16 changes: 8 additions & 8 deletions frame/contracts/src/wasm/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,7 @@ pub mod env {
///
/// # Parameters
///
/// - `flags`: See `crate::wasm::runtime::CallFlags` for a documenation of the supported flags.
/// - `flags`: See `crate::wasm::runtime::CallFlags` for a documentation of the supported flags.
/// - `callee_ptr`: a pointer to the address of the callee contract. Should be decodable as an
/// `T::AccountId`. Traps otherwise.
/// - `gas`: how much gas to devote to the execution.
Expand Down Expand Up @@ -2038,7 +2038,7 @@ pub mod env {
/// # Note
///
/// The state rent functionality was removed. This is stub only exists for
/// backwards compatiblity
/// backwards compatibility
#[prefixed_alias]
#[deprecated]
fn restore_to(
Expand All @@ -2062,7 +2062,7 @@ pub mod env {
/// # Note
///
/// The state rent functionality was removed. This is stub only exists for
/// backwards compatiblity
/// backwards compatibility
#[version(1)]
#[prefixed_alias]
#[deprecated]
Expand All @@ -2084,7 +2084,7 @@ pub mod env {
/// # Note
///
/// The state rent functionality was removed. This is stub only exists for
/// backwards compatiblity.
/// backwards compatibility.
#[prefixed_alias]
#[deprecated]
fn set_rent_allowance(
Expand All @@ -2102,7 +2102,7 @@ pub mod env {
/// # Note
///
/// The state rent functionality was removed. This is stub only exists for
/// backwards compatiblity.
/// backwards compatibility.
#[version(1)]
#[prefixed_alias]
#[deprecated]
Expand All @@ -2116,7 +2116,7 @@ pub mod env {
/// # Note
///
/// The state rent functionality was removed. This is stub only exists for
/// backwards compatiblity.
/// backwards compatibility.
#[prefixed_alias]
#[deprecated]
fn rent_allowance(ctx: _, memory: _, out_ptr: u32, out_len_ptr: u32) -> Result<(), TrapReason> {
Expand Down Expand Up @@ -2409,7 +2409,7 @@ pub mod env {
///
/// # Return Value
///
/// Returns `ReturnCode::Success` when the dispatchable was succesfully executed and
/// Returns `ReturnCode::Success` when the dispatchable was successfully executed and
/// returned `Ok`. When the dispatchable was exeuted but returned an error
/// `ReturnCode::CallRuntimeFailed` is returned. The full error is not
/// provided because it is not guaranteed to be stable.
Expand Down Expand Up @@ -2603,7 +2603,7 @@ pub mod env {

/// Returns a nonce that is unique per contract instantiation.
///
/// The nonce is incremented for each succesful contract instantiation. This is a
/// The nonce is incremented for each successful contract instantiation. This is a
/// sensible default salt for contract instantiations.
#[unstable]
fn instantiation_nonce(ctx: _, _memory: _) -> Result<u64, TrapReason> {
Expand Down

0 comments on commit eef043b

Please sign in to comment.